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 #include 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 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 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 +#include #include 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 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( - 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 // 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()