@@ -7,17 +7,20 @@ project( "libaaf"
7
7
HOMEPAGE_URL "https://github.com/agfline/LibAAF" )
8
8
9
9
option ( BUILD_STATIC_LIB "Build the static library" OFF )
10
- option ( BUILD_SHARED_LIB "Build the shared library" ON )
11
- option ( BUILD_TOOLS "Build AAFInfo and AAFExtract programs" ON )
10
+ option ( BUILD_SHARED_LIB "Build the shared library" ON )
11
+ option ( BUILD_TOOLS "Build aaftool" ON )
12
12
option ( XBUILD_WIN "Cross compile libaaf on Linux for Windows" OFF )
13
+ option ( BUILD_DOC "Build documentation" ON )
14
+ option ( BUILD_UNIT_TEST "Build unit test programs" ON )
13
15
14
16
set ( LIBAAF_VERSION "GIT" CACHE STRING "Set version manualy, git version used otherwise" )
15
17
set ( LIBAAF_LIB_OUTPUT_NAME "aaf" )
16
18
17
- set ( LIBAAF_LIB_SRC_PATH ${PROJECT_SOURCE_DIR} /src )
18
- set ( LIBAAF_TOOLS_SRC_PATH ${PROJECT_SOURCE_DIR} /tools )
19
- set ( LIBAAF_EXAMPLES_SRC_PATH ${PROJECT_SOURCE_DIR} /examples )
20
- set ( LIBAAF_TEST_PATH ${PROJECT_SOURCE_DIR} /test )
19
+ set ( LIBAAF_LIB_SRC_PATH ${PROJECT_SOURCE_DIR} /src )
20
+ set ( LIBAAF_TOOLS_SRC_PATH ${PROJECT_SOURCE_DIR} /tools )
21
+ set ( LIBAAF_DOC_INPUT_PATH ${PROJECT_SOURCE_DIR} /doc )
22
+ set ( LIBAAF_DOC_OUTPUT_PATH ${PROJECT_SOURCE_DIR} /build /doc )
23
+ set ( LIBAAF_TEST_PATH ${PROJECT_SOURCE_DIR} /test )
21
24
22
25
set ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
23
26
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
@@ -29,7 +32,6 @@ endif()
29
32
30
33
31
34
32
-
33
35
function ( laaf_set_version )
34
36
35
37
find_package ( Git )
@@ -70,6 +72,36 @@ endif()
70
72
71
73
message ( "libaaf version: ${LIBAAF_VERSION} " )
72
74
75
+
76
+ if ( BUILD_DOC )
77
+ find_package (Doxygen)
78
+ if ( DOXYGEN_FOUND )
79
+
80
+ set ( DOXYGEN_PROJECT_NAME ${PROJECT_NAME} )
81
+ set ( DOXYGEN_PROJECT_NUMBER ${LIBAAF_VERSION} )
82
+ set ( DOXYGEN_PROJECT_BRIEF ${PROJECT_BRIEF} )
83
+
84
+ set ( DOXYGEN_USE_MDFILE_AS_MAINPAGE ${PROJECT_SOURCE_DIR} /README.md )
85
+ set ( DOXYGEN_INPUT_DIR "${PROJECT_SOURCE_DIR} /include/ ${PROJECT_SOURCE_DIR} /src/ ${PROJECT_SOURCE_DIR} /README.md" )
86
+ set ( DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} /doxygen )
87
+
88
+ configure_file ( ${LIBAAF_DOC_INPUT_PATH} /doxygen.in ${PROJECT_SOURCE_DIR} /build /doxygen.conf @ONLY )
89
+
90
+ FILE ( MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR} )
91
+
92
+ # note the option ALL which allows to build the docs together with the application
93
+ add_custom_target ( doc
94
+ COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_SOURCE_DIR} /build /doxygen.conf
95
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
96
+ COMMENT "Generating API documentation with Doxygen"
97
+ VERBATIM )
98
+
99
+ else (DOXYGEN_FOUND)
100
+ message ( "Doxygen need to be installed to generate the documentation" )
101
+ endif (DOXYGEN_FOUND)
102
+ endif (BUILD_DOC)
103
+
104
+
73
105
configure_file ( ${PROJECT_SOURCE_DIR} /libaaf.pc.in ${CMAKE_BINARY_DIR} /libaaf.pc @ONLY )
74
106
75
107
@@ -78,12 +110,16 @@ if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
78
110
set ( LIBAAF_COMPILE_OPTIONS
79
111
-W -Wstrict-prototypes -Wmissing-prototypes
80
112
-Wall -Wcast-qual -Wcast-align -Wextra -Wwrite-strings -Wunsafe-loop-optimizations -Wlogical-op -std=c99 -pedantic -Wshadow # = Ardour's Waf --strict --c-strict
81
- # -Wconversion
113
+ -Wsign-conversion
114
+ -Wconversion
82
115
-Wcast-align=strict
83
116
-O3
84
117
-g
118
+ -D_XOPEN_SOURCE=500
119
+ # -pg
85
120
-fdebug-prefix -map=${SRC_PATH} =.
86
121
)
122
+ # set( LIBAAF_LINK_OPTIONS -pg )
87
123
if ( XBUILD_WIN )
88
124
message ( "┌─────────────────────────────┐" )
89
125
message ( "│ Cross compiling for Windows │" )
@@ -113,7 +149,7 @@ elseif ( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
113
149
set ( PROG_SUFFIX ".exe" )
114
150
endif ()
115
151
116
- # TODO: not required when compiling on linux but "missing header" when x-compiling
152
+ # TODO: not required with gcc but "missing header" whith mingw-w64
117
153
include_directories ( ${PROJECT_SOURCE_DIR} /include )
118
154
119
155
@@ -133,20 +169,23 @@ set( LIBAAF_LIB_SOURCES
133
169
134
170
${LIBAAF_LIB_SRC_PATH} /AAFIface/AAFIface.c
135
171
${LIBAAF_LIB_SRC_PATH} /AAFIface/AAFIParser.c
136
- ${LIBAAF_LIB_SRC_PATH} /AAFIface/AAFIAudioFiles .c
172
+ ${LIBAAF_LIB_SRC_PATH} /AAFIface/AAFIEssenceFile .c
137
173
${LIBAAF_LIB_SRC_PATH} /AAFIface/RIFFParser.c
138
174
${LIBAAF_LIB_SRC_PATH} /AAFIface/URIParser.c
139
175
${LIBAAF_LIB_SRC_PATH} /AAFIface/ProTools.c
140
176
${LIBAAF_LIB_SRC_PATH} /AAFIface/Resolve.c
177
+ ${LIBAAF_LIB_SRC_PATH} /AAFIface/MediaComposer.c
141
178
142
179
${LIBAAF_LIB_SRC_PATH} /common/utils.c
143
- ${LIBAAF_LIB_SRC_PATH} /debug.c
180
+ # ${LIBAAF_LIB_SRC_PATH}/common/ConvertUTF.c
181
+ ${LIBAAF_LIB_SRC_PATH} /common/log .c
144
182
)
145
183
146
184
147
185
if ( BUILD_SHARED_LIB )
148
186
add_library ( aaf-shared SHARED ${LIBAAF_LIB_SOURCES} )
149
187
target_compile_options ( aaf-shared PUBLIC ${LIBAAF_COMPILE_OPTIONS} )
188
+ target_link_options ( aaf-shared PUBLIC ${LIBAAF_LINK_OPTIONS} )
150
189
target_include_directories ( aaf-shared PUBLIC "${CMAKE_BINARY_DIR} /include/" )
151
190
set_target_properties ( aaf-shared PROPERTIES
152
191
OUTPUT_NAME ${LIBAAF_LIB_OUTPUT_NAME}
@@ -160,6 +199,7 @@ endif( BUILD_SHARED_LIB )
160
199
if ( BUILD_STATIC_LIB )
161
200
add_library ( aaf-static STATIC ${LIBAAF_LIB_SOURCES} )
162
201
target_compile_options ( aaf-static PUBLIC ${LIBAAF_COMPILE_OPTIONS} )
202
+ target_link_options ( aaf-static PUBLIC ${LIBAAF_LINK_OPTIONS} )
163
203
target_include_directories ( aaf-static PUBLIC "${CMAKE_BINARY_DIR} /include/" )
164
204
set_target_properties ( aaf-static PROPERTIES
165
205
OUTPUT_NAME ${LIBAAF_LIB_OUTPUT_NAME}
@@ -179,9 +219,9 @@ endif( BUILD_STATIC_LIB )
179
219
if ( BUILD_TOOLS )
180
220
181
221
if ( ${LINK_LIB} MATCHES "aaf-static" )
182
- message ( "Building AAFIface and AAFExtract upon static library" )
222
+ message ( "Building aaftool upon static library" )
183
223
elseif ( ${LINK_LIB} MATCHES "aaf-shared" )
184
- message ( "Building AAFIface and AAFExtract upon shared library" )
224
+ message ( "Building aaftool upon shared library" )
185
225
endif ()
186
226
187
227
if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
@@ -190,29 +230,45 @@ if ( BUILD_TOOLS )
190
230
link_libraries ( ${LINK_LIB} )
191
231
endif ()
192
232
193
- add_executable ( AAFInfo
194
- ${LIBAAF_TOOLS_SRC_PATH} /AAFInfo.c
195
- ${LIBAAF_TOOLS_SRC_PATH} /common.c
233
+ add_executable ( aaftool
234
+ ${LIBAAF_TOOLS_SRC_PATH} /AAFTool.c
196
235
${LIBAAF_TOOLS_SRC_PATH} /thirdparty/libTC.c
197
236
)
198
237
199
- add_executable ( AAFExtract
200
- ${LIBAAF_TOOLS_SRC_PATH} /AAFExtract.c
201
- ${LIBAAF_TOOLS_SRC_PATH} /common.c
202
- )
203
238
204
- target_include_directories ( AAFInfo PRIVATE "${CMAKE_BINARY_DIR} /include/" )
205
- target_include_directories ( AAFExtract PRIVATE "${CMAKE_BINARY_DIR} /include/" )
239
+ set_target_properties ( aaftool PROPERTIES SUFFIX "${PROG_SUFFIX} " )
206
240
207
- set_target_properties ( AAFInfo PROPERTIES SUFFIX "${PROG_SUFFIX} " )
208
- set_target_properties ( AAFExtract PROPERTIES SUFFIX "${PROG_SUFFIX} " )
209
-
210
- target_compile_options ( AAFInfo PUBLIC ${LIBAAF_COMPILE_OPTIONS} )
211
- target_compile_options ( AAFExtract PUBLIC ${LIBAAF_COMPILE_OPTIONS} )
241
+ target_include_directories ( aaftool PRIVATE "${CMAKE_BINARY_DIR} /include/" )
242
+ target_compile_options ( aaftool PUBLIC ${LIBAAF_COMPILE_OPTIONS} )
243
+ target_link_options ( aaftool PUBLIC ${LIBAAF_LINK_OPTIONS} )
212
244
213
245
endif ( BUILD_TOOLS )
214
246
215
247
248
+ if ( BUILD_UNIT_TEST )
249
+
250
+ if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
251
+ link_libraries ( ${LINK_LIB} "-lm" )
252
+ else ()
253
+ link_libraries ( ${LINK_LIB} )
254
+ endif ()
255
+
256
+ add_executable ( test_utils
257
+ ${LIBAAF_TEST_PATH} /units/test_utils.c )
258
+
259
+ add_executable ( test_libtc
260
+ ${LIBAAF_TEST_PATH} /units/test_libtc.c
261
+ ${LIBAAF_TOOLS_SRC_PATH} /thirdparty/libTC.c )
262
+
263
+ add_executable ( test_uri
264
+ ${LIBAAF_TEST_PATH} /units/test_uri.c )
265
+
266
+ set_target_properties ( test_utils PROPERTIES SUFFIX "${PROG_SUFFIX} " )
267
+ set_target_properties ( test_libtc PROPERTIES SUFFIX "${PROG_SUFFIX} " )
268
+ set_target_properties ( test_uri PROPERTIES SUFFIX "${PROG_SUFFIX} " )
269
+
270
+ endif ( BUILD_UNIT_TEST )
271
+
216
272
217
273
if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
218
274
@@ -226,8 +282,7 @@ if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
226
282
endif ()
227
283
228
284
if ( BUILD_TOOLS )
229
- install ( TARGETS AAFInfo DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} )
230
- install ( TARGETS AAFExtract DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} )
285
+ install ( TARGETS aaftool DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} )
231
286
endif ()
232
287
233
288
install ( DIRECTORY ${PROJECT_SOURCE_DIR} /include / DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*" )
@@ -249,7 +304,6 @@ add_custom_target(
249
304
./src
250
305
./include
251
306
./tools
252
- # ./examples
253
307
# ./test
254
308
COMMAND
255
309
cd "${CMAKE_BINARY_DIR} " &&
@@ -264,5 +318,22 @@ add_custom_target( clean-cmake-files
264
318
COMMAND rm -rf "${CMAKE_BINARY_DIR} /*.cmake" )
265
319
266
320
267
- add_custom_target ( test
268
- COMMAND ${LIBAAF_TEST_PATH} /test .sh --run-from-cmake )
321
+ if ( XBUILD_WIN )
322
+ add_custom_target ( test
323
+ COMMAND wine ${CMAKE_BINARY_DIR} /bin/test_libtc${PROG_SUFFIX}
324
+ COMMAND wine ${CMAKE_BINARY_DIR} /bin/test_uri${PROG_SUFFIX}
325
+ COMMAND wine ${CMAKE_BINARY_DIR} /bin/test_utils${PROG_SUFFIX}
326
+ COMMAND ${LIBAAF_TEST_PATH} /test .py --wine )
327
+ elseif ( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
328
+ add_custom_target ( test
329
+ COMMAND ${CMAKE_BINARY_DIR} /bin/test_libtc${PROG_SUFFIX}
330
+ COMMAND ${CMAKE_BINARY_DIR} /bin/test_uri${PROG_SUFFIX}
331
+ COMMAND ${CMAKE_BINARY_DIR} /bin/test_utils${PROG_SUFFIX}
332
+ COMMAND ${LIBAAF_TEST_PATH} /test .py --run-from-cmake )
333
+ else ()
334
+ add_custom_target ( test
335
+ COMMAND ${CMAKE_BINARY_DIR} /bin/test_libtc
336
+ COMMAND ${CMAKE_BINARY_DIR} /bin/test_uri
337
+ COMMAND ${CMAKE_BINARY_DIR} /bin/test_utils
338
+ COMMAND ${LIBAAF_TEST_PATH} /test .py --run-from-cmake )
339
+ endif ()
0 commit comments