diff --git a/CMakeLists.txt b/CMakeLists.txt index cc9981054..828ef238e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,13 @@ cmake_minimum_required(VERSION 3.18.2) # Project Metadata # TODO: read this information from a configuration file, here, and in setup.py -set(OTIO_VERSION_MAJOR "0") -set(OTIO_VERSION_MINOR "19") -set(OTIO_VERSION_PATCH "0") +file(READ "src/opentimelineio/version.h" VERSION_H) +string(REGEX MATCH "VERSION_MAJOR ([0-9]*)" _ ${VERSION_H}) +set(OTIO_VERSION_MAJOR ${CMAKE_MATCH_1}) +string(REGEX MATCH "VERSION_MINOR ([0-9]*)" _ ${VERSION_H}) +set(OTIO_VERSION_MINOR ${CMAKE_MATCH_1}) +string(REGEX MATCH "VERSION_PATCH ([0-9]*)" _ ${VERSION_H}) +set(OTIO_VERSION_PATCH ${CMAKE_MATCH_1}) set(OTIO_VERSION ${OTIO_VERSION_MAJOR}.${OTIO_VERSION_MINOR}.${OTIO_VERSION_PATCH}) set(OTIO_AUTHOR "Contributors to the OpenTimelineIO project") diff --git a/src/opentime/CMakeLists.txt b/src/opentime/CMakeLists.txt index 0c132d6a0..47e50b40f 100644 --- a/src/opentime/CMakeLists.txt +++ b/src/opentime/CMakeLists.txt @@ -7,7 +7,8 @@ set(OPENTIME_HEADER_FILES rationalTime.h stringPrintf.h timeRange.h - timeTransform.h) + timeTransform.h + version.h) add_library(opentime ${OTIO_SHARED_OR_STATIC_LIB} errorStatus.cpp @@ -16,12 +17,7 @@ add_library(opentime ${OTIO_SHARED_OR_STATIC_LIB} add_library(OTIO::opentime ALIAS opentime) -target_include_directories( - opentime - PRIVATE - "${PROJECT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_BINARY_DIR}/.." -) +target_include_directories(opentime PRIVATE "${PROJECT_SOURCE_DIR}/src") set_target_properties(opentime PROPERTIES DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}" @@ -56,11 +52,6 @@ target_compile_options(opentime PRIVATE $<$: /EHsc> ) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/version.h -) - if(OTIO_CXX_INSTALL) install(FILES ${OPENTIME_HEADER_FILES} DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime") @@ -98,12 +89,5 @@ if(OTIO_CXX_INSTALL) DESTINATION ${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentime ) - - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/version.h - DESTINATION - "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime" - ) endif() diff --git a/src/opentime/version.h b/src/opentime/version.h new file mode 100644 index 000000000..49a26a3f5 --- /dev/null +++ b/src/opentime/version.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Contributors to the OpenTimelineIO project + +#pragma once + +#define OPENTIME_VERSION_MAJOR 0 +#define OPENTIME_VERSION_MINOR 19 +#define OPENTIME_VERSION_PATCH 0 +#define OPENTIME_VERSION v0_19_0 +#define OPENTIME_VERSION_NS v0_19 + +namespace opentime { +namespace OPENTIME_VERSION_NS { +} + +using namespace OPENTIME_VERSION_NS; +} // namespace opentime diff --git a/src/opentime/version.h.in b/src/opentime/version.h.in deleted file mode 100644 index cd8761cc5..000000000 --- a/src/opentime/version.h.in +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Contributors to the OpenTimelineIO project - -#pragma once - -#define OPENTIME_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ -#define OPENTIME_VERSION_MINOR @PROJECT_VERSION_MINOR@ -#define OPENTIME_VERSION_PATCH @PROJECT_VERSION_PATCH@ -#define OPENTIME_VERSION v@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@_@PROJECT_VERSION_PATCH@ -#define OPENTIME_VERSION_NS v@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@ - -namespace opentime { -namespace OPENTIME_VERSION_NS { -} - -using namespace OPENTIME_VERSION_NS; -} // namespace opentime diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt index 29dd95074..86759ca27 100644 --- a/src/opentimelineio/CMakeLists.txt +++ b/src/opentimelineio/CMakeLists.txt @@ -37,7 +37,8 @@ set(OPENTIMELINEIO_HEADER_FILES transition.h typeRegistry.h unknownSchema.h - vectorIndexing.h) + vectorIndexing.h + version.h) add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB} color.cpp @@ -79,12 +80,7 @@ add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB} add_library(OTIO::opentimelineio ALIAS opentimelineio) -target_include_directories( - opentimelineio - PRIVATE - "${PROJECT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_BINARY_DIR}/.." -) +target_include_directories(opentimelineio PRIVATE "${PROJECT_SOURCE_DIR}/src") if(OTIO_FIND_RAPIDJSON) target_include_directories(opentimelineio @@ -132,11 +128,6 @@ target_compile_options(opentimelineio PRIVATE $<$: /EHsc> ) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/version.h -) - if(OTIO_CXX_INSTALL) install(FILES ${OPENTIMELINEIO_HEADER_FILES} DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentimelineio") @@ -176,11 +167,4 @@ if(OTIO_CXX_INSTALL) DESTINATION ${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentimelineio ) - - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/version.h - DESTINATION - "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentimelineio" - ) endif() diff --git a/src/opentimelineio/version.h.in b/src/opentimelineio/version.h similarity index 66% rename from src/opentimelineio/version.h.in rename to src/opentimelineio/version.h index 27b07dcae..b282330c2 100644 --- a/src/opentimelineio/version.h.in +++ b/src/opentimelineio/version.h @@ -3,11 +3,11 @@ #pragma once -#define OPENTIMELINEIO_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ -#define OPENTIMELINEIO_VERSION_MINOR @PROJECT_VERSION_MINOR@ -#define OPENTIMELINEIO_VERSION_PATCH @PROJECT_VERSION_PATCH@ -#define OPENTIMELINEIO_VERSION v@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@_@PROJECT_VERSION_PATCH@ -#define OPENTIMELINEIO_VERSION_NS v@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@ +#define OPENTIMELINEIO_VERSION_MAJOR 0 +#define OPENTIMELINEIO_VERSION_MINOR 19 +#define OPENTIMELINEIO_VERSION_PATCH 0 +#define OPENTIMELINEIO_VERSION v0_19_0 +#define OPENTIMELINEIO_VERSION_NS v0_19 #include "opentime/rationalTime.h" #include "opentime/timeRange.h" diff --git a/src/py-opentimelineio/opentime-bindings/CMakeLists.txt b/src/py-opentimelineio/opentime-bindings/CMakeLists.txt index a42f35f65..ab62c3ed4 100644 --- a/src/py-opentimelineio/opentime-bindings/CMakeLists.txt +++ b/src/py-opentimelineio/opentime-bindings/CMakeLists.txt @@ -13,7 +13,6 @@ target_include_directories(_opentime PRIVATE "${PROJECT_SOURCE_DIR}/src" PRIVATE "${PROJECT_SOURCE_DIR}/src/deps" PRIVATE "${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include" - PRIVATE "${CMAKE_BINARY_DIR}/src" ) target_link_libraries(_opentime PUBLIC opentimelineio opentime) diff --git a/src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt b/src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt index 1114f96c4..d37da3629 100644 --- a/src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt +++ b/src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt @@ -23,7 +23,6 @@ target_include_directories(_otio PRIVATE "${PROJECT_SOURCE_DIR}/src" PRIVATE "${PROJECT_SOURCE_DIR}/src/deps" PRIVATE "${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include" - PRIVATE "${CMAKE_BINARY_DIR}/src" ) target_link_libraries(_otio PUBLIC opentimelineio opentime) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fcababd38..afef11a47 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,7 +3,6 @@ include_directories( ${PROJECT_SOURCE_DIR}/src/deps ${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include ${PROJECT_SOURCE_DIR}/src/tests - ${CMAKE_BINARY_DIR}/src ) list(APPEND tests_opentime test_opentime)