|
| 1 | +# Copied from vendor/sdrplusplus/core/CMakeLists.txt |
| 2 | +cmake_minimum_required(VERSION 3.13) |
| 3 | +project(sdrpp_core) |
| 4 | + |
| 5 | +set(SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/../vendor/sdrplusplus/core) |
| 6 | + |
| 7 | +# Main code |
| 8 | +file(GLOB_RECURSE SRC "${SRC_DIR}/src/*.cpp" "${SRC_DIR}/src/*.c") |
| 9 | + |
| 10 | +if (MSVC) |
| 11 | + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) |
| 12 | +endif () |
| 13 | + |
| 14 | +# Add code to dyn lib |
| 15 | +add_library(sdrpp_core SHARED ${SRC}) |
| 16 | +# configure SDRPP_EXPORT dllimport/dllexport/extern properly for core/src/module.h |
| 17 | +target_compile_definitions(sdrpp_core PRIVATE SDRPP_IS_CORE) |
| 18 | + |
| 19 | +# Set compiler options |
| 20 | +if (MSVC) |
| 21 | + target_compile_options(sdrpp_core PRIVATE /O2 /Ob2 /std:c++17 /EHsc) |
| 22 | +elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 23 | + target_compile_options(sdrpp_core PRIVATE -O3 -std=c++17) |
| 24 | +else () |
| 25 | + target_compile_options(sdrpp_core PRIVATE -O3 -std=c++17) |
| 26 | +endif () |
| 27 | + |
| 28 | + |
| 29 | +# Set the install prefix |
| 30 | +target_compile_definitions(sdrpp_core PUBLIC INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") |
| 31 | + |
| 32 | +# Include core headers |
| 33 | +target_include_directories(sdrpp_core PUBLIC "${SRC_DIR}/src/") |
| 34 | +target_include_directories(sdrpp_core PUBLIC "${SRC_DIR}/src/imgui") |
| 35 | + |
| 36 | +# Link to linkcorrect |
| 37 | +if (USE_INTERNAL_LIBCORRECT) |
| 38 | +add_subdirectory("${SRC_DIR}/libcorrect/") |
| 39 | +target_include_directories(sdrpp_core PUBLIC "${SRC_DIR}/libcorrect/include") |
| 40 | +target_link_libraries(sdrpp_core PUBLIC correct_static) |
| 41 | +endif (USE_INTERNAL_LIBCORRECT) |
| 42 | + |
| 43 | +if (OPT_OVERRIDE_STD_FILESYSTEM) |
| 44 | +target_include_directories(sdrpp_core PUBLIC "${SRC_DIR}/std_replacement") |
| 45 | +endif (OPT_OVERRIDE_STD_FILESYSTEM) |
| 46 | + |
| 47 | +if (MSVC) |
| 48 | + # Lib path |
| 49 | + target_link_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/lib/") |
| 50 | + |
| 51 | + # Misc headers |
| 52 | + target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/") |
| 53 | + |
| 54 | + # Volk |
| 55 | + target_link_libraries(sdrpp_core PUBLIC volk) |
| 56 | + |
| 57 | + # Glew |
| 58 | + find_package(GLEW REQUIRED) |
| 59 | + target_link_libraries(sdrpp_core PUBLIC GLEW::GLEW) |
| 60 | + |
| 61 | + # GLFW3 |
| 62 | + find_package(glfw3 CONFIG REQUIRED) |
| 63 | + target_link_libraries(sdrpp_core PUBLIC glfw) |
| 64 | + |
| 65 | + # FFTW3 |
| 66 | + find_package(FFTW3f CONFIG REQUIRED) |
| 67 | + target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3f) |
| 68 | + |
| 69 | + # WinSock2 |
| 70 | + target_link_libraries(sdrpp_core PUBLIC wsock32 ws2_32) |
| 71 | + |
| 72 | +else() |
| 73 | + find_package(PkgConfig) |
| 74 | + find_package(OpenGL REQUIRED) |
| 75 | + |
| 76 | + pkg_check_modules(GLEW REQUIRED glew) |
| 77 | + pkg_check_modules(FFTW3 REQUIRED fftw3f) |
| 78 | + pkg_check_modules(VOLK REQUIRED volk) |
| 79 | + pkg_check_modules(GLFW3 REQUIRED glfw3) |
| 80 | + |
| 81 | + target_include_directories(sdrpp_core PUBLIC |
| 82 | + ${GLEW_INCLUDE_DIRS} |
| 83 | + ${FFTW3_INCLUDE_DIRS} |
| 84 | + ${GLFW3_INCLUDE_DIRS} |
| 85 | + ${VOLK_INCLUDE_DIRS} |
| 86 | + ) |
| 87 | + |
| 88 | + target_link_directories(sdrpp_core PUBLIC |
| 89 | + ${GLEW_LIBRARY_DIRS} |
| 90 | + ${FFTW3_LIBRARY_DIRS} |
| 91 | + ${GLFW3_LIBRARY_DIRS} |
| 92 | + ${VOLK_LIBRARY_DIRS} |
| 93 | + ) |
| 94 | + |
| 95 | + target_link_libraries(sdrpp_core PUBLIC |
| 96 | + ${OPENGL_LIBRARIES} |
| 97 | + ${GLEW_LIBRARIES} |
| 98 | + ${FFTW3_LIBRARIES} |
| 99 | + ${GLFW3_LIBRARIES} |
| 100 | + ${VOLK_LIBRARIES} |
| 101 | + ) |
| 102 | + |
| 103 | + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 104 | + target_link_libraries(sdrpp_core PUBLIC stdc++fs) |
| 105 | + endif () |
| 106 | + |
| 107 | + if (NOT USE_INTERNAL_LIBCORRECT) |
| 108 | + pkg_check_modules(CORRECT REQUIRED libcorrect) |
| 109 | + target_include_directories(sdrpp_core PUBLIC ${CORRECT_INCLUDE_DIRS}) |
| 110 | + target_link_directories(sdrpp_core PUBLIC ${CORRECT_LIBRARY_DIRS}) |
| 111 | + target_link_libraries(sdrpp_core PUBLIC ${CORRECT_LIBRARIES}) |
| 112 | + endif (NOT USE_INTERNAL_LIBCORRECT) |
| 113 | +endif () |
0 commit comments