Skip to content

Commit 639f57c

Browse files
Add version header. (#1907)
* Add version header. Signed-off-by: Peter Targett <[email protected]> * Make OTIO_VERSION a string. Signed-off-by: Peter Targett <[email protected]> * Uae existing version.h headers to add the project version. Signed-off-by: Peter Targett <[email protected]> * Put back variable to define patch value. Fix python builds. Signed-off-by: Peter Targett <[email protected]> * Fix typo raising error. Signed-off-by: Peter Targett <[email protected]> * Second error/typo. Signed-off-by: Peter Targett <[email protected]> --------- Signed-off-by: Peter Targett <[email protected]>
1 parent 5abbdaf commit 639f57c

File tree

13 files changed

+80
-37
lines changed

13 files changed

+80
-37
lines changed

src/opentime/CMakeLists.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ set(OPENTIME_HEADER_FILES
66
rationalTime.h
77
stringPrintf.h
88
timeRange.h
9-
timeTransform.h
10-
version.h)
9+
timeTransform.h)
1110

1211
add_library(opentime ${OTIO_SHARED_OR_STATIC_LIB}
1312
errorStatus.cpp
@@ -16,7 +15,12 @@ add_library(opentime ${OTIO_SHARED_OR_STATIC_LIB}
1615

1716
add_library(OTIO::opentime ALIAS opentime)
1817

19-
target_include_directories(opentime PRIVATE "${PROJECT_SOURCE_DIR}/src")
18+
target_include_directories(
19+
opentime
20+
PRIVATE
21+
"${PROJECT_SOURCE_DIR}/src"
22+
"${CMAKE_CURRENT_BINARY_DIR}/.."
23+
)
2024

2125
set_target_properties(opentime PROPERTIES
2226
DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}"
@@ -43,6 +47,11 @@ target_compile_options(opentime PRIVATE
4347
$<$<CXX_COMPILER_ID:MSVC>: /EHsc>
4448
)
4549

50+
configure_file(
51+
${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
52+
${CMAKE_CURRENT_BINARY_DIR}/version.h
53+
)
54+
4655
if(OTIO_CXX_INSTALL)
4756
install(FILES ${OPENTIME_HEADER_FILES}
4857
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime")
@@ -74,5 +83,12 @@ if(OTIO_CXX_INSTALL)
7483
DESTINATION
7584
${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentime
7685
)
86+
87+
install(
88+
FILES
89+
${CMAKE_CURRENT_BINARY_DIR}/version.h
90+
DESTINATION
91+
"${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime"
92+
)
7793
endif()
7894

src/opentime/version.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/opentime/version.h.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright Contributors to the OpenTimelineIO project
3+
4+
#pragma once
5+
6+
#define OPENTIME_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
7+
#define OPENTIME_VERSION_MINOR @PROJECT_VERSION_MINOR@
8+
#define OPENTIME_VERSION_PATCH @PROJECT_VERSION_PATCH@
9+
#define OPENTIME_VERSION v@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@_@PROJECT_VERSION_PATCH@
10+
11+
namespace opentime {
12+
namespace OPENTIME_VERSION {
13+
}
14+
15+
using namespace OPENTIME_VERSION;
16+
} // namespace opentime

src/opentimelineio/CMakeLists.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ set(OPENTIMELINEIO_HEADER_FILES
3636
transition.h
3737
typeRegistry.h
3838
unknownSchema.h
39-
vectorIndexing.h
40-
version.h)
39+
vectorIndexing.h)
4140

4241
add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB}
4342
color.cpp
@@ -79,8 +78,12 @@ add_library(opentimelineio ${OTIO_SHARED_OR_STATIC_LIB}
7978

8079
add_library(OTIO::opentimelineio ALIAS opentimelineio)
8180

82-
target_include_directories(opentimelineio
83-
PRIVATE "${PROJECT_SOURCE_DIR}/src")
81+
target_include_directories(
82+
opentimelineio
83+
PRIVATE
84+
"${PROJECT_SOURCE_DIR}/src"
85+
"${CMAKE_CURRENT_BINARY_DIR}/.."
86+
)
8487

8588
if(OTIO_FIND_RAPIDJSON)
8689
target_include_directories(opentimelineio
@@ -120,6 +123,11 @@ target_compile_options(opentimelineio PRIVATE
120123
$<$<CXX_COMPILER_ID:MSVC>: /EHsc>
121124
)
122125

126+
configure_file(
127+
${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
128+
${CMAKE_CURRENT_BINARY_DIR}/version.h
129+
)
130+
123131
if(OTIO_CXX_INSTALL)
124132
install(FILES ${OPENTIMELINEIO_HEADER_FILES}
125133
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentimelineio")
@@ -153,4 +161,11 @@ if(OTIO_CXX_INSTALL)
153161
DESTINATION
154162
${OTIO_RESOLVED_CXX_INSTALL_DIR}/share/opentimelineio
155163
)
164+
165+
install(
166+
FILES
167+
${CMAKE_CURRENT_BINARY_DIR}/version.h
168+
DESTINATION
169+
"${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentimelineio"
170+
)
156171
endif()

src/opentimelineio/version.h renamed to src/opentimelineio/version.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
#pragma once
55

6-
#define OPENTIMELINEIO_VERSION v1_0
6+
#define OPENTIMELINEIO_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
7+
#define OPENTIMELINEIO_VERSION_MINOR @PROJECT_VERSION_MINOR@
8+
#define OPENTIMELINEIO_VERSION_PATCH @PROJECT_VERSION_PATCH@
9+
#define OPENTIMELINEIO_VERSION v@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@_@PROJECT_VERSION_PATCH@
710

811
#include "opentime/rationalTime.h"
912
#include "opentime/timeRange.h"

src/py-opentimelineio/opentime-bindings/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ target_include_directories(_opentime
1212
PRIVATE pybind11/include
1313
PRIVATE "${PROJECT_SOURCE_DIR}/src"
1414
PRIVATE "${PROJECT_SOURCE_DIR}/src/deps"
15-
PRIVATE "${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include")
15+
PRIVATE "${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include"
16+
PRIVATE "${CMAKE_BINARY_DIR}/src"
17+
)
1618

1719
target_link_libraries(_opentime PUBLIC opentimelineio opentime)
1820

src/py-opentimelineio/opentimelineio-bindings/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ target_include_directories(_otio
2323
PRIVATE "${PROJECT_SOURCE_DIR}/src"
2424
PRIVATE "${PROJECT_SOURCE_DIR}/src/deps"
2525
PRIVATE "${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include"
26+
PRIVATE "${CMAKE_BINARY_DIR}/src"
2627
)
2728

2829
target_link_libraries(_otio PUBLIC opentimelineio opentime)

src/py-opentimelineio/opentimelineio/adapters/otioz.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def read_from_file(
4848

4949
if not os.path.exists(extract_to_directory):
5050
raise exceptions.OTIOError(
51-
f"Directory '{extract_to_directory()}' does not exist, cannot"
52-
" unpack otioz there."
51+
f"Directory '{extract_to_directory}' does not exist, cannot"
52+
f" unpack otioz there."
5353
)
5454

5555
if os.path.exists(output_media_directory):

tests/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
include_directories(${PROJECT_SOURCE_DIR}/src
1+
include_directories(
2+
${PROJECT_SOURCE_DIR}/src
23
${PROJECT_SOURCE_DIR}/src/deps
34
${PROJECT_SOURCE_DIR}/src/deps/optional-lite/include
4-
${PROJECT_SOURCE_DIR}/src/tests)
5+
${PROJECT_SOURCE_DIR}/src/tests
6+
${CMAKE_BINARY_DIR}/src
7+
)
58

69
list(APPEND tests_opentime test_opentime)
710
foreach(test ${tests_opentime})

tests/test_composition.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ main(int argc, char** argv)
2828
SerializableObject::Retainer<Item> item = new Item;
2929

3030
comp->append_child(item);
31-
opentimelineio::v1_0::ErrorStatus err;
31+
OTIO_NS::ErrorStatus err;
3232
auto result = comp->find_children<>(&err);
3333
assertEqual(result.size(), 1);
3434
assertEqual(result[0].value, item.value);
@@ -47,7 +47,7 @@ main(int argc, char** argv)
4747
track->append_child(transition);
4848
track->append_child(clip);
4949

50-
opentimelineio::v1_0::ErrorStatus err;
50+
OTIO_NS::ErrorStatus err;
5151
auto items = stack->find_clips(&err);
5252
assertFalse(is_error(err));
5353
assertEqual(items.size(), 1);

0 commit comments

Comments
 (0)