Support installation via CMake

This commit is contained in:
Aang23
2021-02-11 22:49:33 +01:00
parent b86cf9681c
commit 835ec716a0
17 changed files with 112 additions and 15 deletions

View 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)

View File

@ -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