file(GLOB THE_SOURCES "${CMAKE_SOURCE_DIR}/src/dpp/events/*.cpp" "${CMAKE_SOURCE_DIR}/src/dpp/cluster/*.cpp" "${CMAKE_SOURCE_DIR}/src/dpp/*.cpp" "${CMAKE_SOURCE_DIR}/src/dpp/*.rc") set(LIB_NAME "${PROJECT_NAME}") if(WIN32) add_library("${LIB_NAME}" SHARED "${THE_SOURCES}") else() add_library("${LIB_NAME}" STATIC "${THE_SOURCES}") find_package(Threads REQUIRED) endif() add_library("${PROJECT_NAME}::${LIB_NAME}" ALIAS "${LIB_NAME}") target_compile_definitions( "${LIB_NAME}" PUBLIC "DPP_BUILD" "$<$:$<$:/sdl;/std:c++17;/Od;/DEBUG;/sdl;/MP;/DFD_SETSIZE=1024;/Zc:preprocessor>>" "$<$:$<$:/std:c++17;/O2;/Oi;/Oy;/GL;/Gy;/sdl;/MP;/DFD_SETSIZE=1024;/Zc:preprocessor>>" ) target_compile_options( "${LIB_NAME}" PUBLIC "$<$:/bigobj>" "$<$:$<$:-std=c++17;-Wall;-Wempty-body;-Wno-psabi;-Wunknown-pragmas;-Wignored-qualifiers;-Wimplicit-fallthrough;-Wmissing-field-initializers;-Wsign-compare;-Wtype-limits;-Wuninitialized;-Wshift-negative-value;-pthread;-g;-Og;-fPIC>>" "$<$:$<$:-std=c++17;-Wall;-Wempty-body;-Wno-psabi;-Wunknown-pragmas;-Wignored-qualifiers;-Wimplicit-fallthrough;-Wmissing-field-initializers;-Wsign-compare;-Wtype-limits;-Wuninitialized;-Wshift-negative-value;-pthread;-O3;-fPIC>>" ) target_compile_features( "${LIB_NAME}" PUBLIC "cxx_std_17" "cxx_constexpr" "cxx_auto_type" "cxx_defaulted_functions" "cxx_deleted_functions" "cxx_final" "cxx_lambdas" "cxx_override" "cxx_thread_local" "cxx_variadic_templates" "cxx_attribute_deprecated" "cxx_enum_forward_declarations" ) target_include_directories( "${LIB_NAME}" PRIVATE "$" ) set_target_properties( "${LIB_NAME}" PROPERTIES OUTPUT_NAME "dpp" CXX_STANDARD_REQUIRED ON ) target_link_options( "${LIB_NAME}" PUBLIC "$<$:/DEBUG>" ) add_compile_definitions(HAVE_VOICE) find_package(nlohmann_json CONFIG REQUIRED) find_package(OpenSSL REQUIRED) find_package(Opus CONFIG REQUIRED) find_package(unofficial-sodium CONFIG REQUIRED) find_package(ZLIB REQUIRED) target_link_libraries( "${LIB_NAME}" PUBLIC $<$:nlohmann_json::nlohmann_json> $<$:OpenSSL::SSL> $<$:OpenSSL::Crypto> $<$:Opus::opus> $<$:unofficial-sodium::sodium> $<$:ZLIB::ZLIB> $<$:Threads::Threads> ) set(CONFIG_FILE_NAME "${PROJECT_NAME}Config.cmake") set(EXPORTED_TARGETS_NAME "${PROJECT_NAME}Targets") set(EXPORTED_TARGETS_FILE_NAME "${EXPORTED_TARGETS_NAME}.cmake") set(EXPORTED_TARGETS_FILE_PATH "share/dpp/${EXPORTED_TARGETS_FILE_NAME}") set(RELEASE_PDB_FILE_PATH "bin/dpp.pdb") set(DEBUG_PDB_FILE_PATH "debug/bin/dpp.pdb") include(CMakePackageConfigHelpers) configure_package_config_file( "${CMAKE_SOURCE_DIR}/cmake/${CONFIG_FILE_NAME}.in" "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_FILE_NAME}" INSTALL_DESTINATION "share/dpp" PATH_VARS EXPORTED_TARGETS_FILE_PATH RELEASE_PDB_FILE_PATH DEBUG_PDB_FILE_PATH ) set(VERSION_FILE_NAME "${PROJECT_NAME}ConfigVersion.cmake") write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${VERSION_FILE_NAME}" VERSION "${PRODUCT_VERSION}" COMPATIBILITY AnyNewerVersion ) install( DIRECTORY "${CMAKE_SOURCE_DIR}/include/" DESTINATION "include" ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_FILE_NAME}" "${CMAKE_CURRENT_BINARY_DIR}/${VERSION_FILE_NAME}" DESTINATION "share/dpp" ) install( TARGETS "${LIB_NAME}" EXPORT "${EXPORTED_TARGETS_NAME}" RUNTIME DESTINATION "$<$>:$,${DEBUG_PREFIX}bin,bin>>" ARCHIVE DESTINATION "$,${DEBUG_PREFIX}lib,lib>" ) install( EXPORT "${EXPORTED_TARGETS_NAME}" FILE "${EXPORTED_TARGETS_FILE_NAME}" NAMESPACE "${PROJECT_NAME}::" DESTINATION "share/dpp" ) if (WIN32) install( FILES "$" DESTINATION "$,${DEBUG_PREFIX}bin,bin>" OPTIONAL ) endif()