project(lib_antenneAcoustique3D LANGUAGES CUDA CXX) cmake_minimum_required(VERSION 3.8 FATAL_ERROR) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy) option(INSTALL_EXECUTABLES "Install the executables along with the library" OFF) option(FORCE_BIN_AND_LIB_DIRS "Force the installation of the library and executables in the bin and lib directories" ON) find_package(CUDA REQUIRED COMPONENTS cufft) find_package(Boost REQUIRED COMPONENTS iostreams serialization) find_package(OpenCV REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(PC_ALSA REQUIRED alsa) # To set path to include headers PAL set(PAL_INCLUDE_DIR ~/DreamVu/PAL/include) # To set path to include shared library PAL: set(PAL_LIBRARY /usr/local/lib/libPAL.so ) include_directories("${PROJECT_SOURCE_DIR}/include") include_directories(${PAL_INCLUDE_DIR}) include_directories(${OpenCV_INCLUDE_DIRS}) include_directories("${CUDA_INCLUDE_DIRS}") # Compile in release mode if not set if(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "Release") endif(NOT CMAKE_BUILD_TYPE) if(FORCE_BIN_AND_LIB_DIRS) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") endif() #Add base directory for includes (global) include_directories(include) include_directories(include/Acquisition) include_directories(include/GUIserver) set(SRC src/ImageGenerator.cpp src/Utils.cpp src/Acquisition/Audio.cpp src/Acquisition/Video.cpp src/Acquisition/Imagery.cu src/Acquisition/Kernels.cu src/GUIserver/GuiServer.cpp src/GUIserver/NetworkMsg.cpp ) add_library(lib_antenneAcoustique3D SHARED ${SRC} ) # We need to explicitly state that we need all CUDA files in the # particle library to be built with -dc as the member functions # could be called by other libraries and executables set_target_properties( lib_antenneAcoustique3D PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON) target_link_libraries(lib_antenneAcoustique3D ${PC_ALSA_LIBRARIES} Boost::iostreams Boost::serialization cufft ${PAL_LIBRARY} ${OpenCV_LIBS} ) target_include_directories(lib_antenneAcoustique3D PUBLIC DreamVu/PAL/include) add_executable(main main.cpp) target_link_libraries(main lib_antenneAcoustique3D ) set_property(TARGET main PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) install(TARGETS lib_antenneAcoustique3D LIBRARY DESTINATION lib) install( DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.h" ) if(INSTALL_EXECUTABLES) install(TARGETS main DESTINATION bin) endif() if(FORCE_BIN_AND_LIB_DIRS) unset(CMAKE_RUNTIME_OUTPUT_DIRECTORY) unset(CMAKE_LIBRARY_OUTPUT_DIRECTORY) endif()