Skip to content
Permalink
Browse files

Detect submodules not synced (#556)

Because the dependencies are now referenced via git submodules, the cmake build system grows the ability to update the submodules on build to ensure that they're up to date (optional, defaults to ON).
  • Loading branch information...
ssteinbach committed Aug 8, 2019
1 parent a99b388 commit faa5827d059f78caf8868065cd3d3991f27b6029
Showing with 46 additions and 2 deletions.
  1. +2 −0 CMakeLists.txt
  2. +6 −1 setup.py
  3. +26 −0 src/CMakeLists.txt
  4. +12 −1 src/deps/CMakeLists.txt
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 2.8.12)

project(OPENTIMELINEIO_ROOT)

add_subdirectory(src)
@@ -1,6 +1,10 @@
#! /usr/bin/env python

"""Test of C++/pybind + cmake
"""Setup.py for installing OpenTimelineIO
For more information:
- see README.md
- http://opentimeline.io
"""

import os
@@ -268,6 +272,7 @@ def build(self):
)
)


# Metadata that gets stamped into the __init__ files during the build phase.
PROJECT_METADATA = {
"version": "0.12.0.dev1",
@@ -4,6 +4,32 @@ set(PYBIND11_CPP_STANDARD -std=c++11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-deprecated-register")

# make sure that git submodules are up to date when building
find_package(Git QUIET)
# XXX this is broken for travis builds
if (GIT_FOUND AND NOT DEFINED ENV{TRAVIS})
# you might want to turn this off if you're working in one of the submodules
# or trying it out with a different version of the submodule
option(GIT_UPDATE_SUBMODULES "Update submodules each build" ON)
if (GIT_UPDATE_SUBMODULES)
message(
STATUS "Updating git submodules to make sure they are up to date"
)
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE GIT_UPDATE_SUBMODULES_RESULT
)
if (NOT GIT_UPDATE_SUBMODULES_RESULT EQUAL "0")
message(
FATAL_ERROR
"git submodule update --init --recursive failed with \
${GIT_UPDATE_SUBMODULES_RESULT}"
)
endif()
endif()
endif()

option(CXX_COVERAGE "CXX_COVERAGE" OFF)
if(CXX_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
@@ -5,4 +5,15 @@ if (NOT OTIO_CXX_NOINSTALL)
DESTINATION include/opentimelineio/deps/nonstd)
endif (NOT OTIO_CXX_NOINSTALL)


# detect if the submodules haven't been updated
set(DEPS_SUBMODULES any optional-lite pybind11 rapidjson)
foreach (submodule IN LISTS DEPS_SUBMODULES)
file(GLOB SUBMOD_CONTENTS ${submodule})
list(LENGTH SUBMOD_CONTENTS SUBMOD_CONTENT_LEN)
if (SUBMOD_CONTENT_LEN EQUAL 0)
message(
FATAL_ERROR "Error: the submodule ${submodule} is empty. You may \
need to install git and run: 'git submodule update' to remedy this."
)
endif()
endforeach()

0 comments on commit faa5827

Please sign in to comment.
You can’t perform that action at this time.