Cmake refresh

Use target objects everywhere, and simplify handling of system vs
local dependencies.
This commit is contained in:
James Turner 2020-08-18 10:31:47 +01:00
parent 995a176654
commit 456c63935c
31 changed files with 283 additions and 415 deletions

View File

@ -2,6 +2,6 @@ if (NOT SYSTEM_EXPAT)
add_subdirectory(expat) add_subdirectory(expat)
endif() endif()
if (ENABLE_DNS AND NOT SYSTEM_UDNS) if (NOT SYSTEM_UDNS)
add_subdirectory(udns) add_subdirectory(udns)
endif() endif()

View File

@ -26,8 +26,24 @@ set(expat_sources
sg_expat_external.h sg_expat_external.h
) )
foreach(s ${expat_sources}) add_library(FGExpat STATIC ${expat_sources})
set_property(GLOBAL
APPEND PROPERTY LOCAL_EXPAT_SOURCES target_include_directories(FGExpat BEFORE PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/${s}") $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
endforeach() $<INSTALL_INTERFACE:include>)
# for the config file above
target_include_directories(FGExpat PRIVATE ${PROJECT_BINARY_DIR}/3rdparty/expat)
target_compile_definitions(FGExpat PUBLIC HAVE_SIMGEAR_EXPAT_CONFIG_H XML_STATIC)
# look like Expat found by find()
add_library(EXPAT::EXPAT ALIAS FGExpat)
# in the non-shared case, we need to export these as well
if (NOT SIMGEAR_SHARED)
install(TARGETS FGExpat
EXPORT SimGearTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -13,7 +13,6 @@ CHECK_SYMBOL_EXISTS(AF_INET6 "netinet/in.h" HAVE_IPv6)
check_include_file(windows.h WINDOWS) check_include_file(windows.h WINDOWS)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
include_directories(${CMAKE_BINARY_DIR})
set(HEADERS set(HEADERS
) )
@ -38,4 +37,21 @@ set(SOURCES
udns_XtoX.c udns_XtoX.c
) )
simgear_component(udns 3rdparty/udns "${SOURCES}" "${HEADERS}") add_library(FGUdns STATIC ${SOURCES})
target_include_directories(FGUdns BEFORE PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_include_directories(FGUdns PRIVATE ${CMAKE_BINARY_DIR})
# match the name of imported UDns
add_librarY(Udns::Udns ALIAS FGUdns)
# in the non-shared case, we need to export these as well
if (NOT SIMGEAR_SHARED)
install(TARGETS FGUdns
EXPORT SimGearTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -60,33 +60,12 @@ if(InSourceBuild)
message(WARNING " mkdir ../sgbuild && cd ../sgbuild && cmake ${CMAKE_SOURCE_DIR}") message(WARNING " mkdir ../sgbuild && cd ../sgbuild && cmake ${CMAKE_SOURCE_DIR}")
endif(InSourceBuild) endif(InSourceBuild)
#packaging
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simulation support libraries for FlightGear and related projects")
SET(CPACK_PACKAGE_VENDOR "The FlightGear project")
SET(CPACK_GENERATOR "TBZ2")
SET(CPACK_INSTALL_CMAKE_PROJECTS ${CMAKE_CURRENT_BINARY_DIR};SimGear;ALL;/)
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${SIMGEAR_VERSION} )
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
message(STATUS "version is ${CPACK_PACKAGE_VERSION_MAJOR} dot ${CPACK_PACKAGE_VERSION_MINOR} dot ${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_GENERATOR TBZ2)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "simgear-${SIMGEAR_VERSION}" CACHE INTERNAL "tarball basename")
set(CPACK_SOURCE_IGNORE_FILES
"^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)
# We have some custom .cmake scripts not in the official distribution. # We have some custom .cmake scripts not in the official distribution.
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
include(Packaging)
# Change the default build type to something fast # Change the default build type to something fast
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING set(CMAKE_BUILD_TYPE Release CACHE STRING
@ -108,8 +87,6 @@ if (NOT MSVC)
option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF) option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF)
option(SYSTEM_EXPAT "Set to ON to build SimGear using the system expat library" OFF) option(SYSTEM_EXPAT "Set to ON to build SimGear using the system expat library" OFF)
option(SYSTEM_UDNS "Set to ON to build SimGear using the system udns library" OFF) option(SYSTEM_UDNS "Set to ON to build SimGear using the system udns library" OFF)
option(ENABLE_ASAN "Set to ON to build SimGear with LLVM AddressSanitizer (ASan) support" OFF)
else() else()
# Building SimGear DLLs is currently not supported for MSVC. # Building SimGear DLLs is currently not supported for MSVC.
set(SIMGEAR_SHARED OFF) set(SIMGEAR_SHARED OFF)
@ -125,10 +102,9 @@ option(ENABLE_TESTS "Set to OFF to disable building SimGear's test applicati
option(ENABLE_SOUND "Set to OFF to disable building SimGear's sound support" ON) option(ENABLE_SOUND "Set to OFF to disable building SimGear's sound support" ON)
option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" ON) option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" ON)
option(ENABLE_PKGUTIL "Set to ON to build the sg_pkgutil application (default)" ON) option(ENABLE_PKGUTIL "Set to ON to build the sg_pkgutil application (default)" ON)
option(ENABLE_DNS "Set to ON to use udns library and DNS service resolver" ON)
option(ENABLE_SIMD "Enable SSE/SSE2 support for compilers" ON) option(ENABLE_SIMD "Enable SSE/SSE2 support for compilers" ON)
option(ENABLE_SIMD_CODE "Enable SSE/SSE2 support code for compilers" OFF) option(ENABLE_SIMD_CODE "Enable SSE/SSE2 support code for compilers" OFF)
option(ENABLE_OPENMP "Enable OpenMP compiler support" OFF) option(ENABLE_ASAN "Set to ON to build SimGear with LLVM AddressSanitizer (ASan) support" OFF)
if (NOT ENABLE_SIMD AND ENABLE_SIMD_CODE) if (NOT ENABLE_SIMD AND ENABLE_SIMD_CODE)
set(ENABLE_SIMD_CODE OFF) set(ENABLE_SIMD_CODE OFF)
@ -210,9 +186,7 @@ if(APPLE)
find_library(COCOA_LIBRARY Cocoa) find_library(COCOA_LIBRARY Cocoa)
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") find_package(Threads REQUIRED)
find_package(Threads REQUIRED)
endif()
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG -DBOOST_NO_AUTO_PTR -DBOOST_NO_CXX98_BINDERS") set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG -DBOOST_NO_AUTO_PTR -DBOOST_NO_CXX98_BINDERS")
@ -270,9 +244,6 @@ if (SYSTEM_EXPAT)
else() else()
message(STATUS "Using built-in expat code") message(STATUS "Using built-in expat code")
set(EXPAT_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/3rdparty/expat
${PROJECT_BINARY_DIR}/3rdparty/expat)
endif(SYSTEM_EXPAT) endif(SYSTEM_EXPAT)
check_include_file(inttypes.h HAVE_INTTYPES_H) check_include_file(inttypes.h HAVE_INTTYPES_H)
@ -280,11 +251,6 @@ check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(windows.h HAVE_WINDOWS_H) check_include_file(windows.h HAVE_WINDOWS_H)
if(HAVE_INTTYPES_H)
# ShivaVG needs inttypes.h
add_definitions(-DHAVE_INTTYPES_H)
endif()
if(ENABLE_RTI) if(ENABLE_RTI)
find_package(PkgConfig) find_package(PkgConfig)
if(PKG_CONFIG_FOUND) if(PKG_CONFIG_FOUND)
@ -302,60 +268,9 @@ endif(ENABLE_RTI)
if(ENABLE_GDAL) if(ENABLE_GDAL)
find_package(GDAL 2.0.0 REQUIRED) find_package(GDAL 2.0.0 REQUIRED)
if (GDAL_FOUND)
include_directories(${GDAL_INCLUDE_DIR})
endif(GDAL_FOUND)
endif(ENABLE_GDAL) endif(ENABLE_GDAL)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) include(CheckPOSIXFeatures)
check_function_exists(rint HAVE_RINT)
check_function_exists(mkdtemp HAVE_MKDTEMP)
check_function_exists(bcopy HAVE_BCOPY)
check_function_exists(mmap HAVE_MMAP)
if (NOT MSVC)
check_function_exists(timegm HAVE_TIMEGM)
if (NOT HAVE_TIMEGM)
message(FATAL_ERROR "Non-Windows platforms must support timegm()")
endif()
endif()
if(HAVE_UNISTD_H)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
check_cxx_source_compiles(
"#include <unistd.h>
#if !defined(_POSIX_TIMERS) || (0 >= _POSIX_TIMERS)
#error clock_gettime is not supported
#endif
int main() { return 0; }
"
HAVE_CLOCK_GETTIME)
endif(HAVE_UNISTD_H)
set(RT_LIBRARY "")
if(HAVE_CLOCK_GETTIME)
check_library_exists(rt clock_gettime "" HAVE_RT)
if(HAVE_RT)
set(RT_LIBRARY rt)
endif(HAVE_RT)
endif(HAVE_CLOCK_GETTIME)
set(DL_LIBRARY "")
check_cxx_source_compiles(
"#include <dlfcn.h>
int main(void) {
return 0;
}
"
HAVE_DLFCN_H)
if(HAVE_DLFCN_H)
check_library_exists(dl dlerror "" HAVE_DL)
if(HAVE_DL)
set(DL_LIBRARY "dl")
endif()
endif()
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually 'd' on windows") SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually 'd' on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
@ -415,8 +330,9 @@ if (CLANG)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
set(SIMD_COMPILER_FLAGS "-msse2 -mfpmath=sse -ftree-vectorize -ftree-slp-vectorize") set(SIMD_COMPILER_FLAGS "-msse2 -mfpmath=sse -ftree-vectorize -ftree-slp-vectorize")
endif()
if (ENABLE_ASAN) if (ENABLE_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
@ -424,20 +340,6 @@ if (CLANG)
# needed for check_cxx_source_compiles # needed for check_cxx_source_compiles
set(CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address") set(CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address")
endif()
endif()
if (ENABLE_OPENMP)
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "OpenMP: ENABLED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
message(STATUS "OpenMP: NOT FOUND")
endif()
else()
message(STATUS "OpenMP: DISABLED")
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@ -496,14 +398,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
include(CheckCXXFeatures) include(CheckCXXFeatures)
# use BEFORE to ensure local directories are used first,
# ahead of system-installed libs
include_directories(BEFORE ${PROJECT_BINARY_DIR}/simgear)
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
include_directories("/usr/X11R6/include")
endif()
add_definitions(-DHAVE_CONFIG_H) add_definitions(-DHAVE_CONFIG_H)
# configure a header file to pass some of the CMake settings # configure a header file to pass some of the CMake settings
@ -513,49 +407,18 @@ configure_file (
"${PROJECT_BINARY_DIR}/simgear/simgear_config.h" "${PROJECT_BINARY_DIR}/simgear/simgear_config.h"
) )
if(ENABLE_TESTS) include (Dart)
# enable CTest / make test target enable_testing()
message(STATUS "Tests: ENABLED") include(AddSimGearTest) # helper to setup a test
include (Dart)
enable_testing()
else()
message(STATUS "Tests: DISABLED")
endif(ENABLE_TESTS)
# always set TEST_LIBS as it is also used by other tools/applications
set(TEST_LIBS_INTERNAL_CORE
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY}
${WINSOCK_LIBRARY}
${SHLWAPI_LIBRARY}
${RT_LIBRARY}
${DL_LIBRARY}
${COCOA_LIBRARY}
${CURL_LIBRARIES}
${GDAL_LIBRARY})
set(TEST_LIBS SimGearCore ${TEST_LIBS_INTERNAL_CORE})
if(NOT SIMGEAR_HEADLESS)
set(TEST_LIBS SimGearScene ${OPENGL_LIBRARIES} ${TEST_LIBS})
endif()
install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/) install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/)
if(ENABLE_DNS) if(SYSTEM_UDNS)
if(SYSTEM_UDNS)
message(STATUS "Requested to use system udns library, forcing SIMGEAR_SHARED to true") message(STATUS "Requested to use system udns library, forcing SIMGEAR_SHARED to true")
set(SIMGEAR_SHARED ON) set(SIMGEAR_SHARED ON)
find_package(Udns REQUIRED) find_package(Udns REQUIRED)
else()
message(STATUS "DNS resolver: ENABLED")
include_directories(3rdparty/udns)
endif()
else()
message(STATUS "DNS resolver: DISABLED")
endif() endif()
add_subdirectory(3rdparty) add_subdirectory(3rdparty)
add_subdirectory(simgear) add_subdirectory(simgear)

View File

@ -0,0 +1,30 @@
function(add_simgear_test _name _sources)
add_executable(${_name} ${_sources})
target_link_libraries(${_name} SimGearCore)
# for simgear_config.h
target_include_directories(${_name} PRIVATE ${PROJECT_BINARY_DIR}/simgear)
endfunction()
function(add_simgear_autotest _name _sources)
add_executable(${_name} ${_sources})
target_link_libraries(${_name} SimGearCore)
# for simgear_config.h
target_include_directories(${_name} PRIVATE ${PROJECT_BINARY_DIR}/simgear)
add_test(${_name} ${EXECUTABLE_OUTPUT_PATH}/${_name})
endfunction()
function(add_simgear_scene_autotest _name _sources)
add_executable(${_name} ${_sources})
target_link_libraries(${_name} SimGearScene)
# for simgear_config.h
target_include_directories(${_name} PRIVATE ${PROJECT_BINARY_DIR}/simgear)
add_test(${_name} ${EXECUTABLE_OUTPUT_PATH}/${_name})
endfunction()

View File

@ -0,0 +1,50 @@
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(rint HAVE_RINT)
check_function_exists(mkdtemp HAVE_MKDTEMP)
check_function_exists(bcopy HAVE_BCOPY)
check_function_exists(mmap HAVE_MMAP)
if (NOT MSVC)
check_function_exists(timegm HAVE_TIMEGM)
if (NOT HAVE_TIMEGM)
message(FATAL_ERROR "Non-Windows platforms must support timegm()")
endif()
endif()
if(HAVE_UNISTD_H)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
check_cxx_source_compiles(
"#include <unistd.h>
#if !defined(_POSIX_TIMERS) || (0 >= _POSIX_TIMERS)
#error clock_gettime is not supported
#endif
int main() { return 0; }
"
HAVE_CLOCK_GETTIME)
endif(HAVE_UNISTD_H)
set(RT_LIBRARY "")
if(HAVE_CLOCK_GETTIME)
check_library_exists(rt clock_gettime "" HAVE_RT)
if(HAVE_RT)
set(RT_LIBRARY rt)
endif(HAVE_RT)
endif(HAVE_CLOCK_GETTIME)
set(DL_LIBRARY "")
check_cxx_source_compiles(
"#include <dlfcn.h>
int main(void) {
return 0;
}
"
HAVE_DLFCN_H)
if(HAVE_DLFCN_H)
check_library_exists(dl dlerror "" HAVE_DL)
if(HAVE_DL)
set(DL_LIBRARY "dl")
endif()
endif()

View File

@ -39,4 +39,19 @@ else ()
# show the UDNS_INCLUDE_DIRS and UDNS_LIBRARIES variables only in the advanced view # show the UDNS_INCLUDE_DIRS and UDNS_LIBRARIES variables only in the advanced view
mark_as_advanced(UDNS_INCLUDE_DIRS UDNS_LIBRARIES) mark_as_advanced(UDNS_INCLUDE_DIRS UDNS_LIBRARIES)
if(UDNS_FOUND)
if(NOT TARGET Udns::Udns)
add_library(Udns::Udns UNKNOWN IMPORTED)
set_target_properties(Udns::Udns PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${UDNS_INCLUDE_DIRS}")
set_target_properties(Udns::Udns PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${UDNS_LIBRARIES}")
endif()
endif()
endif () endif ()

View File

@ -0,0 +1,23 @@
#packaging
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simulation support libraries for FlightGear and related projects")
SET(CPACK_PACKAGE_VENDOR "The FlightGear project")
SET(CPACK_GENERATOR "TBZ2")
SET(CPACK_INSTALL_CMAKE_PROJECTS ${CMAKE_CURRENT_BINARY_DIR};SimGear;ALL;/)
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${SIMGEAR_VERSION} )
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
message(STATUS "version is ${CPACK_PACKAGE_VERSION_MAJOR} dot ${CPACK_PACKAGE_VERSION_MINOR} dot ${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_GENERATOR TBZ2)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "simgear-${SIMGEAR_VERSION}" CACHE INTERNAL "tarball basename")
set(CPACK_SOURCE_IGNORE_FILES
"^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)

View File

@ -48,7 +48,6 @@ install (FILES ${HEADERS} DESTINATION include/simgear/)
get_property(coreSources GLOBAL PROPERTY CORE_SOURCES) get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES) get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS) get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
get_property(localExpatSources GLOBAL PROPERTY LOCAL_EXPAT_SOURCES)
if(SIMGEAR_SHARED) if(SIMGEAR_SHARED)
message(STATUS "Library building mode: SHARED LIBRARIES") message(STATUS "Library building mode: SHARED LIBRARIES")
@ -89,7 +88,7 @@ else()
source_group("${name}\\Headers" FILES ${g2}) source_group("${name}\\Headers" FILES ${g2})
endforeach() endforeach()
add_library(SimGearCore STATIC ${coreSources} ${localExpatSources}) add_library(SimGearCore STATIC ${coreSources})
if(NOT SIMGEAR_HEADLESS) if(NOT SIMGEAR_HEADLESS)
get_property(FG_GROUPS_SCENE_SOURCES_C GLOBAL PROPERTY FG_GROUPS_SCENE_SOURCES_C) get_property(FG_GROUPS_SCENE_SOURCES_C GLOBAL PROPERTY FG_GROUPS_SCENE_SOURCES_C)
@ -111,6 +110,11 @@ else()
endforeach() endforeach()
add_library(SimGearScene STATIC ${sceneSources}) add_library(SimGearScene STATIC ${sceneSources})
if(HAVE_INTTYPES_H)
# ShivaVG needs inttypes.h
target_compile_definitions(SimGearScene PRIVATE HAVE_INTTYPES_H)
endif()
endif(NOT SIMGEAR_HEADLESS) endif(NOT SIMGEAR_HEADLESS)
endif(SIMGEAR_SHARED) endif(SIMGEAR_SHARED)
@ -118,46 +122,17 @@ target_include_directories(SimGearCore BEFORE PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
# so simgear/simgear_config.h is found # for simgear_config.h
target_include_directories(SimGearCore BEFORE PUBLIC target_include_directories(SimGearCore PRIVATE ${PROJECT_BINARY_DIR}/simgear)
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>)
target_include_directories(SimGearCore PUBLIC target_include_directories(SimGearCore PUBLIC
${Boost_INCLUDE_DIRS}) ${Boost_INCLUDE_DIRS})
target_include_directories(SimGearCore PRIVATE
${EXPAT_INCLUDE_DIRS} )
if (NOT SYSTEM_EXPAT) install(TARGETS SimGearCore
# XML_STATIC is important to avoid sg_expat_external.h
# declaring symbols as declspec(import)
target_compile_definitions(SimGearCore PRIVATE HAVE_SIMGEAR_EXPAT_CONFIG_H XML_STATIC)
endif()
install(TARGETS SimGearCore
EXPORT SimGearTargets EXPORT SimGearTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if (NOT SIMGEAR_HEADLESS)
install(TARGETS SimGearScene
EXPORT SimGearTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
target_include_directories(SimGearScene BEFORE PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
target_include_directories(SimGearScene PUBLIC ${OPENSCENEGRAPH_INCLUDE_DIRS})
if (USE_AEONWAVE)
target_include_directories(SimGearScene PRIVATE ${AAX_INCLUDE_DIR} )
else()
target_include_directories(SimGearScene PRIVATE ${OPENAL_INCLUDE_DIR} )
endif()
endif()
# we expose ZLib in some of our headers # we expose ZLib in some of our headers
target_link_libraries(SimGearCore PUBLIC ZLIB::ZLIB) target_link_libraries(SimGearCore PUBLIC ZLIB::ZLIB)
@ -166,22 +141,18 @@ if (ENABLE_RTI)
target_link_libraries(SimGearCore PRIVATE PkgConfig::RTI) target_link_libraries(SimGearCore PRIVATE PkgConfig::RTI)
endif() endif()
# all of these we keep privately
target_link_libraries(SimGearCore PRIVATE target_link_libraries(SimGearCore PRIVATE
${SHLWAPI_LIBRARY}
${RT_LIBRARY} ${RT_LIBRARY}
${DL_LIBRARY} ${DL_LIBRARY}
${CMAKE_THREAD_LIBS_INIT} Threads::Threads
${COCOA_LIBRARY} ${COCOA_LIBRARY}
CURL::libcurl CURL::libcurl
EXPAT::EXPAT
Udns::Udns
${WINSOCK_LIBRARY}) ${WINSOCK_LIBRARY})
if(SYSTEM_EXPAT)
target_link_libraries(SimGearCore PRIVATE ${EXPAT_LIBRARIES})
endif()
if(ENABLE_DNS AND SYSTEM_UDNS)
target_link_libraries(SimGearCore PRIVATE ${UDNS_LIBRARIES})
endif()
if(NOT SIMGEAR_HEADLESS) if(NOT SIMGEAR_HEADLESS)
target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include) target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
@ -197,9 +168,28 @@ if(NOT SIMGEAR_HEADLESS)
${JPEG_LIBRARY}) ${JPEG_LIBRARY})
if(ENABLE_GDAL) if(ENABLE_GDAL)
target_link_libraries(SimGearScene PRIVATE ${GDAL_LIBRARIES}) target_link_libraries(SimGearScene PRIVATE GDAL::GDAL)
endif() endif()
# only actually needed by canvas/KeyboardEvent.cxx # only actually needed by canvas/KeyboardEvent.cxx
target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/utf8/source) target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/utf8/source)
install(TARGETS SimGearScene
EXPORT SimGearTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
target_include_directories(SimGearScene BEFORE PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
# for simgear_config.h
target_include_directories(SimGearScene PRIVATE ${PROJECT_BINARY_DIR}/simgear)
target_include_directories(SimGearScene PUBLIC ${OPENSCENEGRAPH_INCLUDE_DIRS})
if (USE_AEONWAVE)
target_include_directories(SimGearScene PRIVATE ${AAX_INCLUDE_DIR} )
else()
target_include_directories(SimGearScene PRIVATE ${OPENAL_INCLUDE_DIR} )
endif()
endif() endif()

View File

@ -6,11 +6,6 @@ set(SOURCES newbucket.cxx)
simgear_component(bucket bucket "${SOURCES}" "${HEADERS}") simgear_component(bucket bucket "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_simgear_autotest(test_bucket test_bucket.cxx)
add_executable(test_bucket test_bucket.cxx)
add_test(test_bucket ${EXECUTABLE_OUTPUT_PATH}/test_bucket)
target_link_libraries(test_bucket ${TEST_LIBS})
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -46,7 +46,5 @@ set(SOURCES
simgear_component(bvh bvh "${SOURCES}" "${HEADERS}") simgear_component(bvh bvh "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(bvhtest bvhtest.cxx) add_simgear_autotest(bvhtest bvhtest.cxx)
target_link_libraries(bvhtest SimGearCore)
add_test(bvhtest ${EXECUTABLE_OUTPUT_PATH}/bvhtest)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -22,5 +22,5 @@ simgear_scene_component(canvas-elements canvas/elements "${SOURCES}" "${HEADERS}
add_boost_test(canvas_element add_boost_test(canvas_element
SOURCES canvas_element_test.cpp SOURCES canvas_element_test.cpp
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearScene
) )

View File

@ -18,11 +18,10 @@ simgear_scene_component(canvas-events canvas/events "${SOURCES}" "${HEADERS}")
add_boost_test(canvas_event add_boost_test(canvas_event
SOURCES event_test.cpp SOURCES event_test.cpp
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearScene
) )
add_executable(input_event_demo input_event_demo.cxx) add_simgear_test(input_event_demo input_event_demo.cxx)
target_link_libraries(input_event_demo target_link_libraries(input_event_demo
${TEST_LIBS} SimGearScene
${OPENSCENEGRAPH_LIBRARIES}
) )

View File

@ -21,5 +21,5 @@ simgear_scene_component(canvas-layout canvas/layout "${SOURCES}" "${HEADERS}")
add_boost_test(canvas_layout add_boost_test(canvas_layout
SOURCES canvas_layout_test.cxx SOURCES canvas_layout_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearScene
) )

View File

@ -11,8 +11,5 @@ simgear_component(embedded_resources embedded_resources
"${SOURCES}" "${HEADERS}") "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_embedded_resources embedded_resources_test.cxx) add_simgear_autotest(test_embedded_resources embedded_resources_test.cxx)
target_link_libraries(test_embedded_resources ${TEST_LIBS})
add_test(embedded_resources
${EXECUTABLE_OUTPUT_PATH}/test_embedded_resources)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -21,13 +21,8 @@ simgear_component(emesary emesary "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_emesary test_emesary.cxx) add_simgear_autotest(test_emesary test_emesary.cxx)
set_target_properties(test_emesary PROPERTIES set_target_properties(test_emesary PROPERTIES
COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" ) COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" )
target_link_libraries(test_emesary ${TEST_LIBS})
add_test(emesary ${EXECUTABLE_OUTPUT_PATH}/test_emesary)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -7,23 +7,11 @@ set(SOURCES metar.cxx precipitation.cxx)
simgear_scene_component(environment environment "${SOURCES}" "${HEADERS}") simgear_scene_component(environment environment "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_metar test_metar.cxx)
if (SIMGEAR_SHARED) add_simgear_autotest(test_metar test_metar.cxx)
target_link_libraries(test_metar SimGearScene ${GDAL_LIBRARY}) target_link_libraries(test_metar SimGearScene)
else()
target_link_libraries(test_metar
SimGearScene SimGearCore
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY}
${RT_LIBRARY}
${GDAL_LIBRARY})
endif()
add_test(metar ${EXECUTABLE_OUTPUT_PATH}/test_metar) add_simgear_autotest(test_precipitation test_precipitation.cxx)
target_link_libraries(test_precipitation SimGearScene)
add_executable(test_precipitation test_precipitation.cxx)
target_link_libraries(test_precipitation ${TEST_LIBS})
add_test(precipitation ${EXECUTABLE_OUTPUT_PATH}/test_precipitation)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -20,6 +20,7 @@ set(HEADERS
HTTPRequest.hxx HTTPRequest.hxx
HTTPRepository.hxx HTTPRepository.hxx
untar.hxx untar.hxx
DNSClient.hxx
) )
set(SOURCES set(SOURCES
@ -40,55 +41,25 @@ set(SOURCES
HTTPRequest.cxx HTTPRequest.cxx
HTTPRepository.cxx HTTPRepository.cxx
untar.cxx untar.cxx
DNSClient.cxx
) )
if(ENABLE_DNS)
list(APPEND SOURCES DNSClient.cxx)
list(APPEND HEADERS DNSClient.hxx)
endif()
simgear_component(io io "${SOURCES}" "${HEADERS}") simgear_component(io io "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_sock socktest.cxx) add_simgear_test(test_sock socktest.cxx)
target_link_libraries(test_sock ${TEST_LIBS}) add_simgear_autotest(test_http test_HTTP.cxx)
add_simgear_autotest(test_dns test_DNS.cxx)
add_simgear_test(httpget httpget.cxx)
add_simgear_test(http_repo_sync http_repo_sync.cxx)
add_simgear_test(decode_binobj decode_binobj.cxx)
add_simgear_autotest(test_binobj test_binobj.cxx)
add_simgear_autotest(test_repository test_repository.cxx)
add_executable(test_http test_HTTP.cxx)
target_link_libraries(test_http ${TEST_LIBS})
add_test(http ${EXECUTABLE_OUTPUT_PATH}/test_http)
if(ENABLE_DNS)
add_executable(test_dns test_DNS.cxx)
target_link_libraries(test_dns ${TEST_LIBS})
add_test(dns ${EXECUTABLE_OUTPUT_PATH}/test_dns)
endif()
add_executable(httpget httpget.cxx)
target_link_libraries(httpget ${TEST_LIBS})
add_executable(http_repo_sync http_repo_sync.cxx)
target_link_libraries(http_repo_sync ${TEST_LIBS})
add_executable(decode_binobj decode_binobj.cxx)
target_link_libraries(decode_binobj ${TEST_LIBS})
add_executable(test_binobj test_binobj.cxx)
target_link_libraries(test_binobj ${TEST_LIBS})
add_test(binobj ${EXECUTABLE_OUTPUT_PATH}/test_binobj)
add_executable(test_repository test_repository.cxx)
target_link_libraries(test_repository ${TEST_LIBS})
add_test(http_repository ${EXECUTABLE_OUTPUT_PATH}/test_repository)
add_executable(test_untar test_untar.cxx)
add_simgear_autotest(test_untar test_untar.cxx)
set_target_properties(test_untar PROPERTIES set_target_properties(test_untar PROPERTIES
COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" ) COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" )
target_link_libraries(test_untar ${TEST_LIBS})
add_test(untar ${EXECUTABLE_OUTPUT_PATH}/test_untar)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -19,17 +19,7 @@ set(SOURCES
simgear_component(IOStreams io/iostreams "${SOURCES}" "${HEADERS}") simgear_component(IOStreams io/iostreams "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_simgear_autotest(test_streams sgstream_test.cxx )
add_executable(test_streams sgstream_test.cxx ) add_simgear_autotest(test_CharArrayStream CharArrayStream_test.cxx)
target_link_libraries(test_streams ${TEST_LIBS}) add_simgear_autotest(test_zlibstream zlibstream_test.cxx)
add_test(streams ${EXECUTABLE_OUTPUT_PATH}/test_streams)
add_executable(test_CharArrayStream CharArrayStream_test.cxx)
target_link_libraries(test_CharArrayStream ${TEST_LIBS})
add_test(CharArrayStream ${EXECUTABLE_OUTPUT_PATH}/test_CharArrayStream)
add_executable(test_zlibstream zlibstream_test.cxx)
target_link_libraries(test_zlibstream ${TEST_LIBS})
add_test(zlibstream ${EXECUTABLE_OUTPUT_PATH}/test_zlibstream)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -47,16 +47,8 @@ simgear_component(math math "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(sgvec4_test test_sgvec4.cxx) add_simgear_autotest(sgvec4_test test_sgvec4.cxx)
target_link_libraries(sgvec4_test ${TEST_LIBS}) add_simgear_autotest(math_test SGMathTest.cxx)
add_test(sgvec4 ${EXECUTABLE_OUTPUT_PATH}/sgvec4_test) add_simgear_autotest(geometry_test SGGeometryTest.cxx)
add_executable(math_test SGMathTest.cxx)
target_link_libraries(math_test ${TEST_LIBS})
add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test)
add_executable(geometry_test SGGeometryTest.cxx)
target_link_libraries(geometry_test ${TEST_LIBS})
add_test(geometry ${EXECUTABLE_OUTPUT_PATH}/geometry_test)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -50,43 +50,26 @@ simgear_component(misc misc "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_argparse argparse_test.cxx) add_simgear_autotest(test_argparse argparse_test.cxx)
target_link_libraries(test_argparse ${TEST_LIBS}) add_simgear_autotest(test_CSSBorder CSSBorder_test.cxx)
add_test(argparse ${EXECUTABLE_OUTPUT_PATH}/test_argparse) add_simgear_autotest(test_tabbed_values tabbed_values_test.cxx)
add_simgear_autotest(test_strutils strutils_test.cxx)
add_executable(test_CSSBorder CSSBorder_test.cxx) add_simgear_autotest(test_path path_test.cxx )
add_test(CSSBorder ${EXECUTABLE_OUTPUT_PATH}/test_CSSBorder) add_simgear_autotest(test_sg_dir sg_dir_test.cxx)
target_link_libraries(test_CSSBorder ${TEST_LIBS})
add_executable(test_tabbed_values tabbed_values_test.cxx)
add_test(tabbed_values ${EXECUTABLE_OUTPUT_PATH}/test_tabbed_values)
target_link_libraries(test_tabbed_values ${TEST_LIBS})
add_executable(test_strutils strutils_test.cxx)
target_link_libraries(test_strutils ${TEST_LIBS})
add_test(strutils ${EXECUTABLE_OUTPUT_PATH}/test_strutils)
add_executable(test_path path_test.cxx )
add_test(path ${EXECUTABLE_OUTPUT_PATH}/test_path)
target_link_libraries(test_path ${TEST_LIBS})
add_executable(test_sg_dir sg_dir_test.cxx)
target_link_libraries(test_sg_dir ${TEST_LIBS})
add_test(sg_dir ${EXECUTABLE_OUTPUT_PATH}/test_sg_dir)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)
add_boost_test(SimpleMarkdown add_boost_test(SimpleMarkdown
SOURCES SimpleMarkdown_test.cxx SOURCES SimpleMarkdown_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )
add_boost_test(SVGpreserveAspectRatio add_boost_test(SVGpreserveAspectRatio
SOURCES SVGpreserveAspectRatio_test.cxx SOURCES SVGpreserveAspectRatio_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )
add_boost_test(utf8tolatin1 add_boost_test(utf8tolatin1
SOURCES utf8tolatin1_test.cxx SOURCES utf8tolatin1_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )

View File

@ -37,20 +37,20 @@ simgear_component(nasal/cppbind/detail nasal/cppbind/detail "" "${DETAIL_HEADERS
add_boost_test(cppbind_ghost add_boost_test(cppbind_ghost
SOURCES test/cppbind_test_ghost.cxx SOURCES test/cppbind_test_ghost.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )
add_boost_test(cppbind_misc add_boost_test(cppbind_misc
SOURCES test/cppbind_test.cxx SOURCES test/cppbind_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )
add_boost_test(nasal_gc_test add_boost_test(nasal_gc_test
SOURCES test/nasal_gc_test.cxx SOURCES test/nasal_gc_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )
add_boost_test(nasal_num add_boost_test(nasal_num
SOURCES test/nasal_num_test.cxx SOURCES test/nasal_num_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )

View File

@ -24,18 +24,13 @@ set(SOURCES
simgear_component(package package "${SOURCES}" "${HEADERS}") simgear_component(package package "${SOURCES}" "${HEADERS}")
if(ENABLE_PKGUTIL) if(ENABLE_PKGUTIL)
add_executable(sg_pkgutil pkgutil.cxx) add_simgear_test(sg_pkgutil pkgutil.cxx)
target_link_libraries(sg_pkgutil ${TEST_LIBS})
endif() endif()
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(catalog_test CatalogTest.cxx) add_simgear_autotest(catalog_test CatalogTest.cxx)
target_link_libraries(catalog_test ${TEST_LIBS})
set_target_properties(catalog_test PROPERTIES set_target_properties(catalog_test PROPERTIES
COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" ) COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" )
add_test(catalog_test ${EXECUTABLE_OUTPUT_PATH}/catalog_test)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -35,16 +35,8 @@ simgear_component(props props "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_props props_test.cxx) add_simgear_autotest(test_props props_test.cxx)
target_link_libraries(test_props ${TEST_LIBS}) add_simgear_autotest(test_propertyObject propertyObject_test.cxx)
add_test(props ${EXECUTABLE_OUTPUT_PATH}/test_props) add_simgear_autotest(test_easing_functions easing_functions_test.cxx)
add_executable(test_propertyObject propertyObject_test.cxx)
target_link_libraries(test_propertyObject ${TEST_LIBS})
add_test(propertyObject ${EXECUTABLE_OUTPUT_PATH}/test_propertyObject)
add_executable(test_easing_functions easing_functions_test.cxx)
target_link_libraries(test_easing_functions ${TEST_LIBS})
add_test(easing_functions ${EXECUTABLE_OUTPUT_PATH}/test_easing_functions)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -34,8 +34,7 @@ simgear_scene_component(material scene/material "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_parseBlendFunc parseBlendFunc_test.cxx ) add_simgear_autotest(test_parseBlendFunc parseBlendFunc_test.cxx )
add_test(parseBlendFunc ${EXECUTABLE_OUTPUT_PATH}/test_parseBlendFunc) target_link_libraries(test_parseBlendFunc SimGearScene)
target_link_libraries(test_parseBlendFunc ${TEST_LIBS} ${OPENSCENEGRAPH_LIBRARIES})
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -59,9 +59,5 @@ set(SOURCES
simgear_scene_component(model scene/model "${SOURCES}" "${HEADERS}") simgear_scene_component(model scene/model "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_simgear_scene_autotest(test_animations animation_test.cxx)
add_executable(test_animations animation_test.cxx)
target_link_libraries(test_animations ${TEST_LIBS} ${OPENSCENEGRAPH_LIBRARIES})
add_test(animations ${EXECUTABLE_OUTPUT_PATH}/test_animations)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -44,9 +44,5 @@ set(SOURCES
simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}") simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_simgear_scene_autotest(BucketBoxTest BucketBoxTest.cxx)
add_executable(BucketBoxTest BucketBoxTest.cxx)
target_link_libraries(BucketBoxTest ${TEST_LIBS})
add_test(BucketBoxTest ${EXECUTABLE_OUTPUT_PATH}/BucketBoxTest)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -61,8 +61,7 @@ simgear_scene_component(util scene/util "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_parse_color parse_color_test.cxx ) add_simgear_autotest(test_parse_color parse_color_test.cxx )
add_test(parse_color ${EXECUTABLE_OUTPUT_PATH}/test_parse_color) target_link_libraries(test_parse_color SimGearScene)
target_link_libraries(test_parse_color ${TEST_LIBS})
endif(ENABLE_TESTS) endif(ENABLE_TESTS)

View File

@ -34,18 +34,19 @@ simgear_scene_component(sound sound "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS AND ENABLE_SOUND) if(ENABLE_TESTS AND ENABLE_SOUND)
function(create_test TEST_NAME) function(create_test TEST_NAME)
add_executable(${TEST_NAME} ${TEST_NAME}.cxx) add_executable(${TEST_NAME} ${TEST_NAME}.cxx)
target_link_libraries(${TEST_NAME} ${SOUND_TEST_LIBS}) target_link_libraries(${TEST_NAME} SimGearScene ${SOUND_TEST_LIBS})
set_target_properties(${TEST_NAME} PROPERTIES set_target_properties(${TEST_NAME} PROPERTIES
COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" ) COMPILE_DEFINITIONS "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" )
# for simgear_config.h
target_include_directories(${TEST_NAME} PRIVATE ${PROJECT_BINARY_DIR}/simgear)
endfunction() endfunction()
set( SOUND_TEST_LIBS ${TEST_LIBS} )
if (USE_AEONWAVE) if (USE_AEONWAVE)
set(SOUND_TEST_LIBS ${SOUND_TEST_LIBS} ${AAX_LIBRARY}) set(SOUND_TEST_LIBS ${AAX_LIBRARY})
create_test(aeonwave_test1) create_test(aeonwave_test1)
else () else ()
set(SOUND_TEST_LIBS ${SOUND_TEST_LIBS} ${OPENAL_LIBRARY}) set(SOUND_TEST_LIBS ${OPENAL_LIBRARY})
create_test(openal_test1) create_test(openal_test1)
endif() endif()

View File

@ -11,11 +11,6 @@ set(SOURCES
simgear_component(std std "${SOURCES}" "${HEADERS}") simgear_component(std std "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_executable(test_integer_sequence integer_sequence_test.cxx) add_simgear_autotest(test_integer_sequence integer_sequence_test.cxx)
add_test(integer_sequence ${EXECUTABLE_OUTPUT_PATH}/test_integer_sequence) add_simgear_autotest(test_type_traits type_traits_test.cxx)
target_link_libraries(test_integer_sequence ${TEST_LIBS})
add_executable(test_type_traits type_traits_test.cxx)
add_test(type_traits ${EXECUTABLE_OUTPUT_PATH}/test_type_traits)
target_link_libraries(test_type_traits ${TEST_LIBS})
endif() endif()

View File

@ -45,30 +45,14 @@ set(SOURCES
simgear_component(structure structure "${SOURCES}" "${HEADERS}") simgear_component(structure structure "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS) if(ENABLE_TESTS)
add_simgear_autotest(test_subsystems subsystem_test.cxx)
add_executable(test_subsystems subsystem_test.cxx) add_simgear_autotest(test_state_machine state_machine_test.cxx)
target_link_libraries(test_subsystems ${TEST_LIBS}) add_simgear_autotest(test_expressions expression_test.cxx)
add_test(subsystems ${EXECUTABLE_OUTPUT_PATH}/test_subsystems) add_simgear_autotest(test_shared_ptr shared_ptr_test.cpp)
add_simgear_autotest(test_commands test_commands.cxx)
add_executable(test_state_machine state_machine_test.cxx)
target_link_libraries(test_state_machine ${TEST_LIBS})
add_test(state_machine ${EXECUTABLE_OUTPUT_PATH}/test_state_machine)
add_executable(test_expressions expression_test.cxx)
target_link_libraries(test_expressions ${TEST_LIBS})
add_test(expressions ${EXECUTABLE_OUTPUT_PATH}/test_expressions)
add_executable(test_shared_ptr shared_ptr_test.cpp)
target_link_libraries(test_shared_ptr ${TEST_LIBS})
add_test(shared_ptr ${EXECUTABLE_OUTPUT_PATH}/test_shared_ptr)
add_executable(test_commands test_commands.cxx)
target_link_libraries(test_commands ${TEST_LIBS})
add_test(subsystems ${EXECUTABLE_OUTPUT_PATH}/test_commands)
endif(ENABLE_TESTS) endif(ENABLE_TESTS)
add_boost_test(function_list add_boost_test(function_list
SOURCES function_list_test.cxx SOURCES function_list_test.cxx
LIBRARIES ${TEST_LIBS} LIBRARIES SimGearCore
) )