From 722e7e133eb6d3d094f94619b58707cf6f1209d7 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 13 Jan 2024 13:27:20 +0100 Subject: [PATCH] Add boost as a submodule This can be used in builds by specifying the USE_SUBMODULE_BOOST option --- .gitmodules | 3 +++ CMakeLists.txt | 8 ++++++-- lib/boost | 1 + src/CMakeLists.txt | 18 ++++++++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 160000 lib/boost diff --git a/.gitmodules b/.gitmodules index cb1235a85..66c1bffe1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -41,3 +41,6 @@ [submodule "tools/crash-handler"] path = tools/crash-handler url = https://github.com/Chatterino/crash-handler +[submodule "lib/boost"] + path = lib/boost + url = https://github.com/boostorg/boost diff --git a/CMakeLists.txt b/CMakeLists.txt index f6b8281e1..3f6d7a7ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ option(BUILD_BENCHMARKS "Build the benchmarks for Chatterino" OFF) option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF) option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF) option(USE_SYSTEM_QTKEYCHAIN "Use system QtKeychain library" OFF) +option(USE_SUBMODULE_BOOST "Use boost from submodules" OFF) option(BUILD_WITH_QTKEYCHAIN "Build Chatterino with support for your system key chain" ON) option(USE_SYSTEM_MINIAUDIO "Build Chatterino with your system miniaudio" OFF) option(BUILD_WITH_CRASHPAD "Build chatterino with crashpad" OFF) @@ -122,8 +123,11 @@ endif () find_package(Sanitizers QUIET) -# Find boost on the system -find_package(Boost REQUIRED OPTIONAL_COMPONENTS headers) +if (USE_SUBMODULE_BOOST) + add_subdirectory(lib/boost EXCLUDE_FROM_ALL) +else () + find_package(Boost REQUIRED OPTIONAL_COMPONENTS headers) +endif () # Find OpenSSL on the system find_package(OpenSSL REQUIRED) diff --git a/lib/boost b/lib/boost new file mode 160000 index 000000000..8fa3090c9 --- /dev/null +++ b/lib/boost @@ -0,0 +1 @@ +Subproject commit 8fa3090c97542b7e0a837fc8b580268b9d76e585 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e649d312a..9b0a79eec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1002,10 +1002,20 @@ if (WIN32) WinToast) endif () -target_link_libraries(${LIBRARY_PROJECT} - PUBLIC - ${Boost_LIBRARIES} - ) +if (USE_SUBMODULE_BOOST) + target_link_libraries(${LIBRARY_PROJECT} + PUBLIC + Boost::asio + Boost::circular_buffer + Boost::signals2 + Boost::interprocess + ) +else () + target_link_libraries(${LIBRARY_PROJECT} + PUBLIC + ${Boost_LIBRARIES} + ) +endif () target_link_libraries(${LIBRARY_PROJECT} PUBLIC