Merge pull request #28 from howard0su/experimental

Build system fix and cleanup
This commit is contained in:
AlexandreRouma 2020-10-24 14:55:41 +02:00 committed by GitHub
commit 82d3431f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 71 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ build/
*.dll *.dll
*.exe *.exe
*.zip *.zip
.DS_Store

View File

@ -22,6 +22,7 @@ target_link_libraries(sdrpp PRIVATE sdrpp_core)
# Copy dynamic libs over # Copy dynamic libs over
if (MSVC) if (MSVC)
add_custom_target(do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\*.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y) add_custom_target(do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\*.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
add_custom_target(do_always_volk ALL xcopy /s \"C:/Program Files/PothosSDR/bin\\volk.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
endif (MSVC) endif (MSVC)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

View File

@ -6,21 +6,15 @@ if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17") set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
else() else()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive") set(CMAKE_CXX_FLAGS "-g -O3 -std=c++17 -fpermissive")
endif (MSVC) endif (MSVC)
add_definitions(-DSDRPP_IS_CORE) add_definitions(-DSDRPP_IS_CORE)
# Main code # Main code
file(GLOB SRC "src/*.cpp") file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")
file(GLOB GUI "src/gui/*.cpp")
file(GLOB MENUS "src/gui/menus/*.cpp")
file(GLOB DIALOGS "src/gui/dialogs/*.cpp")
file(GLOB SIGPATH "src/signal_path/*.cpp")
file(GLOB IMGUI "src/imgui/*.cpp")
file(GLOB DUKTAPE "src/duktape/*.c")
# Add code to dyn lib # Add code to dyn lib
add_library(sdrpp_core SHARED ${SRC} ${GUI} ${MENUS} ${DIALOGS} ${SIGPATH} ${IMGUI} ${DUKTAPE}) add_library(sdrpp_core SHARED ${SRC})
set_target_properties(sdrpp_core PROPERTIES PREFIX "") set_target_properties(sdrpp_core PROPERTIES PREFIX "")
# Include core headers # Include core headers
@ -36,7 +30,6 @@ if (MSVC)
target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/") target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/")
# Volk # Volk
target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/volk/")
target_link_libraries(sdrpp_core PUBLIC volk) target_link_libraries(sdrpp_core PUBLIC volk)
# SoapySDR # SoapySDR
@ -51,8 +44,6 @@ if (MSVC)
target_link_libraries(sdrpp_core PUBLIC glfw) target_link_libraries(sdrpp_core PUBLIC glfw)
# FFTW3 # FFTW3
find_package(FFTW3 CONFIG REQUIRED)
target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3)
find_package(FFTW3f CONFIG REQUIRED) find_package(FFTW3f CONFIG REQUIRED)
target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3f) target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3f)
@ -60,56 +51,53 @@ if (MSVC)
find_package(portaudio CONFIG REQUIRED) find_package(portaudio CONFIG REQUIRED)
target_link_libraries(sdrpp_core PUBLIC portaudio portaudio_static) target_link_libraries(sdrpp_core PUBLIC portaudio portaudio_static)
endif (MSVC) target_link_libraries(sdrpp_core PUBLIC volk)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") else()
target_include_directories(sdrpp_core PUBLIC "/usr/include/volk") find_package(PkgConfig)
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)
endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
# find_package(GLEW REQUIRED) pkg_check_modules(GLEW REQUIRED glew)
# find_package(fftw3 REQUIRED) pkg_check_modules(FFTW3 REQUIRED fftw3f)
# find_package(glfw3 REQUIRED) pkg_check_modules(VOLK REQUIRED volk)
# find_package(volk REQUIRED) pkg_check_modules(GLFW3 REQUIRED glfw3)
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
target_include_directories(sdrpp_core PUBLIC /usr/local/opt/glew/include) target_include_directories(sdrpp_core PUBLIC
target_include_directories(sdrpp_core PUBLIC /usr/local/opt/glfw/include) ${GLEW_INCLUDE_DIRS}
target_include_directories(sdrpp_core PUBLIC /usr/local/opt/fftw/include) ${FFTW3_INCLUDE_DIRS}
target_include_directories(sdrpp_core PUBLIC /usr/local/opt/portaudio/include) ${GLFW3_INCLUDE_DIRS}
target_include_directories(sdrpp_core PUBLIC /usr/local/opt/volk/include) ${VOLK_INCLUDE_DIRS}
target_include_directories(sdrpp_core PUBLIC /usr/local/opt/volk/include/volk) ${PORTAUDIO_INCLUDE_DIRS}
)
target_link_directories(sdrpp_core PUBLIC /usr/local/opt/glew/lib) target_link_directories(sdrpp_core PUBLIC
target_link_directories(sdrpp_core PUBLIC /usr/local/opt/volk/lib) ${GLEW_LIBRARY_DIRS}
target_link_directories(sdrpp_core PUBLIC /usr/local/opt/glfw/lib) ${FFTW3_LIBRARY_DIRS}
target_link_directories(sdrpp_core PUBLIC /usr/local/opt/fftw/lib) ${GLFW3_LIBRARY_DIRS}
target_link_directories(sdrpp_core PUBLIC /usr/local/opt/portaudio/lib) ${VOLK_LIBRARY_DIRS}
${PORTAUDIO_LIBRARY_DIRS}
)
target_link_libraries(sdrpp_core PUBLIC ${OPENGL_LIBRARIES}) target_link_libraries(sdrpp_core PUBLIC
target_link_libraries(sdrpp_core PUBLIC volk) ${OPENGL_LIBRARIES}
target_link_libraries(sdrpp_core PUBLIC glew) ${GLEW_STATIC_LIBRARIES}
target_link_libraries(sdrpp_core PUBLIC glfw) ${FFTW3_STATIC_LIBRARIES}
target_link_libraries(sdrpp_core PUBLIC fftw3) ${GLFW3_STATIC_LIBRARIES}
target_link_libraries(sdrpp_core PUBLIC fftw3f) ${VOLK_STATIC_LIBRARIES}
target_link_libraries(sdrpp_core PUBLIC portaudio) ${PORTAUDIO_STATIC_LIBRARIES}
)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(sdrpp_core PUBLIC stdc++fs)
endif () endif ()
target_link_libraries(sdrpp_core PUBLIC volk) 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 ()
endif ()
set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE) set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)

View File

@ -100,11 +100,13 @@ int sdrpp_main() {
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
glfwSwapInterval(1); // Enable vsync glfwSwapInterval(1); // Enable vsync
#if (GLFW_VERSION_MAJOR == 3) && (GLFW_VERSION_MINOR >= 3)
if (maximized) { if (maximized) {
glfwMaximizeWindow(window); glfwMaximizeWindow(window);
} }
glfwSetWindowMaximizeCallback(window, maximized_callback); glfwSetWindowMaximizeCallback(window, maximized_callback);
#endif
// Load app icon // Load app icon
GLFWimage icons[10]; GLFWimage icons[10];

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <dsp/stream.h> #include <dsp/stream.h>
#include <volk.h> #include <volk/volk.h>
namespace dsp { namespace dsp {
template <class D, class I, class O, int IC, int OC> template <class D, class I, class O, int IC, int OC>

View File

@ -2,7 +2,7 @@
#include <thread> #include <thread>
#include <dsp/stream.h> #include <dsp/stream.h>
#include <dsp/types.h> #include <dsp/types.h>
#include <volk.h> #include <volk/volk.h>
#ifndef M_PI #ifndef M_PI
#define M_PI 3.1415926535f #define M_PI 3.1415926535f

View File

@ -2,7 +2,6 @@
#include <thread> #include <thread>
#include <dsp/stream.h> #include <dsp/stream.h>
#include <dsp/types.h> #include <dsp/types.h>
#include <volk.h>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
namespace dsp { namespace dsp {

View File

@ -3,12 +3,6 @@ project(soapy)
if (MSVC) if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17") set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
# 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/")
else() else()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive") set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive")
endif (MSVC) endif (MSVC)
@ -19,9 +13,18 @@ add_library(soapy SHARED ${SRC})
target_link_libraries(soapy PRIVATE sdrpp_core) target_link_libraries(soapy PRIVATE sdrpp_core)
set_target_properties(soapy PROPERTIES PREFIX "") set_target_properties(soapy PROPERTIES PREFIX "")
target_link_libraries(soapy PUBLIC SoapySDR) if (MSVC)
# Lib path
target_link_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/lib/")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Misc headers
target_include_directories(soapy PUBLIC /usr/local/opt/soapysdr/include) target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/")
target_link_directories(soapy PUBLIC /usr/local/opt/soapysdr/lib) else (MSVC)
endif () find_package(PkgConfig)
pkg_check_modules(SOAPY REQUIRED SoapySDR)
target_include_directories(soapy PUBLIC ${SOAPY_INCLUDE_DIRS})
target_link_directories(soapy PUBLIC ${SOAPY_LIBRARY_DIRS})
target_link_libraries(soapy PUBLIC ${SOAPY_LIBRARIES})
endif (MSVC)