summaryrefslogtreecommitdiff
blob: c543f09e3fae1332f1e4d9ae54c9db445865f628 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
https://github.com/sirjuddington/SLADE/pull/1413

diff --git a/src/Application/App.cpp b/src/Application/App.cpp
index dddaf875..ede8d73c 100644
--- a/src/Application/App.cpp
+++ b/src/Application/App.cpp
@@ -60,7 +60,7 @@
 #include "UI/WxUtils.h"
 #include "Utility/StringUtils.h"
 #include "Utility/Tokenizer.h"
-#include "thirdparty/dumb/dumb.h"
+#include <dumb.h>
 #include <filesystem>

 using namespace slade;
diff --git a/src/Audio/ModMusic.cpp b/src/Audio/ModMusic.cpp
index cc4b60cf..6d54516d 100644
--- a/src/Audio/ModMusic.cpp
+++ b/src/Audio/ModMusic.cpp
@@ -32,7 +32,7 @@
 // -----------------------------------------------------------------------------
 #include "Main.h"
 #include "ModMusic.h"
-#include "thirdparty/dumb/dumb.h"
+#include <dumb.h>

 using namespace slade;
 using namespace audio;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fef3d009..00dbb018 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -116,7 +116,6 @@ include_directories(
 	${MPG123_INCLUDE_DIR}
 	.
 	..
-	../thirdparty/dumb
 	../thirdparty/glad/include
 	./Application
 	)
@@ -235,7 +234,7 @@ else(APPLE)
 		install(FILES "${SLADE_OUTPUT_DIR}/slade.pk3"
 			DESTINATION share/slade3
 			)
-
+
 		install(FILES "${PROJECT_SOURCE_DIR}/dist/res/logo_icon.png"
 			DESTINATION share/icons/
 			RENAME net.mancubus.SLADE.png
diff --git a/src/General/CVar.cpp b/src/General/CVar.cpp
index 460a7852..5e171446 100644
--- a/src/General/CVar.cpp
+++ b/src/General/CVar.cpp
@@ -32,7 +32,7 @@
 // -----------------------------------------------------------------------------
 #include "Main.h"
 #include "Utility/StringUtils.h"
-#include "thirdparty/fmt/include/fmt/format.h"
+#include <fmt/format.h>

 using namespace slade;

diff --git a/src/General/Log.cpp b/src/General/Log.cpp
index 9ad0718f..8d39f644 100644
--- a/src/General/Log.cpp
+++ b/src/General/Log.cpp
@@ -31,8 +31,8 @@
 // -----------------------------------------------------------------------------
 #include "Main.h"
 #include "App.h"
-#include "thirdparty/fmt/include/fmt/chrono.h"
-#include "thirdparty/fmt/include/fmt/format.h"
+#include <fmt/chrono.h>
+#include <fmt/format.h>
 #include <fstream>

 using namespace slade;
diff --git a/src/TextEditor/TextStyle.cpp b/src/TextEditor/TextStyle.cpp
index 09f4e405..ad51ec0a 100644
--- a/src/TextEditor/TextStyle.cpp
+++ b/src/TextEditor/TextStyle.cpp
@@ -43,7 +43,7 @@
 #include "Utility/Parser.h"
 #include "Utility/StringUtils.h"
 #include "Utility/Tokenizer.h"
-#include "thirdparty/fmt/include/fmt/format.h"
+#include <fmt/format.h>

 using namespace slade;

diff --git a/src/UI/Browser/BrowserItem.cpp b/src/UI/Browser/BrowserItem.cpp
index 89c0f39c..3f056f71 100644
--- a/src/UI/Browser/BrowserItem.cpp
+++ b/src/UI/Browser/BrowserItem.cpp
@@ -126,7 +126,7 @@ void BrowserItem::draw(
 		// Create text box if needed
 		if (!text_box_)
 			text_box_ = std::make_unique<TextBox>(
-				fmt::format("{}\n{}", index_, name_.c_str()), font, ui::scalePx(144), ui::scalePx(16));
+				fmt::format("{}\n{}", index_, name_.mb_str()), font, ui::scalePx(144), ui::scalePx(16));

 		int top = y;
 		top += ((size - text_box_->height()) * 0.5);
diff --git a/src/UI/SToolBar/SToolBar.cpp b/src/UI/SToolBar/SToolBar.cpp
index f38710ad..c002bf97 100644
--- a/src/UI/SToolBar/SToolBar.cpp
+++ b/src/UI/SToolBar/SToolBar.cpp
@@ -219,7 +219,7 @@ void SToolBarGroup::hide(bool hide)

 	// Update 'hidden toolbars' cvar
 	string tb_hidden = toolbars_hidden;
-	auto   name      = fmt::format("[{}]", name_.c_str());
+	auto   name      = fmt::format("[{}]", name_.mb_str());
 	if (hide)
 		tb_hidden += name;
 	else
diff --git a/src/common.h b/src/common.h
index 8c3c4b3b..d66cbc04 100644
--- a/src/common.h
+++ b/src/common.h
@@ -129,7 +129,7 @@
 #endif

 // fmt
-#include "thirdparty/fmt/include/fmt/core.h"
+#include <fmt/core.h>

 // Sigslot
 #include "thirdparty/sigslot/signal.hpp"
diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt
index f84cfc8a..6cb9e0af 100644
--- a/thirdparty/CMakeLists.txt
+++ b/thirdparty/CMakeLists.txt
@@ -6,20 +6,33 @@ find_package(BZip2 REQUIRED)
 set(ZLIB_LIBRARY ${ZLIB_LIBRARY} PARENT_SCOPE)
 set(BZIP2_LIBRARIES ${BZIP2_LIBRARIES} PARENT_SCOPE)

+option(USE_SYSTEM_DUMB "Use system DUMB library" OFF)
+if(USE_SYSTEM_DUMB)
+	pkg_check_modules(DUMB REQUIRED IMPORTED_TARGET dumb>=1.0)
+else()
+	file(GLOB_RECURSE DUMB_SOURCES dumb/*.c)
+endif()
+
 # Roll the rest up into a big ball and compile it by itself
 set(EXTERNAL_SOURCES
 )
 file(GLOB_RECURSE EXTERNAL_SOURCES
-	dumb/*.c
 	lzma/C/LzmaDec.c
 	mus2mid/mus2mid.cpp
 	zreaders/*.cpp
 	glad/src/*.c
+	${DUMB_SOURCES}
 	${SLADE_HEADERS}
 	)

 # Add fmt
-add_subdirectory(fmt)
+option(USE_SYSTEM_FMT "Use system fmt library" OFF)
+if(USE_SYSTEM_FMT)
+	find_package(fmt REQUIRED)
+else()
+	add_subdirectory(fmt)
+	target_include_directories(fmt INTERFACE ${CMAKE_CURRENT_LIST_DIR}/fmt/include)
+endif()

 # Add lunasvg
 add_library(lunasvg STATIC)
@@ -29,5 +42,11 @@ add_subdirectory(lunasvg/3rdparty/software)
 add_subdirectory(lunasvg/3rdparty/plutovg)

 add_library(external STATIC ${EXTERNAL_SOURCES})
-target_link_libraries(external ${ZLIB_LIBRARY} lunasvg fmt ${CMAKE_DL_LIBS})
+target_link_libraries(external ${ZLIB_LIBRARY} lunasvg fmt::fmt ${CMAKE_DL_LIBS})
 set(EXTERNAL_LIBRARIES external PARENT_SCOPE)
+
+if(USE_SYSTEM_DUMB)
+	target_link_libraries(external PkgConfig::DUMB)
+else()
+	target_include_directories(external PUBLIC ${CMAKE_CURRENT_LIST_DIR}/dumb)
+endif()