2018-04-06 20:07:21 +00:00
|
|
|
macro ( ADD_FLUID_TEST _test )
|
2018-08-05 15:55:07 +00:00
|
|
|
ADD_EXECUTABLE(${_test} ${_test}.c $<TARGET_OBJECTS:libfluidsynth-OBJ> )
|
2020-01-24 07:57:20 +00:00
|
|
|
|
2018-08-05 19:01:02 +00:00
|
|
|
# only build this unit test when explicitly requested by "make check"
|
|
|
|
set_target_properties(${_test} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
2020-01-24 07:57:20 +00:00
|
|
|
|
2018-08-06 18:18:57 +00:00
|
|
|
# import necessary compile flags and dependency libraries
|
2018-08-07 08:34:58 +00:00
|
|
|
if ( FLUID_CPPFLAGS )
|
|
|
|
set_target_properties ( ${_test} PROPERTIES COMPILE_FLAGS ${FLUID_CPPFLAGS} )
|
|
|
|
endif ( FLUID_CPPFLAGS )
|
2018-08-05 19:01:02 +00:00
|
|
|
TARGET_LINK_LIBRARIES(${_test} $<TARGET_PROPERTY:libfluidsynth,INTERFACE_LINK_LIBRARIES>)
|
2018-04-06 20:07:21 +00:00
|
|
|
|
|
|
|
# use the local include path to look for fluidsynth.h, as we cannot be sure fluidsynth is already installed
|
2018-04-06 20:36:23 +00:00
|
|
|
target_include_directories(${_test}
|
|
|
|
PUBLIC
|
2018-04-06 20:52:54 +00:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> # include auto generated headers
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> # include "normal" public (sub-)headers
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> # include private headers
|
2018-04-07 09:13:30 +00:00
|
|
|
$<TARGET_PROPERTY:libfluidsynth,INCLUDE_DIRECTORIES> # include all other header search paths needed by libfluidsynth (esp. glib)
|
2018-04-06 20:52:54 +00:00
|
|
|
)
|
2018-04-06 20:07:21 +00:00
|
|
|
|
2018-04-20 20:39:56 +00:00
|
|
|
# add the test to ctest
|
2018-04-06 20:07:21 +00:00
|
|
|
ADD_TEST(NAME ${_test} COMMAND ${_test})
|
2020-01-24 07:57:20 +00:00
|
|
|
|
2018-04-20 20:39:56 +00:00
|
|
|
# append the current unit test to check-target as dependency
|
|
|
|
add_dependencies(check ${_test})
|
|
|
|
|
2018-04-06 20:07:21 +00:00
|
|
|
endmacro ( ADD_FLUID_TEST )
|
2020-01-24 07:57:20 +00:00
|
|
|
|
|
|
|
macro ( ADD_FLUID_DEMO _demo )
|
|
|
|
ADD_EXECUTABLE(${_demo} ${_demo}.c )
|
|
|
|
|
|
|
|
# only build this unit test when explicitly requested by "make check"
|
|
|
|
set_target_properties(${_demo} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
|
|
|
|
|
|
# import necessary compile flags and dependency libraries
|
|
|
|
if ( FLUID_CPPFLAGS )
|
|
|
|
set_target_properties ( ${_demo} PROPERTIES COMPILE_FLAGS ${FLUID_CPPFLAGS} )
|
|
|
|
endif ( FLUID_CPPFLAGS )
|
|
|
|
TARGET_LINK_LIBRARIES(${_demo} libfluidsynth)
|
|
|
|
|
|
|
|
# use the local include path to look for fluidsynth.h, as we cannot be sure fluidsynth is already installed
|
|
|
|
target_include_directories(${_demo}
|
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> # include auto generated headers
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> # include "normal" public (sub-)headers
|
|
|
|
$<TARGET_PROPERTY:libfluidsynth,INCLUDE_DIRECTORIES> # include all other header search paths needed by libfluidsynth (esp. glib)
|
|
|
|
)
|
|
|
|
|
|
|
|
# append the current unit test to check-target as dependency
|
|
|
|
add_dependencies(demo ${_demo})
|
|
|
|
|
2020-01-24 12:33:41 +00:00
|
|
|
endmacro ( ADD_FLUID_DEMO )
|