diff --git a/CMakeLists.txt b/CMakeLists.txt index bc77a37d..e7621e79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,9 @@ option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON) option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON) option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" ON) +# Other options +option(USE_INTERNAL_LIBCORRECT "Use an external version of libcorrect" ON) + # Core of SDR++ add_subdirectory("core") diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 193e84f8..ebe3c600 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,7 +1,9 @@ cmake_minimum_required(VERSION 3.13) project(sdrpp_core) -add_subdirectory("libcorrect/") +if (USE_INTERNAL_LIBCORRECT) + add_subdirectory("libcorrect/") +endif (USE_INTERNAL_LIBCORRECT) # Main code file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c") @@ -31,12 +33,14 @@ target_compile_definitions(sdrpp_core PUBLIC INSTALL_PREFIX="${CMAKE_INSTALL_PRE target_include_directories(sdrpp_core PUBLIC "src/") target_include_directories(sdrpp_core PUBLIC "src/imgui") -# Link to linkcorrect -target_include_directories(sdrpp_core PUBLIC "libcorrect/include") -target_link_libraries(sdrpp_core PUBLIC correct_static) +# Link to libcorrect +if (USE_INTERNAL_LIBCORRECT) + target_include_directories(sdrpp_core PUBLIC "libcorrect/include") + target_link_libraries(sdrpp_core PUBLIC correct_static) +endif (USE_INTERNAL_LIBCORRECT) if (OPT_OVERRIDE_STD_FILESYSTEM) -target_include_directories(sdrpp_core PUBLIC "std_replacement") + target_include_directories(sdrpp_core PUBLIC "std_replacement") endif (OPT_OVERRIDE_STD_FILESYSTEM) if (MSVC) @@ -79,7 +83,7 @@ else() ${GLFW3_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS} ) - + target_link_directories(sdrpp_core PUBLIC ${GLEW_LIBRARY_DIRS} ${FFTW3_LIBRARY_DIRS} @@ -95,6 +99,13 @@ else() ${VOLK_LIBRARIES} ) + if (NOT USE_INTERNAL_LIBCORRECT) + pkg_check_modules(CORRECT REQUIRED libcorrect) + target_include_directories(sdrpp_core PUBLIC ${CORRECT_INCLUDE_DIRS}) + target_link_directories(sdrpp_core PUBLIC ${CORRECT_LIBRARY_DIRS}) + target_link_libraries(sdrpp_core PUBLIC ${CORRECT_LIBRARIES}) + endif (NOT USE_INTERNAL_LIBCORRECT) + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") target_link_libraries(sdrpp_core PUBLIC stdc++fs) endif ()