mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-10-09 07:19:53 +02:00
Final work on MacOS compatibility
This commit is contained in:
@@ -5,6 +5,10 @@ if (USE_INTERNAL_LIBCORRECT)
|
||||
add_subdirectory("libcorrect/")
|
||||
endif (USE_INTERNAL_LIBCORRECT)
|
||||
|
||||
if (USE_DOTAPP_DEFAULTS)
|
||||
add_definitions(-DMACOS_DOTAPP)
|
||||
endif (USE_DOTAPP_DEFAULTS)
|
||||
|
||||
# Main code
|
||||
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")
|
||||
|
||||
@@ -25,7 +29,6 @@ else ()
|
||||
target_compile_options(sdrpp_core PRIVATE -O3 -std=c++17)
|
||||
endif ()
|
||||
|
||||
|
||||
# Set the install prefix
|
||||
target_compile_definitions(sdrpp_core PUBLIC INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
|
@@ -102,6 +102,12 @@ static void maximized_callback(GLFWwindow* window, int n) {
|
||||
int sdrpp_main(int argc, char *argv[]) {
|
||||
spdlog::info("SDR++ v" VERSION_STR);
|
||||
|
||||
#ifdef MACOS_DOTAPP
|
||||
// If this is a MacOS .app, CD to the correct directory
|
||||
auto execPath = std::filesystem::absolute(argv[0]);
|
||||
chdir(execPath.parent_path().string().c_str());
|
||||
#endif
|
||||
|
||||
// Load default options and parse command line
|
||||
options::loadDefaults();
|
||||
if (!options::parse(argc, argv)) { return -1; }
|
||||
@@ -239,9 +245,12 @@ int sdrpp_main(int argc, char *argv[]) {
|
||||
|
||||
defConfig["vfoColors"]["Radio"] = "#FFFFFF";
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
defConfig["modulesDirectory"] = "./modules";
|
||||
defConfig["resourcesDirectory"] = "./res";
|
||||
#elif defined(MACOS_DOTAPP)
|
||||
defConfig["modulesDirectory"] = "../Plugins";
|
||||
defConfig["resourcesDirectory"] = "../Resources";
|
||||
#else
|
||||
defConfig["modulesDirectory"] = INSTALL_PREFIX "/lib/sdrpp/plugins";
|
||||
defConfig["resourcesDirectory"] = INSTALL_PREFIX "/share/sdrpp";
|
||||
|
@@ -6,9 +6,12 @@ namespace options {
|
||||
CMDLineOptions opts;
|
||||
|
||||
void loadDefaults() {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
opts.root = ".";
|
||||
opts.showConsole = false;
|
||||
#elif defined(MACOS_DOTAPP)
|
||||
std::string homedir = getenv("HOME");
|
||||
opts.root = homedir + "/Library/Application Support/sdrpp";
|
||||
#else
|
||||
std::string homedir = getenv("HOME");
|
||||
opts.root = homedir + "/.config/sdrpp";
|
||||
|
Reference in New Issue
Block a user