diff options
Diffstat (limited to 'opentrack')
-rw-r--r-- | opentrack/export.hpp | 8 | ||||
-rw-r--r-- | opentrack/options.hpp | 12 | ||||
-rw-r--r-- | opentrack/plugin-support.hpp | 6 | ||||
-rw-r--r-- | opentrack/version.C | 5 | ||||
-rw-r--r-- | opentrack/version.cc | 9 |
5 files changed, 26 insertions, 14 deletions
diff --git a/opentrack/export.hpp b/opentrack/export.hpp index 8c8bdc69..f0983b75 100644 --- a/opentrack/export.hpp +++ b/opentrack/export.hpp @@ -1,7 +1,13 @@ #pragma once + #ifdef _WIN32 # define OPENTRACK_LINKAGE __declspec(dllexport) #else # define OPENTRACK_LINKAGE #endif -#define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE + +#ifndef _MSC_VER +# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE +#else +# define OPENTRACK_EXPORT OPENTRACK_LINKAGE +#endif
\ No newline at end of file diff --git a/opentrack/options.hpp b/opentrack/options.hpp index 06697631..c2fe8705 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -38,6 +38,10 @@ #include <memory> template<typename t> using mem = std::shared_ptr<t>; +#define OPENTRACK_CONFIG_FILENAME_KEY "settings-file" +#define OPENTRACK_DEFAULT_CONFIG_PATH "/settings/default.ini" +#define OPENTRACK_ORG "TrackHat opentrack-2.3" + namespace options { template<typename k, typename v> using map = std::map<k, v>; @@ -97,7 +101,6 @@ namespace options { } conf.endGroup(); } - static constexpr const char* org = "trackhat opentrack-2.3"; void save() { @@ -129,13 +132,10 @@ namespace options { return kvs.count(s) != 0; } - static constexpr const char* filename_key = "settings-file"; - static constexpr const char* default_path = "/settings/default.ini"; - static const QString ini_pathname() { - QSettings settings(group::org); - return settings.value(filename_key, QCoreApplication::applicationDirPath() + default_path).toString(); + QSettings settings(OPENTRACK_ORG); + return settings.value(OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH).toString(); } static const QStringList ini_list() diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index 1c334e14..7f2734af 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -42,7 +42,7 @@ #include <iostream> #ifdef _MSC_VER -# error "No support for MSVC anymore" +# define OPENTRACK_LIB_PREFIX "" #else # define OPENTRACK_LIB_PREFIX "lib" #endif @@ -115,7 +115,8 @@ struct dylib { { fprintf(stderr, "Error, ignoring: %s\n", err); fflush(stderr); - dlclose(handle); + if (handle) + dlclose(handle); handle = nullptr; return true; } @@ -138,6 +139,7 @@ struct dylib { return; } else { (void) _foo::err(handle); + return; } #endif diff --git a/opentrack/version.C b/opentrack/version.C deleted file mode 100644 index 0ef4ec14..00000000 --- a/opentrack/version.C +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef IN_VERSION_UNIT -# define IN_CRAPOLA_COMPILE_UNIT -volatile const char* opentrack_version = OPENTRACK_VERSION; -#else -#endif diff --git a/opentrack/version.cc b/opentrack/version.cc new file mode 100644 index 00000000..026ad057 --- /dev/null +++ b/opentrack/version.cc @@ -0,0 +1,9 @@ +#include "opentrack/export.hpp" + +#ifdef __cplusplus +extern "C" +#endif +OPENTRACK_EXPORT +volatile const char* opentrack_version; + +volatile const char* opentrack_version = OPENTRACK_VERSION; |