cmake: use FetchContent for some dependencies (#6560)
this transition is _not_ complete, but we use FetchContent for RapidJSON, PajladaSerialize, PajladaSettings, and PajladaSignals. In the future, we can move towards providing as many of our dependencies as possible through conan & vcpkg so submodule-less builds are possible.
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
- Def: Fixed compilation error in tests with Clang 21. (#6519)
|
- Def: Fixed compilation error in tests with Clang 21. (#6519)
|
||||||
- Dev: Fixed compilation warnings on clang-cl. (#6528)
|
- Dev: Fixed compilation warnings on clang-cl. (#6528)
|
||||||
- Dev: Fixed compilation error in tests with Clang 21. (#6519)
|
- Dev: Fixed compilation error in tests with Clang 21. (#6519)
|
||||||
|
- Dev: Use CMake's `FetchContent` for RapidJSON, PajladaSignals, PajladaSerialize, and PajladaSettings. (#6560)
|
||||||
- Dev: The LuaLS meta files moved from `docs/plugin-meta.lua` to `docs/lua-meta/globals.lua`. (#6530)
|
- Dev: The LuaLS meta files moved from `docs/plugin-meta.lua` to `docs/lua-meta/globals.lua`. (#6530)
|
||||||
- Dev: Compile time definitions for `Windows.h` are now conditional based on `WIN32` instead of `MSVC`. (#6534)
|
- Dev: Compile time definitions for `Windows.h` are now conditional based on `WIN32` instead of `MSVC`. (#6534)
|
||||||
- Dev: Refactored split container nodes to use shared pointers. (#6435)
|
- Dev: Refactored split container nodes to use shared pointers. (#6435)
|
||||||
|
|||||||
+28
-14
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.15)
|
|||||||
cmake_policy(SET CMP0087 NEW) # evaluates generator expressions in `install(CODE/SCRIPT)`
|
cmake_policy(SET CMP0087 NEW) # evaluates generator expressions in `install(CODE/SCRIPT)`
|
||||||
cmake_policy(SET CMP0091 NEW) # select MSVC runtime library through `CMAKE_MSVC_RUNTIME_LIBRARY`
|
cmake_policy(SET CMP0091 NEW) # select MSVC runtime library through `CMAKE_MSVC_RUNTIME_LIBRARY`
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH
|
list(APPEND CMAKE_MODULE_PATH
|
||||||
"${CMAKE_SOURCE_DIR}/cmake"
|
"${CMAKE_SOURCE_DIR}/cmake"
|
||||||
@@ -195,8 +196,6 @@ if (BUILD_WITH_QTKEYCHAIN)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(RapidJSON REQUIRED)
|
|
||||||
|
|
||||||
find_package(Websocketpp REQUIRED)
|
find_package(Websocketpp REQUIRED)
|
||||||
|
|
||||||
if (BUILD_TESTS)
|
if (BUILD_TESTS)
|
||||||
@@ -224,23 +223,38 @@ if (BUILD_BENCHMARKS)
|
|||||||
find_package(benchmark REQUIRED)
|
find_package(benchmark REQUIRED)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
find_package(PajladaSerialize REQUIRED)
|
FetchContent_Declare(
|
||||||
find_package(PajladaSignals REQUIRED)
|
rapidjson
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/rapidjson
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
FIND_PACKAGE_ARGS NAMES RapidJSON
|
||||||
|
)
|
||||||
|
set(RAPIDJSON_BUILD_EXAMPLES Off CACHE INTERNAL "")
|
||||||
|
set(RAPIDJSON_BUILD_TESTS Off CACHE INTERNAL "")
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
PajladaSignals
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/signals
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
|
FetchContent_Declare(
|
||||||
|
PajladaSerialize
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/serialize
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
|
FetchContent_Declare(
|
||||||
|
PajladaSettings
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/settings
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(rapidjson PajladaSignals PajladaSerialize PajladaSettings)
|
||||||
|
|
||||||
find_package(LRUCache REQUIRED)
|
find_package(LRUCache REQUIRED)
|
||||||
find_package(MagicEnum REQUIRED)
|
find_package(MagicEnum REQUIRED)
|
||||||
find_package(Doxygen)
|
find_package(Doxygen)
|
||||||
find_package(BoostCertify REQUIRED)
|
find_package(BoostCertify REQUIRED)
|
||||||
|
|
||||||
if (USE_SYSTEM_PAJLADA_SETTINGS)
|
|
||||||
find_package(PajladaSettings REQUIRED)
|
|
||||||
else()
|
|
||||||
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/lib/settings/CMakeLists.txt")
|
|
||||||
message(FATAL_ERROR "Submodules probably not loaded, unable to find lib/settings/CMakeLists.txt")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory("${CMAKE_SOURCE_DIR}/lib/settings" EXCLUDE_FROM_ALL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CHATTERINO_PLUGINS)
|
if (CHATTERINO_PLUGINS)
|
||||||
set(LUA_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/lib/lua/src")
|
set(LUA_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/lib/lua/src")
|
||||||
add_subdirectory(lib/lua)
|
add_subdirectory(lib/lua)
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
find_path(PajladaSerialize_INCLUDE_DIR pajlada/serialize.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/serialize/include)
|
|
||||||
|
|
||||||
find_package_handle_standard_args(PajladaSerialize DEFAULT_MSG PajladaSerialize_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if (PajladaSerialize_FOUND)
|
|
||||||
add_library(Pajlada::Serialize INTERFACE IMPORTED)
|
|
||||||
set_target_properties(Pajlada::Serialize PROPERTIES
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${PajladaSerialize_INCLUDE_DIR}"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
mark_as_advanced(PajladaSerialize_INCLUDE_DIR)
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
find_path(PajladaSettings_INCLUDE_DIR pajlada/settings.hpp)
|
|
||||||
find_library(PajladaSettings_LIBRARY PajladaSettings)
|
|
||||||
|
|
||||||
find_package_handle_standard_args(PajladaSettings DEFAULT_MSG PajladaSettings_INCLUDE_DIR PajladaSettings_LIBRARY)
|
|
||||||
|
|
||||||
if (PajladaSettings_FOUND)
|
|
||||||
add_library(Pajlada::Settings INTERFACE IMPORTED)
|
|
||||||
set_target_properties(Pajlada::Settings PROPERTIES
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${PajladaSettings_INCLUDE_DIR}"
|
|
||||||
INTERFACE_LINK_LIBRARIES "${PajladaSettings_LIBRARY}"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
mark_as_advanced(PajladaSettings_INCLUDE_DIR PajladaSettings_LIBRARY)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
find_path(PajladaSignals_INCLUDE_DIR pajlada/signals/signal.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/signals/include)
|
|
||||||
|
|
||||||
find_package_handle_standard_args(PajladaSignals DEFAULT_MSG PajladaSignals_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if (PajladaSignals_FOUND)
|
|
||||||
add_library(Pajlada::Signals INTERFACE IMPORTED)
|
|
||||||
set_target_properties(Pajlada::Signals PROPERTIES
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${PajladaSignals_INCLUDE_DIR}"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
mark_as_advanced(PajladaSignals_INCLUDE_DIR)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
find_path(RapidJSON_INCLUDE_DIR rapidjson/rapidjson.h HINTS ${CMAKE_SOURCE_DIR}/lib/rapidjson/include)
|
|
||||||
|
|
||||||
find_package_handle_standard_args(RapidJSON DEFAULT_MSG RapidJSON_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if (RapidJSON_FOUND)
|
|
||||||
add_library(RapidJSON::RapidJSON INTERFACE IMPORTED)
|
|
||||||
set_target_properties(RapidJSON::RapidJSON PROPERTIES
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${RapidJSON_INCLUDE_DIR}"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
mark_as_advanced(RapidJSON_INCLUDE_DIR)
|
|
||||||
+1
-1
Submodule lib/rapidjson updated: d87b698d0f...24b5e7a8b2
+1
-1
Submodule lib/serialize updated: 17946d65a4...bfbf304924
+1
-1
Submodule lib/settings updated: 9b5c05ee21...8620c42684
+1
-1
Submodule lib/signals updated: d06770649a...4b127541d3
+11
-3
@@ -873,6 +873,17 @@ if (CHATTERINO_GENERATE_COVERAGE)
|
|||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if(TARGET rapidjson)
|
||||||
|
message(DEBUG "Linking to rapidjson target")
|
||||||
|
target_link_libraries(${LIBRARY_PROJECT} PUBLIC rapidjson)
|
||||||
|
elseif(DEFINED RapidJSON_SOURCE_DIR)
|
||||||
|
message(DEBUG "RapidJSON_SOURCE_DIR defined, assuming this is a submodule/source build. (${RapidJSON_SOURCE_DIR})")
|
||||||
|
target_include_directories(${LIBRARY_PROJECT} SYSTEM PUBLIC ${RapidJSON_SOURCE_DIR}/include)
|
||||||
|
else()
|
||||||
|
message(DEBUG "No rapidjson target found, this is most likely a system install. Adding include directories (${RAPIDJSON_INCLUDE_DIRS}) instead")
|
||||||
|
target_include_directories(${LIBRARY_PROJECT} SYSTEM PUBLIC ${RAPIDJSON_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${LIBRARY_PROJECT}
|
target_link_libraries(${LIBRARY_PROJECT}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
Qt${MAJOR_QT_VERSION}::Core
|
Qt${MAJOR_QT_VERSION}::Core
|
||||||
@@ -888,7 +899,6 @@ target_link_libraries(${LIBRARY_PROJECT}
|
|||||||
Pajlada::Signals
|
Pajlada::Signals
|
||||||
websocketpp::websocketpp
|
websocketpp::websocketpp
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
RapidJSON::RapidJSON
|
|
||||||
LRUCache
|
LRUCache
|
||||||
MagicEnum
|
MagicEnum
|
||||||
$<$<BOOL:${WIN32}>:Wtsapi32>
|
$<$<BOOL:${WIN32}>:Wtsapi32>
|
||||||
@@ -1194,8 +1204,6 @@ target_link_libraries(${LIBRARY_PROJECT}
|
|||||||
OpenSSL::Crypto
|
OpenSSL::Crypto
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${RapidJSON_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
if (LIBRT)
|
if (LIBRT)
|
||||||
target_link_libraries(${LIBRARY_PROJECT}
|
target_link_libraries(${LIBRARY_PROJECT}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ template <typename T>
|
|||||||
struct SignalVectorItemEvent;
|
struct SignalVectorItemEvent;
|
||||||
|
|
||||||
template <typename TVectorItem>
|
template <typename TVectorItem>
|
||||||
class SignalVectorModel : public QAbstractTableModel,
|
class SignalVectorModel : public QAbstractTableModel
|
||||||
pajlada::Signals::SignalHolder
|
|
||||||
{
|
{
|
||||||
|
pajlada::Signals::SignalHolder signalHolder;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SignalVectorModel(int columnCount, QObject *parent = nullptr)
|
SignalVectorModel(int columnCount, QObject *parent = nullptr)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
@@ -66,9 +67,9 @@ public:
|
|||||||
insert(args);
|
insert(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->managedConnect(vec->itemInserted, insert);
|
this->signalHolder.managedConnect(vec->itemInserted, insert);
|
||||||
|
|
||||||
this->managedConnect(vec->itemRemoved, [this](auto args) {
|
this->signalHolder.managedConnect(vec->itemRemoved, [this](auto args) {
|
||||||
if (args.caller == this)
|
if (args.caller == this)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user