2021-04-26 15:03:52 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2020-09-19 10:48:34 +00:00
|
|
|
project(sdrpp_core)
|
|
|
|
|
|
|
|
# Set compiler options
|
|
|
|
if (MSVC)
|
2020-12-12 04:34:58 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
|
2020-09-19 10:48:34 +00:00
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
2021-04-18 17:20:51 +00:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2021-04-18 17:24:56 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
|
2021-04-18 17:12:07 +00:00
|
|
|
else ()
|
|
|
|
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
|
|
|
|
endif ()
|
2020-09-19 22:19:39 +00:00
|
|
|
add_definitions(-DSDRPP_IS_CORE)
|
2020-09-19 10:48:34 +00:00
|
|
|
|
2021-10-02 15:01:23 +00:00
|
|
|
add_subdirectory("libcorrect/")
|
|
|
|
|
2020-09-19 10:48:34 +00:00
|
|
|
# Main code
|
2020-10-23 02:53:48 +00:00
|
|
|
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")
|
2020-09-19 10:48:34 +00:00
|
|
|
|
|
|
|
# Add code to dyn lib
|
2020-10-23 02:53:48 +00:00
|
|
|
add_library(sdrpp_core SHARED ${SRC})
|
2020-09-19 10:48:34 +00:00
|
|
|
|
2021-04-26 13:17:24 +00:00
|
|
|
# Set the install prefix
|
|
|
|
target_compile_definitions(sdrpp_core PUBLIC INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
|
|
|
|
|
2020-09-19 10:48:34 +00:00
|
|
|
# Include core headers
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "src/")
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "src/imgui")
|
|
|
|
|
2021-10-02 15:01:23 +00:00
|
|
|
# Link to linkcorrect
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "libcorrect/include")
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC correct_static)
|
|
|
|
|
2021-08-16 16:49:00 +00:00
|
|
|
if (OPT_OVERRIDE_STD_FILESYSTEM)
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "std_replacement")
|
|
|
|
endif (OPT_OVERRIDE_STD_FILESYSTEM)
|
2020-09-19 10:48:34 +00:00
|
|
|
|
|
|
|
if (MSVC)
|
|
|
|
# Lib path
|
|
|
|
target_link_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/lib/")
|
|
|
|
|
|
|
|
# Misc headers
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/")
|
|
|
|
|
|
|
|
# Volk
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC volk)
|
|
|
|
|
|
|
|
# Glew
|
|
|
|
find_package(GLEW REQUIRED)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC GLEW::GLEW)
|
|
|
|
|
|
|
|
# GLFW3
|
|
|
|
find_package(glfw3 CONFIG REQUIRED)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC glfw)
|
|
|
|
|
|
|
|
# FFTW3
|
|
|
|
find_package(FFTW3f CONFIG REQUIRED)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3f)
|
|
|
|
|
2021-07-15 23:49:33 +00:00
|
|
|
# WinSock2
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC wsock32 ws2_32)
|
|
|
|
|
2020-10-23 02:53:48 +00:00
|
|
|
else()
|
2020-10-23 02:25:02 +00:00
|
|
|
find_package(PkgConfig)
|
2020-10-22 00:28:43 +00:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
|
2020-10-23 02:53:48 +00:00
|
|
|
pkg_check_modules(GLEW REQUIRED glew)
|
2020-10-23 02:25:02 +00:00
|
|
|
pkg_check_modules(FFTW3 REQUIRED fftw3f)
|
|
|
|
pkg_check_modules(VOLK REQUIRED volk)
|
|
|
|
pkg_check_modules(GLFW3 REQUIRED glfw3)
|
|
|
|
|
|
|
|
target_include_directories(sdrpp_core PUBLIC
|
|
|
|
${GLEW_INCLUDE_DIRS}
|
|
|
|
${FFTW3_INCLUDE_DIRS}
|
|
|
|
${GLFW3_INCLUDE_DIRS}
|
2020-10-23 02:39:20 +00:00
|
|
|
${VOLK_INCLUDE_DIRS}
|
2020-12-22 19:35:31 +00:00
|
|
|
)
|
2020-10-23 02:25:02 +00:00
|
|
|
|
2021-04-29 12:30:11 +00:00
|
|
|
target_link_directories(sdrpp_core PUBLIC
|
|
|
|
${GLEW_LIBRARY_DIRS}
|
|
|
|
${FFTW3_LIBRARY_DIRS}
|
|
|
|
${GLFW3_LIBRARY_DIRS}
|
|
|
|
${VOLK_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
|
2020-10-23 02:25:02 +00:00
|
|
|
target_link_libraries(sdrpp_core PUBLIC
|
|
|
|
${OPENGL_LIBRARIES}
|
2020-12-22 19:35:31 +00:00
|
|
|
${GLEW_LIBRARIES}
|
|
|
|
${FFTW3_LIBRARIES}
|
|
|
|
${GLFW3_LIBRARIES}
|
|
|
|
${VOLK_LIBRARIES}
|
|
|
|
)
|
2020-10-23 02:25:02 +00:00
|
|
|
|
2020-10-23 02:53:48 +00:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC stdc++fs)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
|
|
|
endif ()
|
|
|
|
|
2020-10-22 00:28:43 +00:00
|
|
|
endif ()
|
2020-09-19 10:48:34 +00:00
|
|
|
|
|
|
|
set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)
|
|
|
|
|
2020-10-22 15:55:49 +00:00
|
|
|
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
|
2021-02-11 21:49:33 +00:00
|
|
|
|
|
|
|
# Install directives
|
|
|
|
install(TARGETS sdrpp_core DESTINATION lib)
|