diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f48d5251..69163945b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,24 @@ cmake_minimum_required(VERSION 3.8) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/lib ${CMAKE_BINARY_DIR}) -set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/dependencies" CACHE PATH "Path to the dependencies") include(FeatureSummary) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + project(Chatterino2) +include(pmm) +pmm(CONAN REMOTES BINCRAFTERS) + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Multimedia Svg Concurrent) -#include(pmm) -#pmm(CONAN REMOTES BINCRAFTERS) - add_subdirectory(src) -add_subdirectory(tests) +#add_subdirectory(tests) feature_summary(WHAT ALL) \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt index c5bbd25db..3f1488b26 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,10 +1,14 @@ [requires] openssl/1.1.1d -boost/1.71.0 +boost/1.75.0 +communi/3.6.0@test/test +serialize/0.1@test/test +QtKeychain/0.12.90@test/test +signals/0.1@test/test +WebSocketpp/0.8.1@test/test [generators] -qmake -cmake_find_package +cmake [options] openssl:shared=True diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index 3b5685447..000000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,186 +0,0 @@ -cmake_minimum_required(VERSION 3.2) - -# ------------------------------------------------------------------------------------------------# -# The intention of this script is to provide a simple solution for building all dependencies -# required for Chatterino2. It is in fact a super- or meta-build project which makes use of -# the ExternalProject module of CMake to build the individual dependencies. -# ------------------------------------------------------------------------------------------------# - -project(chatterino2-dependencies VERSION 1) - - -# ------------------------------------------------------------------------------------------------# -# Options to enable/disable building specific dependencies -# ------------------------------------------------------------------------------------------------# - -# Options with same default value on all platforms -option(BUILD_HUMANIZE "Build Humanize IRC framework" ON) -option(BUILD_QTKEYCHAIN "Build QtKeychain" ON) -option(BUILD_RAPIDJSON "Build RapidJSON library" ON) -option(BUILD_SERIALIZE "Build Serialize library" ON) -option(BUILD_SIGNALS "Build Signals library" ON) -option(BUILD_WEBSOCKETPP "Build WebSocketpp library" ON) - -# ------------------------------------------------------------------------------------------------# -# General setup and initialization -# ------------------------------------------------------------------------------------------------# - -include(ExternalProject) - -# Set the EP_BASE directory property to setup the build directory structure (see the -# ExternalProject documentation for more information) -set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}) - -# Determine the name for the output directory where dependencies are going to be installed -if (WIN32) - set(DEPENDENCIES_OUTPUT_DIR ${CMAKE_BINARY_DIR}/Dependencies_${CMAKE_SYSTEM_NAME}_${CMAKE_GENERATOR}) - string(REPLACE " " "-" DEPENDENCIES_OUTPUT_DIR ${DEPENDENCIES_OUTPUT_DIR}) -else () - set(DEPENDENCIES_OUTPUT_DIR ${CMAKE_BINARY_DIR}/Dependencies_${CMAKE_SYSTEM_NAME}) -endif () - -if (MSVC) - set(DEPENDENCIES_INCLUDE_DIR ${DEPENDENCIES_OUTPUT_DIR}/include) - set(DEPENDENCIES_LIB_DIR ${DEPENDENCIES_OUTPUT_DIR}/lib) - set(DEPENDENCIES_BIN_DIR ${DEPENDENCIES_OUTPUT_DIR}/bin) -else () - set(DEPENDENCIES_INCLUDE_DIR ${DEPENDENCIES_OUTPUT_DIR}/include) - set(DEPENDENCIES_LIB_DIR ${DEPENDENCIES_OUTPUT_DIR}/lib/${CMAKE_BUILD_TYPE}) - set(DEPENDENCIES_BIN_DIR ${DEPENDENCIES_OUTPUT_DIR}/bin/${CMAKE_BUILD_TYPE}) -endif () - -file(MAKE_DIRECTORY ${DEPENDENCIES_INCLUDE_DIR}) -file(MAKE_DIRECTORY ${DEPENDENCIES_LIB_DIR}) -file(MAKE_DIRECTORY ${DEPENDENCIES_BIN_DIR}) - -# On Linux some packages rely on pkgconfig to be found correctly. Therefore the environment variable -# needs to be set up accordingly. In addition when building depedencies which need to find other -# dependencies (e.g. MyGUI searching for OGRE) PKG_CONFIG_USE_CMAKE_PREFIX_PATH needs to be set to TRUE. -if (UNIX) - set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPENDENCIES_LIB_DIR}/pkgconfig") -endif () - -# ------------------------------------------------------------------------------------------------# -# Humanize -# ------------------------------------------------------------------------------------------------# - -if (BUILD_HUMANIZE) - ExternalProject_Add( - Humanize - DOWNLOAD_COMMAND "" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/humanize" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/humanize/include/humanize ${DEPENDENCIES_OUTPUT_DIR}/include/humanize - ) -endif () - - -# ------------------------------------------------------------------------------------------------# -# LibCommuni -# ------------------------------------------------------------------------------------------------# - -if (BUILD_LIBCOMMUNI) - ExternalProject_Add( - LibCommuni - GIT_REPOSITORY https://github.com/AnotherFoxGuy/libcommuni-cmake.git - GIT_SHALLOW TRUE - GIT_PROGRESS TRUE - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ) -endif () - -# ------------------------------------------------------------------------------------------------# -# QtKeychain -# ------------------------------------------------------------------------------------------------# -if (BUILD_QTKEYCHAIN) - ExternalProject_Add( - QtKeychain - DOWNLOAD_COMMAND "" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/qtkeychain" - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ) -endif () - - -# ------------------------------------------------------------------------------------------------# -# RapidJSON -# ------------------------------------------------------------------------------------------------# -if (BUILD_RAPIDJSON) - ExternalProject_Add( - RapidJSON - DOWNLOAD_COMMAND "" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/rapidjson" - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR} - -DINCLUDE_INSTALL_DIR=${DEPENDENCIES_OUTPUT_DIR}/include # rapidjson will add "rapidjson" subdirectory - -DRAPIDJSON_BUILD_DOC=NO - -DRAPIDJSON_BUILD_EXAMPLES=NO - -DRAPIDJSON_BUILD_TESTS=NO - -DRAPIDJSON_BUILD_THIRDPARTY_GTEST=NO - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ) -endif () - -# ------------------------------------------------------------------------------------------------# -# Serialize -# ------------------------------------------------------------------------------------------------# - -if (BUILD_SERIALIZE) - ExternalProject_Add( - Serialize - DOWNLOAD_COMMAND "" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/serialize" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/serialize/include ${DEPENDENCIES_OUTPUT_DIR}/include - ) -endif () - -# ------------------------------------------------------------------------------------------------# -# Signals -# ------------------------------------------------------------------------------------------------# - -if (BUILD_SIGNALS) - ExternalProject_Add( - Signals - DOWNLOAD_COMMAND "" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/signals" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/signals/include ${DEPENDENCIES_OUTPUT_DIR}/include - ) -endif () - -# ------------------------------------------------------------------------------------------------# -# WebSocketpp -# ------------------------------------------------------------------------------------------------# - -if (BUILD_WEBSOCKETPP) - ExternalProject_Add( - WebSocketpp - DOWNLOAD_COMMAND "" - SOURCE_DIR "${CMAKE_SOURCE_DIR}/websocketpp" - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ) -endif () - - diff --git a/lib/Settings.cmake b/lib/Settings.cmake deleted file mode 100644 index 22bb63520..000000000 --- a/lib/Settings.cmake +++ /dev/null @@ -1,9 +0,0 @@ -project(PajladaSettings) - -add_library(Settings ${CMAKE_SOURCE_DIR}/lib/settings/src/settings/settingdata.cpp - ${CMAKE_SOURCE_DIR}/lib/settings/src/settings/settingmanager.cpp - ${CMAKE_SOURCE_DIR}/lib/settings/src/settings/detail/realpath.cpp) - -target_include_directories(Settings PRIVATE ${RapidJSON_INCLUDE_DIRS} ${Serialize_INCLUDE_DIR}) -target_include_directories(Settings PUBLIC ${CMAKE_SOURCE_DIR}/lib/settings/include/) -target_link_libraries(Settings Serialize::Serialize) \ No newline at end of file diff --git a/lib/WinToast.cmake b/lib/WinToast.cmake deleted file mode 100644 index 501307f21..000000000 --- a/lib/WinToast.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(WinToast ${CMAKE_SOURCE_DIR}/lib/WinToast/src/wintoastlib.cpp) -target_include_directories(WinToast PUBLIC "${CMAKE_SOURCE_DIR}/lib/WinToast/src/") \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 185fa67aa..80f228b3e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,20 +1,5 @@ include(SourceFileUtils) -find_package(Boost REQUIRED) -find_package(OpenSSL REQUIRED) - -find_package(Humanize REQUIRED) -#find_package(LibCommuni REQUIRED) -find_package(Qt5keychain REQUIRED) -find_package(Rapidjson REQUIRED) -find_package(Signals REQUIRED) -find_package(Serialize REQUIRED) -find_package(Websocketpp REQUIRED) - -include(Settings) -include(LibCommuni) -include(WinToast) - project(chatterino) IF(MSVC) @@ -25,10 +10,6 @@ file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false "*.hpp" generate_source_groups(${SOURCE_FILES}) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO UNICODE USEWINSDK AB_CUSTOM_THEME AB_CUSTOM_SETTINGS IRC_STATIC IRC_NAMESPACE=Communi) # @@ -36,8 +17,6 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_GIT_HASH=\"XD\" CH target_include_directories(${PROJECT_NAME} PRIVATE . "${RapidJSON_INCLUDE_DIRS}") -target_link_libraries(${PROJECT_NAME} Settings WinToast qt5keychain) - target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Widgets @@ -45,13 +24,13 @@ target_link_libraries(${PROJECT_NAME} Qt5::Multimedia Qt5::Svg Qt5::Concurrent - Boost::Boost - OpenSSL::OpenSSL - Humanize::Humanize - LibCommuni::LibCommuni - Serialize::Serialize - Signals::Signals - websocketpp::websocketpp + CONAN_PKG::boost + CONAN_PKG::QtKeychain + CONAN_PKG::openssl + CONAN_PKG::communi + CONAN_PKG::serialize + CONAN_PKG::signals + CONAN_PKG::WebSocketpp ) target_precompile_headers(${PROJECT_NAME} PRIVATE PrecompiledHeader.hpp) \ No newline at end of file