mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-26 02:48:31 +01:00
Merge pull request #66 from Aang23/master
Support installation via CMake
This commit is contained in:
commit
f879a775f8
@ -85,3 +85,19 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
endif ()
|
||||
|
||||
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
|
||||
|
||||
# Default to /usr for CMAKE_INSTALL_PREFIX
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Default install prefix" FORCE)
|
||||
endif()
|
||||
|
||||
# Install directives
|
||||
install(TARGETS sdrpp DESTINATION bin)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/bandplans DESTINATION share/sdrpp)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/colormaps DESTINATION share/sdrpp)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/fonts DESTINATION share/sdrpp)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/icons DESTINATION share/sdrpp)
|
||||
|
||||
# Create uninstall target
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY)
|
||||
add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
@ -29,3 +29,6 @@ else (MSVC)
|
||||
target_link_directories(airspy_source PUBLIC ${LIBAIRSPYHF_LIBRARY_DIRS})
|
||||
target_link_libraries(airspy_source PUBLIC ${LIBAIRSPYHF_LIBRARIES})
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS airspy_source DESTINATION lib/sdrpp/plugins)
|
@ -29,3 +29,6 @@ else (MSVC)
|
||||
target_link_directories(airspyhf_source PUBLIC ${LIBAIRSPYHF_LIBRARY_DIRS})
|
||||
target_link_libraries(airspyhf_source PUBLIC ${LIBAIRSPYHF_LIBRARIES})
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS airspyhf_source DESTINATION lib/sdrpp/plugins)
|
@ -30,3 +30,6 @@ else (MSVC)
|
||||
target_link_libraries(sdrpp_core PUBLIC ${PORTAUDIO_LIBRARIES})
|
||||
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS audio_sink DESTINATION lib/sdrpp/plugins)
|
32
cmake_uninstall.cmake.in
Normal file
32
cmake_uninstall.cmake.in
Normal file
@ -0,0 +1,32 @@
|
||||
# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
|
||||
|
||||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||
FOREACH(file ${files})
|
||||
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
IF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
ENDIF(NOT "${rm_retval}" STREQUAL 0)
|
||||
ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
ENDIF(NOT "${rm_retval}" STREQUAL 0)
|
||||
ELSE(EXISTS "$ENV{DESTDIR}${file}")
|
||||
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
ENDFOREACH(file)
|
@ -10,6 +10,9 @@ else()
|
||||
endif (MSVC)
|
||||
add_definitions(-DSDRPP_IS_CORE)
|
||||
|
||||
# Set the install prefix
|
||||
add_compile_definitions(INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Main code
|
||||
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")
|
||||
|
||||
@ -88,3 +91,6 @@ endif ()
|
||||
set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)
|
||||
|
||||
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
|
||||
|
||||
# Install directives
|
||||
install(TARGETS sdrpp_core DESTINATION lib)
|
@ -28,6 +28,10 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef INSTALL_PREFIX
|
||||
#define INSTALL_PREFIX "/usr"
|
||||
#endif
|
||||
|
||||
namespace core {
|
||||
ConfigManager configManager;
|
||||
ScriptManager scriptManager;
|
||||
@ -146,8 +150,8 @@ int sdrpp_main(int argc, char *argv[]) {
|
||||
defConfig["modulesDirectory"] = "./modules";
|
||||
defConfig["resourcesDirectory"] = "./res";
|
||||
#else
|
||||
defConfig["modulesDirectory"] = "/usr/lib/sdrpp/plugins";
|
||||
defConfig["resourcesDirectory"] = "/usr/share/sdrpp";
|
||||
defConfig["modulesDirectory"] = (std::string)INSTALL_PREFIX + "/lib/sdrpp/plugins";
|
||||
defConfig["resourcesDirectory"] = (std::string)INSTALL_PREFIX + "/share/sdrpp";
|
||||
#endif
|
||||
|
||||
// Load config
|
||||
|
@ -14,3 +14,6 @@ file(GLOB SRC "src/*.cpp")
|
||||
add_library(file_source SHARED ${SRC})
|
||||
target_link_libraries(file_source PRIVATE sdrpp_core)
|
||||
set_target_properties(file_source PROPERTIES PREFIX "")
|
||||
|
||||
# Install directives
|
||||
install(TARGETS file_source DESTINATION lib/sdrpp/plugins)
|
@ -29,3 +29,6 @@ else (MSVC)
|
||||
target_link_directories(hackrf_source PUBLIC ${LIBHACKRF_LIBRARY_DIRS})
|
||||
target_link_libraries(hackrf_source PUBLIC ${LIBHACKRF_LIBRARIES})
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS hackrf_source DESTINATION lib/sdrpp/plugins)
|
@ -36,3 +36,6 @@ else (MSVC)
|
||||
target_link_directories(plutosdr_source PUBLIC ${LIBAD9361_LIBRARY_DIRS})
|
||||
target_link_libraries(plutosdr_source PUBLIC ${LIBAD9361_LIBRARIES})
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS plutosdr_source DESTINATION lib/sdrpp/plugins)
|
@ -14,3 +14,6 @@ include_directories("src/")
|
||||
add_library(radio SHARED ${SRC})
|
||||
target_link_libraries(radio PRIVATE sdrpp_core)
|
||||
set_target_properties(radio PROPERTIES PREFIX "")
|
||||
|
||||
# Install directives
|
||||
install(TARGETS radio DESTINATION lib/sdrpp/plugins)
|
@ -14,3 +14,6 @@ include_directories("src/")
|
||||
add_library(recorder SHARED ${SRC})
|
||||
target_link_libraries(recorder PRIVATE sdrpp_core)
|
||||
set_target_properties(recorder PROPERTIES PREFIX "")
|
||||
|
||||
# Install directives
|
||||
install(TARGETS recorder DESTINATION lib/sdrpp/plugins)
|
@ -18,3 +18,6 @@ set_target_properties(rtl_tcp_source PROPERTIES PREFIX "")
|
||||
if(WIN32)
|
||||
target_link_libraries(rtl_tcp_source PRIVATE wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
# Install directives
|
||||
install(TARGETS rtl_tcp_source DESTINATION lib/sdrpp/plugins)
|
@ -15,3 +15,6 @@ file(GLOB CYAPI "src/CyAPI/*.cpp")
|
||||
add_library(rx888_source SHARED ${SRC} ${CYAPI})
|
||||
target_link_libraries(rx888_source PRIVATE sdrpp_core)
|
||||
set_target_properties(rx888_source PROPERTIES PREFIX "")
|
||||
|
||||
# Install directives
|
||||
install(TARGETS rx888_source DESTINATION lib/sdrpp/plugins)
|
@ -30,3 +30,6 @@ else (MSVC)
|
||||
target_link_directories(sdrplay_source PUBLIC ${LIBSDRPLAY_LIBRARY_DIRS})
|
||||
target_link_libraries(sdrplay_source PUBLIC ${LIBSDRPLAY_LIBRARIES})
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS sdrplay_source DESTINATION lib/sdrpp/plugins)
|
@ -30,3 +30,6 @@ else (MSVC)
|
||||
target_link_directories(soapy_source PUBLIC ${SOAPY_LIBRARY_DIRS})
|
||||
target_link_libraries(soapy_source PUBLIC ${SOAPY_LIBRARIES})
|
||||
endif (MSVC)
|
||||
|
||||
# Install directives
|
||||
install(TARGETS soapy_source DESTINATION lib/sdrpp/plugins)
|
@ -18,3 +18,6 @@ set_target_properties(spyserver_source PROPERTIES PREFIX "")
|
||||
if(WIN32)
|
||||
target_link_libraries(spyserver_source PRIVATE wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
# Install directives
|
||||
install(TARGETS spyserver_source DESTINATION lib/sdrpp/plugins)
|
Loading…
Reference in New Issue
Block a user