diff --git a/CMakeLists.txt b/CMakeLists.txt
index 359c3cf3..0c7d0c4e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -180,7 +180,6 @@ set (LOOT_SRC "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.cpp"
set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/backend/app/loot_settings.h"
"${CMAKE_SOURCE_DIR}/src/backend/app/loot_state.h"
- "${CMAKE_SOURCE_DIR}/src/backend/app/loot_version.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_grammar.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/conditional_metadata.h"
@@ -209,6 +208,7 @@ set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/backend/error.h"
"${CMAKE_SOURCE_DIR}/include/loot/game_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/language_code.h"
+ "${CMAKE_SOURCE_DIR}/include/loot/loot_version.h"
"${CMAKE_SOURCE_DIR}/include/loot/message_type.h")
set (LOOT_GUI_SRC "${CMAKE_SOURCE_DIR}/src/gui/main.cpp"
@@ -419,6 +419,10 @@ ENDIF ()
IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ set_target_properties (loot_common PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_STATIC")
+ set_target_properties (tests PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_STATIC")
+ set_target_properties (LOOT PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_STATIC")
+ set_target_properties (metadata-validator PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_STATIC")
IF (BUILD_SHARED_LIBS)
set_target_properties (loot_api PROPERTIES COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} LOOT_EXPORT")
ELSE ()
diff --git a/src/backend/app/loot_version.h b/include/loot/loot_version.h
similarity index 54%
rename from src/backend/app/loot_version.h
rename to include/loot/loot_version.h
index c68b49d5..e93b8bc7 100644
--- a/src/backend/app/loot_version.h
+++ b/include/loot/loot_version.h
@@ -22,20 +22,36 @@ along with LOOT. If not, see
.
*/
-#ifndef LOOT_BACKEND_APP_LOOT_VERSION
-#define LOOT_BACKEND_APP_LOOT_VERSION
+#ifndef LOOT_LOOT_VERSION
+#define LOOT_LOOT_VERSION
#include
+/* set up dll import/export decorators
+when compiling the dll on windows, ensure LOOT_EXPORT is defined. clients
+that use this header do not need to define anything to import the symbols
+properly. */
+#if defined(_WIN32)
+# ifdef LOOT_STATIC
+# define LOOT_API
+# elif defined LOOT_EXPORT
+# define LOOT_API __declspec(dllexport)
+# else
+# define LOOT_API __declspec(dllimport)
+# endif
+#else
+# define LOOT_API
+#endif
+
namespace loot {
class LootVersion {
public:
- static const unsigned int major;
- static const unsigned int minor;
- static const unsigned int patch;
- static const std::string revision;
+ LOOT_API static const unsigned int major;
+ LOOT_API static const unsigned int minor;
+ LOOT_API static const unsigned int patch;
+ LOOT_API static const std::string revision;
- static std::string string();
+ LOOT_API static std::string string();
};
}
diff --git a/src/backend/app/loot_settings.cpp b/src/backend/app/loot_settings.cpp
index 36f11b8b..aaa84a08 100644
--- a/src/backend/app/loot_settings.cpp
+++ b/src/backend/app/loot_settings.cpp
@@ -28,7 +28,6 @@
#include
-#include "backend/app/loot_version.h"
#include "loot/loot_version.h"
using std::lock_guard;
diff --git a/src/backend/app/loot_state.cpp b/src/backend/app/loot_state.cpp
index fcaff1f6..035a456c 100644
--- a/src/backend/app/loot_state.cpp
+++ b/src/backend/app/loot_state.cpp
@@ -36,9 +36,9 @@
#include "backend/error.h"
#include "backend/app/loot_paths.h"
-#include "backend/app/loot_version.h"
#include "backend/helpers/helpers.h"
#include "backend/helpers/language.h"
+#include "loot/loot_version.h"
#ifdef _WIN32
#include
diff --git a/src/backend/app/loot_version.cpp.in b/src/backend/app/loot_version.cpp.in
index 3244bac9..91bbed7b 100644
--- a/src/backend/app/loot_version.cpp.in
+++ b/src/backend/app/loot_version.cpp.in
@@ -22,15 +22,15 @@
.
*/
-#include "backend/app/loot_version.h"
+#include "loot/loot_version.h"
namespace loot {
- const unsigned int LootVersion::major = 0;
- const unsigned int LootVersion::minor = 9;
- const unsigned int LootVersion::patch = 2;
- const std::string LootVersion::revision = "@GIT_COMMIT_STRING@";
+const unsigned int LootVersion::major = 0;
+const unsigned int LootVersion::minor = 9;
+const unsigned int LootVersion::patch = 2;
+const std::string LootVersion::revision = "@GIT_COMMIT_STRING@";
- std::string LootVersion::string() {
- return std::to_string(major) + '.' + std::to_string(minor) + '.' + std::to_string(patch);
- }
+LOOT_API std::string LootVersion::string() {
+ return std::to_string(major) + '.' + std::to_string(minor) + '.' + std::to_string(patch);
+}
}
diff --git a/src/gui/query_handler.cpp b/src/gui/query_handler.cpp
index 7a9cfd34..6b810838 100644
--- a/src/gui/query_handler.cpp
+++ b/src/gui/query_handler.cpp
@@ -43,11 +43,11 @@
#include "backend/error.h"
#include "backend/app/loot_paths.h"
-#include "backend/app/loot_version.h"
#include "backend/plugin/plugin_sorter.h"
#include "backend/helpers/helpers.h"
#include "backend/helpers/json.h"
#include "backend/helpers/version.h"
+#include "loot/loot_version.h"
using boost::filesystem::exists;
using boost::format;
diff --git a/src/tests/backend/app/loot_settings_test.h b/src/tests/backend/app/loot_settings_test.h
index a1b1da85..c884857c 100644
--- a/src/tests/backend/app/loot_settings_test.h
+++ b/src/tests/backend/app/loot_settings_test.h
@@ -29,7 +29,7 @@ along with LOOT. If not, see
#include
-#include "backend/app/loot_version.h"
+#include "loot/loot_version.h"
namespace loot {
namespace test {
diff --git a/src/tests/backend/helpers/version_test.h b/src/tests/backend/helpers/version_test.h
index c63537da..6546cf75 100644
--- a/src/tests/backend/helpers/version_test.h
+++ b/src/tests/backend/helpers/version_test.h
@@ -25,8 +25,8 @@ along with LOOT. If not, see
#ifndef LOOT_TESTS_BACKEND_HELPERS_VERSION_TEST
#define LOOT_TESTS_BACKEND_HELPERS_VERSION_TEST
-#include "backend/app/loot_version.h"
#include "backend/helpers/version.h"
+#include "loot/loot_version.h"
#include
diff --git a/src/validator/main.cpp b/src/validator/main.cpp
index 61e36c05..1c388671 100644
--- a/src/validator/main.cpp
+++ b/src/validator/main.cpp
@@ -24,7 +24,7 @@
#include
-#include "backend/app/loot_version.h"
+#include "loot/loot_version.h"
#include "backend/metadata_list.h"
int main(int argc, char **argv) {