mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
🚧 cmake build
This commit is contained in:
parent
f53b0a9e0f
commit
95b6879661
17 changed files with 653 additions and 78 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -27,6 +27,7 @@ ui_*.h
|
|||
Makefile*
|
||||
*build-*/
|
||||
/build/
|
||||
/_build/
|
||||
|
||||
# QtCreator
|
||||
|
||||
|
@ -78,3 +79,7 @@ Thumbs.db
|
|||
|
||||
# Other editors/IDEs
|
||||
.vscode
|
||||
|
||||
.idea/
|
||||
|
||||
dependencies/
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
CMAKE_PREFIX_PATH
|
||||
# Building on Windows
|
||||
|
||||
**Note that installing all the development prerequisites and libraries will require about 30 GB of free disk space. Please ensure this space is available on your `C:` drive before proceeding.**
|
||||
|
|
|
@ -1,84 +1,20 @@
|
|||
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)
|
||||
|
||||
project(chatterino)
|
||||
project(Chatterino2)
|
||||
|
||||
include_directories(src)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(chatterino_SOURCES
|
||||
src/common/NetworkRequest.cpp
|
||||
src/common/NetworkResult.cpp
|
||||
src/common/NetworkPrivate.cpp
|
||||
src/common/NetworkManager.cpp
|
||||
src/common/QLogging.cpp
|
||||
src/common/Modes.cpp
|
||||
src/common/ChatterinoSetting.cpp
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Multimedia Svg Concurrent)
|
||||
|
||||
src/util/DebugCount.cpp
|
||||
#include(pmm)
|
||||
#pmm(CONAN REMOTES BINCRAFTERS)
|
||||
|
||||
src/singletons/Paths.cpp
|
||||
|
||||
src/BaseSettings.cpp
|
||||
|
||||
src/common/UsernameSet.cpp
|
||||
src/controllers/highlights/HighlightPhrase.cpp
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
|
||||
|
||||
src/providers/emoji/Emojis.cpp
|
||||
|
||||
src/messages/Emote.cpp
|
||||
src/messages/Image.cpp
|
||||
src/messages/ImageSet.cpp
|
||||
src/util/RapidjsonHelpers.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/resources/resources.qrc
|
||||
${CMAKE_CURRENT_LIST_DIR}/resources/resources_autogenerated.qrc
|
||||
)
|
||||
|
||||
find_package(Qt5 5.9.0 REQUIRED COMPONENTS
|
||||
Core Widgets Network Concurrent
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
set(BUILD_TESTS OFF)
|
||||
message("++ Tests enabled")
|
||||
find_package(GTest)
|
||||
enable_testing()
|
||||
|
||||
add_executable(chatterino-test
|
||||
${chatterino_SOURCES}
|
||||
|
||||
tests/src/main.cpp
|
||||
tests/src/Emojis.cpp
|
||||
tests/src/NetworkRequest.cpp
|
||||
tests/src/UsernameSet.cpp
|
||||
tests/src/HighlightPhrase.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(chatterino-test PRIVATE CHATTERINO_GIT_HASH="test" AB_CUSTOM_SETTINGS CHATTERINO_TEST)
|
||||
|
||||
target_link_libraries(chatterino-test Qt5::Core Qt5::Widgets Qt5::Network Qt5::Concurrent)
|
||||
|
||||
target_link_libraries(chatterino-test gtest gtest_main)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/settings)
|
||||
target_link_libraries(chatterino-test PajladaSettings)
|
||||
target_include_directories(chatterino-test PUBLIC PajladaSettings)
|
||||
|
||||
find_package(Threads)
|
||||
|
||||
target_link_libraries(chatterino-test Threads::Threads)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/serialize PajladaSerialize)
|
||||
|
||||
target_link_libraries(chatterino-test PajladaSerialize)
|
||||
|
||||
set_property(TARGET chatterino-test PROPERTY CXX_STANDARD 17)
|
||||
set_property(TARGET chatterino-test PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# gtest_discover_tests(chatterino-test)
|
||||
else()
|
||||
message(FATAL_ERROR "This cmake file is only intended for tests right now. Use qmake to build chatterino2")
|
||||
endif()
|
||||
feature_summary(WHAT ALL)
|
14
cmake/FindHumanize.cmake
Normal file
14
cmake/FindHumanize.cmake
Normal file
|
@ -0,0 +1,14 @@
|
|||
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)
|
29
cmake/FindLibcommuni.cmake
Normal file
29
cmake/FindLibcommuni.cmake
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
find_path(IrcCore_INCLUDE_DIR irc.h PATH_SUFFIXES IrcCore)
|
||||
find_library(IrcCore_LIBRARY IrcCore)
|
||||
|
||||
find_path(IrcModel_INCLUDE_DIR IrcModel.h PATH_SUFFIXES IrcModel)
|
||||
find_library(IrcModel_LIBRARY IrcModel)
|
||||
|
||||
find_path(IrcUtil_INCLUDE_DIR ircutil.h PATH_SUFFIXES IrcUtil)
|
||||
find_library(IrcUtil_LIBRARY IrcUtil)
|
||||
|
||||
set(LibCommuni_INCLUDE_DIRS ${IrcCore_INCLUDE_DIR} ${IrcModel_INCLUDE_DIR} ${IrcUtil_INCLUDE_DIR})
|
||||
set(LibCommuni_LIBRARIES ${IrcCore_LIBRARY} ${IrcModel_LIBRARY} ${IrcUtil_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LibCommuni
|
||||
REQUIRED_VARS IrcCore_LIBRARY IrcModel_LIBRARY IrcUtil_LIBRARY IrcCore_INCLUDE_DIR IrcModel_INCLUDE_DIR IrcUtil_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if (LibCommuni_FOUND)
|
||||
add_library(LibCommuni::LibCommuni INTERFACE IMPORTED)
|
||||
set_target_properties(LibCommuni::LibCommuni PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${LibCommuni_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LibCommuni_INCLUDE_DIRS}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced( LibCommuni_INCLUDE_DIRS LibCommuni_LIBRARIES
|
||||
IrcCore_LIBRARY IrcModel_LIBRARY IrcUtil_LIBRARY
|
||||
IrcCore_INCLUDE_DIR IrcModel_INCLUDE_DIR IrcUtil_INCLUDE_DIR)
|
14
cmake/FindSerialize.cmake
Normal file
14
cmake/FindSerialize.cmake
Normal file
|
@ -0,0 +1,14 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Serialize_INCLUDE_DIR pajlada/serialize.hpp)
|
||||
|
||||
find_package_handle_standard_args(Serialize REQUIRED_VARS Serialize_INCLUDE_DIR)
|
||||
|
||||
if (Serialize_FOUND)
|
||||
add_library(Serialize::Serialize INTERFACE IMPORTED)
|
||||
set_target_properties(Serialize::Serialize PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Serialize_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(Serialize_INCLUDE_DIR)
|
14
cmake/FindSignals.cmake
Normal file
14
cmake/FindSignals.cmake
Normal file
|
@ -0,0 +1,14 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(Signals_INCLUDE_DIR signals/signal.hpp PATH_SUFFIXES pajlada)
|
||||
|
||||
find_package_handle_standard_args(Signals REQUIRED_VARS Signals_INCLUDE_DIR)
|
||||
|
||||
if (Signals_FOUND)
|
||||
add_library(Signals::Signals INTERFACE IMPORTED)
|
||||
set_target_properties(Signals::Signals PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Signals_INCLUDE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(Signals_INCLUDE_DIR)
|
133
cmake/SourceFileUtils.cmake
Normal file
133
cmake/SourceFileUtils.cmake
Normal file
|
@ -0,0 +1,133 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2016 Fabian Killus
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
# associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all copies or
|
||||
# substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
# ================================================================================================ #
|
||||
# EXPAND_FILE_EXTENSIONS( RESULT <file_pattern>... #
|
||||
# #
|
||||
# This function expands filenames specified with multiple extensions into separate filenames for
|
||||
# each provided extension. For example
|
||||
#
|
||||
# path/to/file.{h,cpp}
|
||||
# path/to/definitions.h
|
||||
#
|
||||
# is transformed into
|
||||
#
|
||||
# path/to/file.h
|
||||
# path/to/file.cpp
|
||||
# path/to/definitions.h
|
||||
#
|
||||
# Intention: For the purpose of building only source files are actually required to be specified.
|
||||
# However, it often makes sense to additionally provide accompanying header files if an IDE such
|
||||
# as Visual Studio is used (otherwise the header files are not shown in the IDE). The downside is
|
||||
# that it becomes annoying to explicitely specify both (header and source) files. This helper
|
||||
# function allows to specify this information in a compact manner.
|
||||
|
||||
function(expand_file_extensions RESULT)
|
||||
|
||||
foreach (entry IN LISTS ARGN)
|
||||
|
||||
# Check for file extension pattern
|
||||
string(REGEX MATCH "\\.{((hxx|cxx),)+(hxx|cxx)}$" EXT_PATTERN ${entry})
|
||||
if (NOT EXT_PATTERN)
|
||||
list(APPEND EXPANDED_SOURCES ${entry})
|
||||
else ()
|
||||
string(LENGTH ${entry} ENTRY_LEN)
|
||||
string(LENGTH ${EXT_PATTERN} EXT_LEN)
|
||||
math(EXPR BASE_LEN "${ENTRY_LEN}-${EXT_LEN}")
|
||||
|
||||
# Obtain basename without extension pattern (e.g. "path/to/file")
|
||||
string(SUBSTRING ${entry} 0 ${BASE_LEN} BASENAME)
|
||||
|
||||
# Convert extension pattern to list (e.g. ".{hxx,cpp}" -> "hxx;cpp")
|
||||
math(EXPR EXT_LEN "${EXT_LEN}-3")
|
||||
string(SUBSTRING ${EXT_PATTERN} 2 ${EXT_LEN} EXT_PATTERN)
|
||||
string(REPLACE "," ";" EXT_PATTERN ${EXT_PATTERN})
|
||||
|
||||
# Append concatenated entries for each extension to expanded sources
|
||||
foreach (e IN LISTS EXT_PATTERN)
|
||||
list(APPEND EXPANDED_SOURCES ${BASENAME}.${e})
|
||||
endforeach ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
set(${RESULT} ${EXPANDED_SOURCES} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# ================================================================================================ #
|
||||
# GENERATE_SOURCE_GROUPS( SOURCE_FILES ) #
|
||||
# #
|
||||
# In CMake the source_group() command can be used to provide guidance for IDEs such as Visual
|
||||
# Studio or XCode how to organize source files.
|
||||
# This function takes a list of source files and creates sensible source groups based on the
|
||||
# path provided for each file. In addition header and source files are sorted into separate super
|
||||
# groups. For example:
|
||||
#
|
||||
# path/to/file.cpp
|
||||
# path/to/file.h
|
||||
#
|
||||
# might be displayed in an IDE somewhat like this
|
||||
#
|
||||
# |-Header Files
|
||||
# ||-path
|
||||
# | |-to
|
||||
# | |-file.h
|
||||
# |-Source Files
|
||||
# ||-path
|
||||
# | |-to
|
||||
# | |-file.cpp
|
||||
#
|
||||
|
||||
function(generate_source_groups)
|
||||
|
||||
set(SOURCES_GROUP "Source Files")
|
||||
set(HEADERS_GROUP "Header Files")
|
||||
|
||||
foreach (f IN LISTS ARGN)
|
||||
# Split filename into its components
|
||||
get_filename_component(filename ${f} NAME)
|
||||
get_filename_component(filedir ${f} DIRECTORY)
|
||||
|
||||
# Extract group name from directory path
|
||||
if (filedir AND NOT ARG_FLAT_STRUCTURE)
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" tmp_dir ${filedir})
|
||||
string(REPLACE "/" "\\\\" groupdir ${tmp_dir})
|
||||
else ()
|
||||
set(groupdir "")
|
||||
endif ()
|
||||
list(APPEND GROUPDIRS ${groupdir})
|
||||
|
||||
# sort according to filetype
|
||||
if (${filename} MATCHES ".*\\.(c|cc|cpp|cxx)")
|
||||
list(APPEND ${groupdir}_SOURCES ${f})
|
||||
elseif (${filename} MATCHES ".*\\.(h|hpp|hxx|txx)")
|
||||
list(APPEND ${groupdir}_HEADERS ${f})
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list(REMOVE_DUPLICATES GROUPDIRS)
|
||||
|
||||
foreach (groupdir IN LISTS GROUPDIRS)
|
||||
source_group("${SOURCES_GROUP}\\${groupdir}" FILES ${${groupdir}_SOURCES})
|
||||
source_group("${HEADERS_GROUP}\\${groupdir}" FILES ${${groupdir}_HEADERS})
|
||||
endforeach ()
|
||||
|
||||
endfunction()
|
||||
|
73
cmake/pmm.cmake
Normal file
73
cmake/pmm.cmake
Normal file
|
@ -0,0 +1,73 @@
|
|||
##
|
||||
## PMM - The Package Manager Manager
|
||||
## https://github.com/AnotherFoxGuy/pmm
|
||||
##
|
||||
|
||||
## MIT License
|
||||
##
|
||||
## Copyright (c) 2018 vector-of-bool
|
||||
## Copyright (c) 2019-2020 Edgar (Edgar@AnotherFoxGuy.com)
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included in all
|
||||
## copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
|
||||
# Bump this version to change what PMM version is downloaded
|
||||
set(PMM_VERSION_INIT 1.9.5)
|
||||
|
||||
# Helpful macro to set a variable if it isn't already set
|
||||
macro(_pmm_set_if_undef varname)
|
||||
if (NOT DEFINED "${varname}")
|
||||
set("${varname}" "${ARGN}")
|
||||
endif ()
|
||||
endmacro()
|
||||
|
||||
## Variables used by this script
|
||||
# The version:
|
||||
_pmm_set_if_undef(PMM_VERSION ${PMM_VERSION_INIT})
|
||||
# The base URL we download PMM from:
|
||||
_pmm_set_if_undef(PMM_URL_BASE "https://anotherfoxguy.com/pmm/")
|
||||
# The real URL we download from (Based on the version)
|
||||
_pmm_set_if_undef(PMM_URL "${PMM_URL_BASE}/${PMM_VERSION}")
|
||||
# The directory where we store our downloaded files
|
||||
_pmm_set_if_undef(PMM_DIR_BASE "${CMAKE_BINARY_DIR}/_pmm")
|
||||
_pmm_set_if_undef(PMM_DIR "${PMM_DIR_BASE}/${PMM_VERSION}")
|
||||
# The location of the current file
|
||||
_pmm_set_if_undef(PMM_MODULE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
|
||||
# The file that we first download
|
||||
set(_PMM_ENTRY_FILE "${PMM_DIR}/entry.cmake")
|
||||
|
||||
if (NOT EXISTS "${_PMM_ENTRY_FILE}" OR PMM_ALWAYS_DOWNLOAD)
|
||||
file(
|
||||
DOWNLOAD "${PMM_URL}/entry.cmake"
|
||||
"${_PMM_ENTRY_FILE}.tmp"
|
||||
STATUS pair
|
||||
)
|
||||
list(GET pair 0 rc)
|
||||
list(GET pair 1 msg)
|
||||
if (rc)
|
||||
message(FATAL_ERROR "Failed to download PMM entry file: ${msg}")
|
||||
endif ()
|
||||
file(RENAME "${_PMM_ENTRY_FILE}.tmp" "${_PMM_ENTRY_FILE}")
|
||||
endif ()
|
||||
|
||||
# ^^^ DO NOT CHANGE THIS LINE vvv
|
||||
set(_PMM_BOOTSTRAP_VERSION 2)
|
||||
# ^^^ DO NOT CHANGE THIS LINE ^^^
|
||||
|
||||
include("${_PMM_ENTRY_FILE}")
|
|
@ -4,6 +4,7 @@ boost/1.71.0
|
|||
|
||||
[generators]
|
||||
qmake
|
||||
cmake_find_package
|
||||
|
||||
[options]
|
||||
openssl:shared=True
|
||||
|
|
194
lib/CMakeLists.txt
Normal file
194
lib/CMakeLists.txt
Normal file
|
@ -0,0 +1,194 @@
|
|||
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_LIBCOMMUNI "Build LibCommuni IRC framework" OFF)
|
||||
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
|
||||
BUILD_IN_SOURCE 1
|
||||
#DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/libcommuni ${CMAKE_BINARY_DIR}/Source/LibCommuni
|
||||
#UPDATE_COMMAND ""
|
||||
GIT_REPOSITORY https://github.com/communi/libcommuni.git
|
||||
GIT_SHALLOW TRUE
|
||||
GIT_PROGRESS TRUE
|
||||
#PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/libcommuni-patch.pro ${CMAKE_BINARY_DIR}/Source/LibCommuni/libcommuni.pro
|
||||
#SOURCE_DIR "${CMAKE_SOURCE_DIR}/libcommuni"
|
||||
CONFIGURE_COMMAND qmake
|
||||
CONFIG+=$<UPPER_CASE:$<CONFIG>>
|
||||
IRC_INSTALL_BINS=${DEPENDENCIES_OUTPUT_DIR}/bin
|
||||
IRC_INSTALL_HEADERS=${DEPENDENCIES_OUTPUT_DIR}/include
|
||||
IRC_INSTALL_LIBS=${DEPENDENCIES_OUTPUT_DIR}/lib
|
||||
IRC_INSTALL_FEATURES=${DEPENDENCIES_OUTPUT_DIR}/features
|
||||
BUILD_COMMAND $<IF:$<BOOL:WIN32>,nmake,make>
|
||||
INSTALL_COMMAND $<IF:$<BOOL:WIN32>,nmake,make> install
|
||||
)
|
||||
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 ()
|
||||
|
||||
|
92
lib/Libcommuni.cmake
Normal file
92
lib/Libcommuni.cmake
Normal file
|
@ -0,0 +1,92 @@
|
|||
project(LibCommuni)
|
||||
|
||||
set(LibCommuni_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/lib/libcommuni/include/")
|
||||
set(LibCommuni_SOURCE_DIR "${CMAKE_SOURCE_DIR}/lib/libcommuni/src/")
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# Core
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
|
||||
set(CORE_PUB_HEADERS
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/irc.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/irccommand.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircconnection.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/irccore.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircfilter.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircglobal.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircmessage.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircnetwork.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircprotocol.h
|
||||
)
|
||||
|
||||
set(CORE_PRIV_HEADERS
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/irccommand_p.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircconnection_p.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircdebug_p.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircmessage_p.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircmessagecomposer_p.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircmessagedecoder_p.h
|
||||
${LibCommuni_INCLUDE_DIR}/IrcCore/ircnetwork_p.h
|
||||
)
|
||||
|
||||
set(CORE_SOURCE_FILES
|
||||
${LibCommuni_SOURCE_DIR}/core/irc.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/irccommand.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircconnection.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/irccore.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircfilter.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircmessage.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircmessage_p.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircmessagecomposer.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircmessagedecoder.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircnetwork.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircprotocol.cpp
|
||||
${LibCommuni_SOURCE_DIR}/core/ircmessagedecoder_none.cpp
|
||||
${LibCommuni_SOURCE_DIR}/3rdparty/mozilla/rdf_utils.c
|
||||
)
|
||||
|
||||
|
||||
add_library(Communi_Core ${CORE_PRIV_HEADERS} ${CORE_PUB_HEADERS} ${CORE_SOURCE_FILES})
|
||||
target_link_libraries(Communi_Core PRIVATE Qt5::Core Qt5::Network)
|
||||
target_include_directories(Communi_Core PUBLIC "${LibCommuni_INCLUDE_DIR}/IrcCore/")
|
||||
target_compile_definitions(Communi_Core PUBLIC IRC_STATIC IRC_NAMESPACE=Communi)
|
||||
set_property(TARGET Communi_Core PROPERTY AUTOMOC ON)
|
||||
set_property(SOURCE ${CORE_SOURCE_FILES} PROPERTY SKIP_AUTOMOC ON)
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# Model
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
file(GLOB_RECURSE MODEL_SOURCE_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false
|
||||
"${CMAKE_SOURCE_DIR}/lib/libcommuni/src/core/*.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/lib/libcommuni/include/IrcModel/*.h"
|
||||
)
|
||||
|
||||
add_library(Communi_Model ${MODEL_SOURCE_FILES})
|
||||
target_include_directories(Communi_Model PUBLIC "${LibCommuni_INCLUDE_DIR}/IrcModel/")
|
||||
target_compile_definitions(Communi_Model PUBLIC IRC_STATIC IRC_NAMESPACE=Communi)
|
||||
#set_property(TARGET Communi_Model PROPERTY AUTOMOC ON)
|
||||
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
# Util
|
||||
# ------------------------------------------------------------------------------------------------#
|
||||
file(GLOB_RECURSE UTIL_SOURCE_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false
|
||||
"${CMAKE_SOURCE_DIR}/lib/libcommuni/src/core/*.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/lib/libcommuni/include/IrcUtil/*.h"
|
||||
)
|
||||
|
||||
add_library(Communi_Util ${UTIL_SOURCE_FILES})
|
||||
target_include_directories(Communi_Util PUBLIC "${LibCommuni_INCLUDE_DIR}/IrcUtil/")
|
||||
target_compile_definitions(Communi_Util PUBLIC IRC_STATIC IRC_NAMESPACE=Communi)
|
||||
#set_property(TARGET Communi_Util PROPERTY AUTOMOC ON)
|
||||
|
||||
set(LibCommuni_INCLUDE_DIRS ${LibCommuni_INCLUDE_DIR}/IrcCore/ ${LibCommuni_INCLUDE_DIR}/IrcModel/ ${LibCommuni_INCLUDE_DIR}/IrcUtil/)
|
||||
set(LibCommuni_LIBRARIES ${Communi_Core} ${Communi_Model} ${Communi_Util})
|
||||
|
||||
add_library(LibCommuni::LibCommuni INTERFACE IMPORTED)
|
||||
set_target_properties(LibCommuni::LibCommuni PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${LibCommuni_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LibCommuni_INCLUDE_DIRS}"
|
||||
)
|
||||
|
||||
|
||||
|
9
lib/Settings.cmake
Normal file
9
lib/Settings.cmake
Normal file
|
@ -0,0 +1,9 @@
|
|||
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)
|
2
lib/WinToast.cmake
Normal file
2
lib/WinToast.cmake
Normal file
|
@ -0,0 +1,2 @@
|
|||
add_library(WinToast ${CMAKE_SOURCE_DIR}/lib/WinToast/src/wintoastlib.cpp)
|
||||
target_include_directories(WinToast PUBLIC "${CMAKE_SOURCE_DIR}/lib/WinToast/src/")
|
|
@ -1,5 +1,5 @@
|
|||
freebsd {
|
||||
INCLUDEPATH += /usr/local/include/qt5keychain
|
||||
INCLUDEPATH += /usr/local/include
|
||||
LIBS += -lqt5keychain
|
||||
} else {
|
||||
unix:!android:!macx:!ios {
|
||||
|
|
57
src/CMakeLists.txt
Normal file
57
src/CMakeLists.txt
Normal file
|
@ -0,0 +1,57 @@
|
|||
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)
|
||||
ADD_DEFINITIONS("/EHsc")
|
||||
ENDIF(MSVC)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS LIST_DIRECTORIES false "*.hpp" "*.cpp" "*.ui" "*.qrc")
|
||||
|
||||
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) #
|
||||
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}")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Settings WinToast qt5keychain)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
Qt5::Network
|
||||
Qt5::Multimedia
|
||||
Qt5::Svg
|
||||
Qt5::Concurrent
|
||||
Boost::Boost
|
||||
OpenSSL::OpenSSL
|
||||
Humanize::Humanize
|
||||
LibCommuni::LibCommuni
|
||||
Serialize::Serialize
|
||||
Signals::Signals
|
||||
websocketpp::websocketpp
|
||||
)
|
||||
|
||||
target_precompile_headers(${PROJECT_NAME} PRIVATE PrecompiledHeader.hpp)
|
|
@ -1,7 +1,7 @@
|
|||
#include "Credentials.hpp"
|
||||
|
||||
#include "debug/AssertInGuiThread.hpp"
|
||||
#include "keychain.h"
|
||||
#include "qt5keychain/keychain.h"
|
||||
#include "singletons/Paths.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/CombinePath.hpp"
|
||||
|
|
Loading…
Reference in a new issue