forked from qualisys/qualisys_cpp_sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
1,395 additions
and
1,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,84 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(qualisys_cpp_sdk) | ||
include(GNUInstallDirs) | ||
|
||
option(BUILD_EXAMPLES "Build examples" OFF) | ||
option(FUZZING "Enable fuzzing mode" OFF) | ||
option(AFL "Enable afl mode" OFF) | ||
|
||
project(qualisys_cpp_sdk) | ||
|
||
if(FUZZING) | ||
# Enable fuzzing and sanitizers | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer,address,undefined -ggdb -O2") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=fuzzer,address,undefined -ggdb -O2") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=fuzzer,address,undefined -ggdb -O2") | ||
endif() | ||
|
||
add_library(${PROJECT_NAME} | ||
Markup.cpp | ||
Network.cpp | ||
RTPacket.cpp | ||
RTProtocol.cpp | ||
add_library(qualisys_cpp_sdk | ||
Markup.cpp | ||
Network.cpp | ||
RTPacket.cpp | ||
RTProtocol.cpp | ||
) | ||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}> | ||
target_include_directories( ${PROJECT_NAME} | ||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
PUBLIC $<$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">:ws2_32.lib> | ||
target_link_libraries( ${PROJECT_NAME} | ||
PRIVATE $<$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">:ws2_32.lib> | ||
) | ||
|
||
# Enable C++14 | ||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) | ||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_EXTENSIONS OFF | ||
# Enable C++11 | ||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) | ||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_EXTENSIONS OFF | ||
DEBUG_POSTFIX "-d" | ||
) | ||
|
||
# ----------- INSTALL & EXPORT ----------- | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) | ||
if(AFL) | ||
set(CMAKE_C_COMPILER "afl-clang-fast") | ||
set(CMAKE_CXX_COMPILER "afl-clang-fast++") | ||
add_executable(harness_afl harness.cc) | ||
target_link_libraries(harness_afl PRIVATE qualisys_cpp_sdk) | ||
else() | ||
add_executable(harness harness.cc) | ||
target_link_libraries(harness PRIVATE qualisys_cpp_sdk) | ||
endif() | ||
|
||
install(EXPORT ${PROJECT_NAME}Targets | ||
FILE ${PROJECT_NAME}Targets.cmake | ||
DESTINATION ${ConfigPackageLocation} | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file(${PROJECT_NAME}Config.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake | ||
INSTALL_DESTINATION ${ConfigPackageLocation} | ||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR | ||
) | ||
|
||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake | ||
DESTINATION ${ConfigPackageLocation} | ||
) | ||
# ----------- INSTALL & EXPORT ----------- | ||
|
||
# 'make install' to the correct locations (provided by GNUInstallDirs). | ||
install( | ||
TARGETS ${PROJECT_NAME} | ||
EXPORT ${PROJECT_NAME}Targets | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # This is for Windows | ||
TARGETS ${PROJECT_NAME} | ||
EXPORT ${PROJECT_NAME}-targets | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # This is for Windows | ||
) | ||
|
||
# Copy along headers | ||
set(INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}") | ||
install( | ||
CODE "file( GLOB HEADERS \"${CMAKE_CURRENT_SOURCE_DIR}/*.h*\" )" | ||
CODE "file( INSTALL \${HEADERS} DESTINATION \"${INSTALL_INCLUDE_DIR}\" )" | ||
CODE "file( GLOB HEADERS \"${CMAKE_CURRENT_SOURCE_DIR}/*.h*\" )" | ||
CODE "file( INSTALL \${HEADERS} DESTINATION \"${INSTALL_INCLUDE_DIR}\" )" | ||
) | ||
|
||
# ----------- EXAMPLES ----------- | ||
|
||
# example: RigidBodyStreaming | ||
if (BUILD_EXAMPLES) | ||
if(BUILD_EXAMPLES) | ||
add_executable(RigidBodyStreaming | ||
RigidBodyStreaming/RigidBodyStreaming.cpp | ||
RigidBodyStreaming/RigidBodyStreaming.cpp | ||
) | ||
target_link_libraries(RigidBodyStreaming | ||
qualisys_cpp_sdk | ||
qualisys_cpp_sdk | ||
) | ||
endif () | ||
endif() | ||
# # example: RTClientExample | ||
# add_executable(RTClientExample | ||
# RTClientExample/Input.cpp | ||
# RTClientExample/Operations.cpp | ||
# RTClientExample/Output.cpp | ||
# RTClientExample/OutputSettings.cpp | ||
# ) | ||
# target_link_libraries(RTClientExample | ||
# qualisys_cpp_sdk | ||
# ) |
Oops, something went wrong.