diff --git a/src/opentime/CMakeLists.txt b/src/opentime/CMakeLists.txt index a973d03faa..e86d41119e 100644 --- a/src/opentime/CMakeLists.txt +++ b/src/opentime/CMakeLists.txt @@ -6,8 +6,7 @@ set(OPENTIME_HEADER_FILES rationalTime.h stringPrintf.h timeRange.h - timeTransform.h - version.h) + timeTransform.h) add_library(opentime ${OTIO_SHARED_OR_STATIC_LIB} errorStatus.cpp @@ -16,7 +15,12 @@ add_library(opentime ${OTIO_SHARED_OR_STATIC_LIB} add_library(OTIO::opentime ALIAS opentime) -target_include_directories(opentime PRIVATE "${PROJECT_SOURCE_DIR}/src") +target_include_directories( + opentime + PRIVATE + "${PROJECT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_BINARY_DIR}/.." +) set_target_properties(opentime PROPERTIES DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}" @@ -43,6 +47,11 @@ 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") @@ -74,5 +83,12 @@ 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 deleted file mode 100644 index 58a822a04e..0000000000 --- a/src/opentime/version.h +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Contributors to the OpenTimelineIO project - -#pragma once - -#define OPENTIME_VERSION v1_0 - -namespace opentime { -namespace OPENTIME_VERSION { -} - -using namespace OPENTIME_VERSION; -} // namespace opentime diff --git a/src/opentime/version.h.in b/src/opentime/version.h.in new file mode 100644 index 0000000000..c1265faf4a --- /dev/null +++ b/src/opentime/version.h.in @@ -0,0 +1,16 @@ +// 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@ + +namespace opentime { +namespace OPENTIME_VERSION { +} + +using namespace OPENTIME_VERSION; +} // namespace opentime diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt index f5258b0569..9c859e3bdf 100644 --- a/src/opentimelineio/CMakeLists.txt +++ b/src/opentimelineio/CMakeLists.txt @@ -36,8 +36,7 @@ set(OPENTIMELINEIO_HEADER_FILES transition.h typeRegistry.h unknownSchema.h - vectorIndexing.h - version.h) + vectorIndexing.h) add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB} color.cpp @@ -79,8 +78,12 @@ add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB} add_library(OTIO::opentimelineio ALIAS opentimelineio) -target_include_directories(opentimelineio - PRIVATE "${PROJECT_SOURCE_DIR}/src") +target_include_directories( + opentimelineio + PRIVATE + "${PROJECT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_BINARY_DIR}/.." +) if(OTIO_FIND_RAPIDJSON) target_include_directories(opentimelineio @@ -120,6 +123,11 @@ 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") @@ -153,4 +161,11 @@ 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 b/src/opentimelineio/version.h.in similarity index 71% rename from src/opentimelineio/version.h rename to src/opentimelineio/version.h.in index ba26e76128..cb69297e22 100644 --- a/src/opentimelineio/version.h +++ b/src/opentimelineio/version.h.in @@ -3,7 +3,10 @@ #pragma once -#define OPENTIMELINEIO_VERSION v1_0 +#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@ #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 bd92bbfa0f..a42f35f656 100644 --- a/src/py-opentimelineio/opentime-bindings/CMakeLists.txt +++ b/src/py-opentimelineio/opentime-bindings/CMakeLists.txt @@ -12,7 +12,9 @@ target_include_directories(_opentime PRIVATE pybind11/include PRIVATE "${PROJECT_SOURCE_DIR}/src" PRIVATE "${PROJECT_SOURCE_DIR}/src/deps" - PRIVATE "${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include") + 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 d37da3629f..1114f96c45 100644 --- a/src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt +++ b/src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt @@ -23,6 +23,7 @@ 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/src/py-opentimelineio/opentimelineio/adapters/otioz.py b/src/py-opentimelineio/opentimelineio/adapters/otioz.py index 4ccba931c7..0fae0a2946 100644 --- a/src/py-opentimelineio/opentimelineio/adapters/otioz.py +++ b/src/py-opentimelineio/opentimelineio/adapters/otioz.py @@ -48,8 +48,8 @@ def read_from_file( if not os.path.exists(extract_to_directory): raise exceptions.OTIOError( - f"Directory '{extract_to_directory()}' does not exist, cannot" - " unpack otioz there." + f"Directory '{extract_to_directory}' does not exist, cannot" + f" unpack otioz there." ) if os.path.exists(output_media_directory): diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e5eb0b4925..fcababd381 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,10 @@ -include_directories(${PROJECT_SOURCE_DIR}/src +include_directories( + ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src/deps ${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include - ${PROJECT_SOURCE_DIR}/src/tests) + ${PROJECT_SOURCE_DIR}/src/tests + ${CMAKE_BINARY_DIR}/src +) list(APPEND tests_opentime test_opentime) foreach(test ${tests_opentime}) diff --git a/tests/test_composition.cpp b/tests/test_composition.cpp index 65471c4790..7c6562b8ec 100644 --- a/tests/test_composition.cpp +++ b/tests/test_composition.cpp @@ -28,7 +28,7 @@ main(int argc, char** argv) SerializableObject::Retainer item = new Item; comp->append_child(item); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = comp->find_children<>(&err); assertEqual(result.size(), 1); assertEqual(result[0].value, item.value); @@ -47,7 +47,7 @@ main(int argc, char** argv) track->append_child(transition); track->append_child(clip); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto items = stack->find_clips(&err); assertFalse(is_error(err)); assertEqual(items.size(), 1); diff --git a/tests/test_serializableCollection.cpp b/tests/test_serializableCollection.cpp index 0593ef8b60..b4ad9ff739 100644 --- a/tests/test_serializableCollection.cpp +++ b/tests/test_serializableCollection.cpp @@ -32,7 +32,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer sc = new otio::SerializableCollection(); sc->insert_child(0, tl); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = sc->find_children(&err, {}, false); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); @@ -61,7 +61,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer sc = new otio::SerializableCollection(); sc->insert_child(0, tl); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = sc->find_children(&err, range); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value); @@ -80,7 +80,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer sc = new otio::SerializableCollection(); sc->insert_child(0, tl); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = sc->find_children(&err, std::nullopt, true); assertEqual(result.size(), 0); result = sc->find_children(&err, std::nullopt, false); diff --git a/tests/test_timeline.cpp b/tests/test_timeline.cpp index bc63feafd8..8887c58892 100644 --- a/tests/test_timeline.cpp +++ b/tests/test_timeline.cpp @@ -28,7 +28,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer tl = new otio::Timeline(); tl->tracks()->append_child(tr); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = tl->find_children(&err); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); @@ -54,7 +54,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer tl = new otio::Timeline(); tl->tracks()->append_child(tr); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = tl->find_children(&err, range); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value); @@ -70,7 +70,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer tl = new otio::Timeline(); tl->tracks()->append_child(tr); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = tl->find_children(&err, std::nullopt, true); assertEqual(result.size(), 0); result = tl->find_children(&err, std::nullopt, false); diff --git a/tests/test_track.cpp b/tests/test_track.cpp index 00e3c7e147..d58e67901e 100644 --- a/tests/test_track.cpp +++ b/tests/test_track.cpp @@ -25,7 +25,7 @@ main(int argc, char** argv) otio::SerializableObject::Retainer tr = new otio::Track(); tr->append_child(cl); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = tr->find_children(&err); assertEqual(result.size(), 1); assertEqual(result[0].value, cl.value); @@ -48,7 +48,7 @@ main(int argc, char** argv) tr->append_child(cl0); tr->append_child(cl1); tr->append_child(cl2); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = tr->find_children( &err, TimeRange(RationalTime(0.0, 24.0), RationalTime(24.0, 24.0))); @@ -98,7 +98,7 @@ main(int argc, char** argv) new otio::Track(); tr->append_child(cl0); tr->append_child(st); - opentimelineio::v1_0::ErrorStatus err; + OTIO_NS::ErrorStatus err; auto result = tr->find_children(&err, std::nullopt, true); assertEqual(result.size(), 1); assertEqual(result[0].value, cl0.value);