From 22a2b7ac463e7ea339d4d57be3b770fbf09518bf Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sat, 7 Jan 2023 14:57:13 +0100 Subject: [PATCH] refactor: support system and bundled cmark Signed-off-by: Sefa Eyeoglu --- .gitmodules | 3 +++ CMakeLists.txt | 13 +++++++++++++ launcher/CMakeLists.txt | 2 +- libraries/cmark | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) create mode 160000 libraries/cmark diff --git a/.gitmodules b/.gitmodules index 95274f150..87703fee5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "libraries/extra-cmake-modules"] path = libraries/extra-cmake-modules url = https://github.com/KDE/extra-cmake-modules +[submodule "libraries/cmark"] + path = libraries/cmark + url = https://github.com/commonmark/cmark.git diff --git a/CMakeLists.txt b/CMakeLists.txt index f235a2ac2..2194317b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -266,6 +266,9 @@ if(NOT Launcher_FORCE_BUNDLED_LIBS) # Find ghc_filesystem find_package(ghc_filesystem QUIET) + + # Find cmark + find_package(cmark QUIET) endif() include(ECMQtDeclareLoggingCategory) @@ -407,6 +410,16 @@ if(NOT tomlplusplus_FOUND) else() message(STATUS "Using system tomlplusplus") endif() +if(NOT cmark_FOUND) + message(STATUS "Using bundled cmark") + set(CMARK_STATIC ON CACHE BOOL "Build static libcmark library" FORCE) + set(CMARK_SHARED OFF CACHE BOOL "Build shared libcmark library" FORCE) + set(CMARK_TESTS OFF CACHE BOOL "Build cmark tests and enable testing" FORCE) + add_subdirectory(libraries/cmark EXCLUDE_FROM_ALL) # Markdown parser + add_library(cmark::cmark ALIAS cmark_static) +else() + message(STATUS "Using system cmark") +endif() add_subdirectory(libraries/katabasis) # An OAuth2 library that tried to do too much add_subdirectory(libraries/gamemode) add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 7dc744aa9..60acc6fcb 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1043,7 +1043,7 @@ target_link_libraries(Launcher_logic ) target_link_libraries(Launcher_logic QuaZip::QuaZip - cmark + cmark::cmark LocalPeer Launcher_rainbow ) diff --git a/libraries/cmark b/libraries/cmark new file mode 160000 index 000000000..a8da5a2f2 --- /dev/null +++ b/libraries/cmark @@ -0,0 +1 @@ +Subproject commit a8da5a2f252b96eca60ae8bada1a9ba059a38401