diff --git a/library-vcpkg/CMakeLists.txt b/library-vcpkg/CMakeLists.txt index 78e9654062..0166a8ffd6 100644 --- a/library-vcpkg/CMakeLists.txt +++ b/library-vcpkg/CMakeLists.txt @@ -1,4 +1,11 @@ -file(GLOB THE_SOURCES "${DPP_ROOT_PATH}/src/dpp/events/*.cpp" "${DPP_ROOT_PATH}/dpp/dave/*.cpp" "${DPP_ROOT_PATH}/src/dpp/cluster/*.cpp" "${DPP_ROOT_PATH}/src/dpp/*.cpp" "${DPP_ROOT_PATH}/src/dpp/*.rc") +add_compile_definitions(HAVE_VOICE) + +if (HAVE_VOICE) + file(GLOB THE_SOURCES "${DPP_ROOT_PATH}/src/dpp/events/*.cpp" "${DPP_ROOT_PATH}/dpp/dave/*.cpp" "${DPP_ROOT_PATH}/src/dpp/cluster/*.cpp" "${DPP_ROOT_PATH}/src/dpp/*.cpp" "${DPP_ROOT_PATH}/src/dpp/*.rc") +else() + file(GLOB THE_SOURCES "${DPP_ROOT_PATH}/src/dpp/events/*.cpp" "${DPP_ROOT_PATH}/src/dpp/cluster/*.cpp" "${DPP_ROOT_PATH}/src/dpp/*.cpp" "${DPP_ROOT_PATH}/src/dpp/*.rc") +endif() + set(LIB_NAME "${PROJECT_NAME}") @@ -62,10 +69,12 @@ target_include_directories( "$" ) -add_subdirectory("${DPP_ROOT_PATH}/mlspp" "mlspp") -include_directories("${DPP_ROOT_PATH}/mlspp/include") -include_directories("${DPP_ROOT_PATH}/mlspp/lib/bytes/include") -include_directories("${DPP_ROOT_PATH}/mlspp/lib/hpke/include") +if (HAVE_VOICE) + add_subdirectory("${DPP_ROOT_PATH}/mlspp" "mlspp") + include_directories("${DPP_ROOT_PATH}/mlspp/include") + include_directories("${DPP_ROOT_PATH}/mlspp/lib/bytes/include") + include_directories("${DPP_ROOT_PATH}/mlspp/lib/hpke/include") +endif() set_target_properties( "${LIB_NAME}" PROPERTIES @@ -78,8 +87,6 @@ target_link_options( "$<$:$<$:/DEBUG>>" ) -add_compile_definitions(HAVE_VOICE) - find_package(nlohmann_json CONFIG REQUIRED) find_package(OpenSSL REQUIRED) find_package(Opus CONFIG REQUIRED) @@ -97,15 +104,17 @@ target_link_libraries( $<$:Threads::Threads> ) -# Private statically linked dependencies -target_link_libraries( - ${LIB_NAME} PRIVATE - mlspp - mls_vectors - bytes - tls_syntax - hpke -) +if (HAVE_VOICE) + # Private statically linked dependencies + target_link_libraries( + ${LIB_NAME} PRIVATE + mlspp + mls_vectors + bytes + tls_syntax + hpke + ) +endif() set(CONFIG_FILE_NAME "${PROJECT_NAME}Config.cmake") set(EXPORTED_TARGETS_NAME "${PROJECT_NAME}Targets") diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 7f00b5737e..4025359924 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -211,16 +211,22 @@ set(modules_dir "../src") file(GLOB subdirlist ${modules_dir}/dpp) -add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp" "mlspp") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp/include") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp/lib/bytes/include") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp/lib/hpke/include") +if (HAVE_VOICE) + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp" "mlspp") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp/include") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp/lib/bytes/include") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../mlspp/lib/hpke/include") +endif() foreach (fullmodname ${subdirlist}) get_filename_component(modname ${fullmodname} NAME) set (modsrc "") - file(GLOB modsrc "${modules_dir}/dpp/*.cpp" "${modules_dir}/dpp/dave/*.cpp" "${modules_dir}/dpp/events/*.cpp" "${modules_dir}/dpp/cluster/*.cpp" "${modules_dir}/dpp/*.rc") + if (HAVE_VOICE) + file(GLOB modsrc "${modules_dir}/dpp/*.cpp" "${modules_dir}/dpp/dave/*.cpp" "${modules_dir}/dpp/events/*.cpp" "${modules_dir}/dpp/cluster/*.cpp" "${modules_dir}/dpp/*.rc") + else() + file(GLOB modsrc "${modules_dir}/dpp/*.cpp" "${modules_dir}/dpp/events/*.cpp" "${modules_dir}/dpp/cluster/*.cpp" "${modules_dir}/dpp/*.rc") + endif() if(BUILD_SHARED_LIBS) add_library(${modname} SHARED ${modsrc}) @@ -270,14 +276,16 @@ foreach (fullmodname ${subdirlist}) endif () endif() - # Private statically linked dependencies - target_link_libraries(${modname} PRIVATE - mlspp - mls_vectors - bytes - tls_syntax - hpke - ) + if (HAVE_VOICE) + # Private statically linked dependencies + target_link_libraries(${modname} PRIVATE + mlspp + mls_vectors + bytes + tls_syntax + hpke + ) + endif() if (HAVE_VOICE) target_link_libraries(${modname} PUBLIC ${sodium_LIBRARY_RELEASE} ${OPUS_LIBRARIES})