diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c6fde39 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,96 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.4.1) +SET(CMAKE_SKIP_BUILD_RPATH true) +PROJECT(aitt VERSION 0.0.1 LANGUAGES CXX) +SET_PROPERTY(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 0) +SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +SET(CMAKE_CXX_STANDARD 17) +SET(CMAKE_CXX_STANDARD_REQUIRED ON) +SET(CMAKE_CXX_EXTENSIONS OFF) + +OPTION(VERSIONING "Specify Library Verion" ON) + +INCLUDE(GNUInstallDirs) +INCLUDE(FindPkgConfig) + +IF(PLATFORM STREQUAL "android") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fdiagnostics-color") + ADD_DEFINITIONS(-DANDROID) + INCLUDE(${PROJECT_ROOT_DIR}/cmake/aitt_android_flatbuffers.cmake) + INCLUDE(${PROJECT_ROOT_DIR}/cmake/aitt_android_glib.cmake) + INCLUDE(${PROJECT_ROOT_DIR}/cmake/aitt_android_mosquitto.cmake) + SET(AITT_NEEDS_LIBRARIES ${GLIB_LIBRARIES} ${MOSQUITTO_LIBRARY} ${FLATBUFFERS_LIBRARY}) +ELSE(PLATFORM STREQUAL "android") + IF(PLATFORM STREQUAL "tizen") + ADD_DEFINITIONS(-DTIZEN) + ADD_DEFINITIONS(-DPLATFORM=${PLATFORM}) + SET(ADDITIONAL_OPT "-DTIZEN") + SET(PKGS dlog) + ENDIF(PLATFORM STREQUAL "tizen") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-psabi -fdiagnostics-color -fvisibility=hidden") + PKG_CHECK_MODULES(AITT_NEEDS REQUIRED ${PKGS} libmosquitto flatbuffers glib-2.0) + INCLUDE_DIRECTORIES(${AITT_NEEDS_INCLUDE_DIRS}) + LINK_DIRECTORIES(${AITT_NEEDS_LIBRARY_DIRS}) +ENDIF(PLATFORM STREQUAL "android") + +FIND_PACKAGE(Threads REQUIRED) + +IF(LOG_STDOUT) + ADD_DEFINITIONS(-DLOG_STDOUT) +ENDIF(LOG_STDOUT) + +ADD_DEFINITIONS(-DLOG_TAG="AITT") + +IF(COVERAGE_TEST) + ADD_COMPILE_OPTIONS(--coverage) + ADD_LINK_OPTIONS(--coverage -Wl,--dynamic-list-data) +ENDIF(COVERAGE_TEST) + +SET(AITT_COMMON ${PROJECT_NAME}-common) + +INCLUDE_DIRECTORIES(include common) + +AUX_SOURCE_DIRECTORY(src AITT_SRC) + +ADD_LIBRARY(M_LOADER_OBJ OBJECT src/TransportModuleLoader.cc) +LIST(REMOVE_ITEM AITT_SRC src/TransportModuleLoader.cc) + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${AITT_SRC} $<TARGET_OBJECTS:M_LOADER_OBJ>) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} Threads::Threads ${CMAKE_DL_LIBS} ${AITT_COMMON}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${AITT_NEEDS_LIBRARIES}) + +TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC ${AITT_NEEDS_CFLAGS_OTHER}) +IF(VERSIONING) + SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + ) +ENDIF(VERSIONING) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +FILE(GLOB HEADERS include/*.h) +INSTALL(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) + +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_CMAKE_CLEAN_FILES ${PROJECT_NAME}.pc) + +IF(BUILD_TESTING) + ENABLE_TESTING() # NOTE: Must comes first than unittest subdirectories + SET(AITT_TEST_BINDIR ${CMAKE_INSTALL_BINDIR}) + ADD_SUBDIRECTORY(tests) + ADD_SUBDIRECTORY(tools) +ENDIF(BUILD_TESTING) + +OPTION(WITH_TCP "Build TCP module?" ON) +IF(WITH_TCP) + ADD_SUBDIRECTORY(modules/tcp) +ENDIF() +IF(PLATFORM STREQUAL "tizen") + OPTION(WITH_WEBRTC "Build WebRtc module?" ON) + IF(WITH_WEBRTC) + ADD_DEFINITIONS(-DWITH_WEBRTC) + ADD_SUBDIRECTORY(modules/webrtc) + ENDIF() +ENDIF(PLATFORM STREQUAL "tizen") + +ADD_SUBDIRECTORY(common) |