2020-09-19 12:48:34 +02:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
|
project(sdrpp_core)
|
|
|
|
|
|
|
|
# Set compiler options
|
|
|
|
if (MSVC)
|
|
|
|
set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
|
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
|
|
else()
|
2020-10-22 17:55:49 +02:00
|
|
|
set(CMAKE_CXX_FLAGS "-g -O3 -std=c++17 -fpermissive")
|
2020-09-19 12:48:34 +02:00
|
|
|
endif (MSVC)
|
2020-09-20 00:19:39 +02:00
|
|
|
add_definitions(-DSDRPP_IS_CORE)
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
# Main code
|
|
|
|
file(GLOB SRC "src/*.cpp")
|
2020-09-20 00:19:39 +02:00
|
|
|
file(GLOB GUI "src/gui/*.cpp")
|
2020-09-25 14:25:36 +02:00
|
|
|
file(GLOB MENUS "src/gui/menus/*.cpp")
|
|
|
|
file(GLOB DIALOGS "src/gui/dialogs/*.cpp")
|
2020-09-20 00:19:39 +02:00
|
|
|
file(GLOB SIGPATH "src/signal_path/*.cpp")
|
2020-09-19 12:48:34 +02:00
|
|
|
file(GLOB IMGUI "src/imgui/*.cpp")
|
2020-10-06 15:50:46 +02:00
|
|
|
file(GLOB DUKTAPE "src/duktape/*.c")
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
# Add code to dyn lib
|
2020-10-06 15:50:46 +02:00
|
|
|
add_library(sdrpp_core SHARED ${SRC} ${GUI} ${MENUS} ${DIALOGS} ${SIGPATH} ${IMGUI} ${DUKTAPE})
|
2020-09-20 00:41:35 +02:00
|
|
|
set_target_properties(sdrpp_core PROPERTIES PREFIX "")
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
# Include core headers
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "src/")
|
|
|
|
target_include_directories(sdrpp_core PUBLIC "src/imgui")
|
|
|
|
|
|
|
|
|
|
|
|
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_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/volk/")
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC volk)
|
|
|
|
|
|
|
|
# SoapySDR
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC SoapySDR)
|
|
|
|
|
|
|
|
# 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(FFTW3 CONFIG REQUIRED)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3)
|
|
|
|
find_package(FFTW3f CONFIG REQUIRED)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3f)
|
|
|
|
|
|
|
|
# PortAudio
|
|
|
|
find_package(portaudio CONFIG REQUIRED)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC portaudio portaudio_static)
|
|
|
|
|
2020-10-23 04:25:02 +02:00
|
|
|
target_link_libraries(sdrpp_core PUBLIC volk)
|
|
|
|
|
2020-10-22 02:28:43 +02:00
|
|
|
endif (MSVC)
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2020-09-19 12:48:34 +02:00
|
|
|
target_include_directories(sdrpp_core PUBLIC "/usr/include/volk")
|
|
|
|
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC pthread)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC GL)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC GLEW)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC glfw)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC fftw3)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC fftw3f)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC portaudio)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC X11)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC Xxf86vm)
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC dl)
|
2020-10-22 17:55:49 +02:00
|
|
|
target_link_libraries(sdrpp_core PUBLIC stdc++fs)
|
2020-10-23 04:25:02 +02:00
|
|
|
target_link_libraries(sdrpp_core PUBLIC volk)
|
2020-10-22 02:28:43 +02:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2020-10-23 04:25:02 +02:00
|
|
|
find_package(PkgConfig)
|
2020-10-22 02:28:43 +02:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
|
2020-10-23 04:25:02 +02:00
|
|
|
pkg_check_modules(GLEW REQUIRED GLEW)
|
|
|
|
pkg_check_modules(FFTW3 REQUIRED fftw3f)
|
|
|
|
pkg_check_modules(VOLK REQUIRED volk)
|
|
|
|
pkg_check_modules(GLFW3 REQUIRED glfw3)
|
|
|
|
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
|
|
|
|
|
|
|
|
target_include_directories(sdrpp_core PUBLIC
|
|
|
|
${GLEW_INCLUDE_DIRS}
|
|
|
|
${FFTW3_INCLUDE_DIRS}
|
|
|
|
${GLFW3_INCLUDE_DIRS}
|
|
|
|
${VOLK_INCLUDE_DIRS} ${VOLK_INCLUDE_DIRS}/volk
|
|
|
|
${PORTAUDIO_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_directories(sdrpp_core PUBLIC
|
|
|
|
${GLEW_LIBRARY_DIRS}
|
|
|
|
${FFTW3_LIBRARY_DIRS}
|
|
|
|
${GLFW3_LIBRARY_DIRS}
|
|
|
|
${VOLK_LIBRARY_DIRS}
|
|
|
|
${PORTAUDIO_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(sdrpp_core PUBLIC
|
|
|
|
${OPENGL_LIBRARIES}
|
|
|
|
${GLEW_STATIC_LIBRARIES}
|
|
|
|
${FFTW3_STATIC_LIBRARIES}
|
|
|
|
${GLFW3_STATIC_LIBRARIES}
|
|
|
|
${VOLK_STATIC_LIBRARIES}
|
|
|
|
${PORTAUDIO_STATIC_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
2020-10-22 02:28:43 +02:00
|
|
|
endif ()
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)
|
|
|
|
|
2020-10-22 17:55:49 +02:00
|
|
|
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
|