mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
🎉 Added support for building without Conan
This commit is contained in:
parent
643aa1cd0b
commit
1a75f15498
|
@ -1,16 +1,47 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
include(FeatureSummary)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_BINARY_DIR})
|
||||
|
||||
option(USE_PACKAGE_MANAGER "Use conan for managing packages" OFF)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
SET(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/")
|
||||
SET(LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
|
||||
SET(ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
SET(LIBRARY_OUTPUT_PATH ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
if (WIN32)
|
||||
# fix executable paths for windows
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${RUNTIME_OUTPUT_DIRECTORY})
|
||||
endif()
|
||||
|
||||
project(Chatterino2)
|
||||
|
||||
include(pmm)
|
||||
pmm(CONAN REMOTES BINCRAFTERS)
|
||||
if (USE_PACKAGE_MANAGER)
|
||||
include(pmm)
|
||||
pmm(CONAN)
|
||||
else (USE_PACKAGE_MANAGER)
|
||||
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/dependencies" CACHE PATH "Path to the dependencies")
|
||||
|
||||
find_package(Boost REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
find_package(LibCommuni REQUIRED)
|
||||
find_package(Qt5keychain REQUIRED)
|
||||
find_package(Rapidjson REQUIRED)
|
||||
find_package(Signals REQUIRED)
|
||||
find_package(Settings REQUIRED)
|
||||
find_package(Serialize REQUIRED)
|
||||
find_package(Websocketpp REQUIRED)
|
||||
endif (USE_PACKAGE_MANAGER)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Humanize_INCLUDE_DIR humanize/format_string.hpp)
|
||||
|
||||
find_package_handle_standard_args(Humanize REQUIRED_VARS Humanize_INCLUDE_DIR)
|
||||
|
||||
if (Humanize_FOUND)
|
||||
add_library(Humanize::Humanize INTERFACE IMPORTED)
|
||||
set_target_properties(Humanize::Humanize PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Humanize_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(Humanize_INCLUDE_DIR)
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
find_path(IrcCore_INCLUDE_DIR irc.h PATH_SUFFIXES IrcCore)
|
||||
find_library(IrcCore_LIBRARY IrcCore)
|
||||
find_library(IrcCore_LIBRARY Core)
|
||||
|
||||
find_path(IrcModel_INCLUDE_DIR IrcModel.h PATH_SUFFIXES IrcModel)
|
||||
find_library(IrcModel_LIBRARY IrcModel)
|
||||
find_library(IrcModel_LIBRARY Model)
|
||||
|
||||
find_path(IrcUtil_INCLUDE_DIR ircutil.h PATH_SUFFIXES IrcUtil)
|
||||
find_library(IrcUtil_LIBRARY IrcUtil)
|
||||
find_library(IrcUtil_LIBRARY Util)
|
||||
|
||||
set(LibCommuni_INCLUDE_DIRS ${IrcCore_INCLUDE_DIR} ${IrcModel_INCLUDE_DIR} ${IrcUtil_INCLUDE_DIR})
|
||||
set(LibCommuni_LIBRARIES ${IrcCore_LIBRARY} ${IrcModel_LIBRARY} ${IrcUtil_LIBRARY})
|
||||
|
@ -24,6 +23,6 @@ if (LibCommuni_FOUND)
|
|||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced( LibCommuni_INCLUDE_DIRS LibCommuni_LIBRARIES
|
||||
mark_as_advanced(LibCommuni_INCLUDE_DIRS LibCommuni_LIBRARIES
|
||||
IrcCore_LIBRARY IrcModel_LIBRARY IrcUtil_LIBRARY
|
||||
IrcCore_INCLUDE_DIR IrcModel_INCLUDE_DIR IrcUtil_INCLUDE_DIR)
|
16
cmake/FindSettings.cmake
Normal file
16
cmake/FindSettings.cmake
Normal file
|
@ -0,0 +1,16 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Settings_INCLUDE_DIR pajlada/settings.hpp)
|
||||
find_library(Settings_LIBRARY PajladaSettings)
|
||||
|
||||
find_package_handle_standard_args(Settings REQUIRED_VARS Settings_INCLUDE_DIR Settings_LIBRARY)
|
||||
|
||||
if (Settings_FOUND)
|
||||
add_library(Settings::Settings INTERFACE IMPORTED)
|
||||
set_target_properties(Settings::Settings PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Settings_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${Settings_LIBRARY}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(Settings_INCLUDE_DIR Settings_LIBRARY)
|
|
@ -1,6 +1,6 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Signals_INCLUDE_DIR signals/signal.hpp PATH_SUFFIXES pajlada)
|
||||
find_path(Signals_INCLUDE_DIR pajlada/signals/signal.hpp)
|
||||
|
||||
find_package_handle_standard_args(Signals REQUIRED_VARS Signals_INCLUDE_DIR)
|
||||
|
||||
|
|
|
@ -16,4 +16,4 @@ cmake
|
|||
openssl:shared=True
|
||||
|
||||
[imports]
|
||||
bin, *.dll -> ./Chatterino2 @ keep_path=False
|
||||
bin, *.dll -> ./bin @ keep_path=False
|
197
lib/CMakeLists.txt
Normal file
197
lib/CMakeLists.txt
Normal file
|
@ -0,0 +1,197 @@
|
|||
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_QTKEYCHAIN "Build QtKeychain" ON)
|
||||
option(BUILD_RAPIDJSON "Build RapidJSON library" ON)
|
||||
option(BUILD_SERIALIZE "Build Serialize library" ON)
|
||||
option(BUILD_SETTINGS "Build Settings 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 ()
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# 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
|
||||
GIT_REPOSITORY https://github.com/Chatterino/qtkeychain.git
|
||||
GIT_TAG 308ea7e709113dc277be1653fe2044bb20236836
|
||||
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 ()
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# 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 ()
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# Settings
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
|
||||
if (BUILD_SETTINGS)
|
||||
ExternalProject_Add(
|
||||
Settings
|
||||
GIT_REPOSITORY https://github.com/AnotherFoxGuy/settings.git
|
||||
GIT_SUBMODULES_RECURSE TRUE
|
||||
GIT_TAG cmake-fix
|
||||
GIT_PROGRESS TRUE
|
||||
CMAKE_ARGS
|
||||
-DBUILD_TESTS=OFF
|
||||
-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 ()
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# WebSocketpp
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
|
||||
if (BUILD_WEBSOCKETPP)
|
||||
ExternalProject_Add(
|
||||
WebSocketpp
|
||||
GIT_REPOSITORY https://github.com/ziocleto/websocketpp.git
|
||||
GIT_TAG 1e0138c7ccedc6be859d28270ccd6195f235a94e
|
||||
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 ()
|
||||
|
||||
|
13
lib/conanfile.txt
Normal file
13
lib/conanfile.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
[requires]
|
||||
openssl/1.1.1d
|
||||
boost/1.75.0
|
||||
|
||||
[generators]
|
||||
qmake
|
||||
cmake_find_package
|
||||
|
||||
[options]
|
||||
openssl:shared=True
|
||||
|
||||
[imports]
|
||||
bin, *.dll -> ./bin @ keep_path=False
|
|
@ -2,9 +2,9 @@ include(SourceFileUtils)
|
|||
|
||||
project(chatterino)
|
||||
|
||||
IF(MSVC)
|
||||
IF (MSVC)
|
||||
ADD_DEFINITIONS("/EHsc")
|
||||
ENDIF(MSVC)
|
||||
ENDIF (MSVC)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false "*.hpp" "*.cpp" "*.ui" "*.qrc")
|
||||
|
||||
|
@ -15,8 +15,6 @@ 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) #
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE CHATTERINO_GIT_HASH=\"XD\" CHATTERINO_GIT_RELEASE=\"XD\" CHATTERINO_GIT_COMMIT=\"XD\")
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE . "${RapidJSON_INCLUDE_DIRS}")
|
||||
|
||||
include(WinToast)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
|
@ -26,16 +24,40 @@ target_link_libraries(${PROJECT_NAME}
|
|||
Qt5::Multimedia
|
||||
Qt5::Svg
|
||||
Qt5::Concurrent
|
||||
CONAN_PKG::boost
|
||||
CONAN_PKG::QtKeychain
|
||||
CONAN_PKG::rapidjson
|
||||
CONAN_PKG::openssl
|
||||
CONAN_PKG::communi
|
||||
CONAN_PKG::serialize
|
||||
CONAN_PKG::settings
|
||||
CONAN_PKG::signals
|
||||
CONAN_PKG::WebSocketpp
|
||||
WinToast
|
||||
)
|
||||
|
||||
target_precompile_headers(${PROJECT_NAME} PRIVATE PrecompiledHeader.hpp)
|
||||
if (USE_PACKAGE_MANAGER)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
CONAN_PKG::boost
|
||||
CONAN_PKG::QtKeychain
|
||||
CONAN_PKG::rapidjson
|
||||
CONAN_PKG::openssl
|
||||
CONAN_PKG::communi
|
||||
CONAN_PKG::serialize
|
||||
CONAN_PKG::settings
|
||||
CONAN_PKG::signals
|
||||
CONAN_PKG::WebSocketpp
|
||||
)
|
||||
else ()
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE . "${RapidJSON_INCLUDE_DIRS}")
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Boost::Boost
|
||||
OpenSSL::OpenSSL
|
||||
LibCommuni::LibCommuni
|
||||
Serialize::Serialize
|
||||
Settings::Settings
|
||||
Signals::Signals
|
||||
qt5keychain
|
||||
websocketpp::websocketpp
|
||||
)
|
||||
endif ()
|
||||
|
||||
target_precompile_headers(${PROJECT_NAME} PRIVATE PrecompiledHeader.hpp)
|
||||
|
||||
if (MSVC)
|
||||
add_custom_target(copy_dll
|
||||
COMMAND windeployqt $<TARGET_FILE:${PROJECT_NAME}> --release --no-compiler-runtime --no-translations --no-opengl-sw --dir ${RUNTIME_OUTPUT_DIRECTORY}
|
||||
WORKING_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY}
|
||||
)
|
||||
endif ()
|
Loading…
Reference in a new issue