🔧 Cleanup build without conan

This commit is contained in:
Edgar 2021-02-13 10:40:27 +01:00 committed by Rasmus Karlsson
parent 9d8a607c4d
commit 082b5e8b90
14 changed files with 105 additions and 85 deletions

26
.gitignore vendored
View file

@ -26,7 +26,7 @@ qrc_*.cpp
ui_*.h
Makefile*
*build-*/
/build/
[bB]uild
/_build/
# QtCreator
@ -79,7 +79,27 @@ Thumbs.db
# Other editors/IDEs
.vscode
.idea
dependencies
.idea/
### CMake ###
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json
dependencies/
### CMake Patch ###
# External projects
*-prefix/
Stamp
tmp
Source
Dependencies_*

View file

@ -13,6 +13,9 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 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/")
@ -27,6 +30,12 @@ if (WIN32)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${RUNTIME_OUTPUT_DIRECTORY})
endif ()
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Multimedia Svg Concurrent)
if (WIN32)
find_package(WinToast REQUIRED)
endif()
if (USE_PACKAGE_MANAGER)
include(pmm)
pmm(CONAN)
@ -49,10 +58,6 @@ else (USE_PACKAGE_MANAGER)
endif ()
endif (USE_PACKAGE_MANAGER)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Multimedia Svg Concurrent)
if (BUILD_APP)
add_subdirectory(src)

View file

@ -12,7 +12,7 @@ set(LibCommuni_LIBRARIES ${IrcCore_LIBRARY} ${IrcModel_LIBRARY} ${IrcUtil_LIBRAR
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
DEFAULT_MSG IrcCore_LIBRARY IrcModel_LIBRARY IrcUtil_LIBRARY IrcCore_INCLUDE_DIR IrcModel_INCLUDE_DIR IrcUtil_INCLUDE_DIR
)
if (LibCommuni_FOUND)

14
cmake/FindRapidjson.cmake Normal file
View file

@ -0,0 +1,14 @@
include(FindPackageHandleStandardArgs)
find_path(RapidJSON_INCLUDE_DIRS rapidjson/rapidjson.h HINTS ${CMAKE_SOURCE_DIR}/lib/rapidjson/include)
find_package_handle_standard_args(Rapidjson DEFAULT_MSG RapidJSON_INCLUDE_DIRS)
if (Rapidjson_FOUND)
add_library(Rapidjson::Rapidjson INTERFACE IMPORTED)
set_target_properties(Rapidjson::Rapidjson PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${RapidJSON_INCLUDE_DIRS}"
)
endif ()
mark_as_advanced(RapidJSON_INCLUDE_DIRS)

View file

@ -1,8 +1,8 @@
include(FindPackageHandleStandardArgs)
find_path(Serialize_INCLUDE_DIR pajlada/serialize.hpp)
find_path(Serialize_INCLUDE_DIR pajlada/serialize.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/serialize/include)
find_package_handle_standard_args(Serialize REQUIRED_VARS Serialize_INCLUDE_DIR)
find_package_handle_standard_args(Serialize DEFAULT_MSG Serialize_INCLUDE_DIR)
if (Serialize_FOUND)
add_library(Serialize::Serialize INTERFACE IMPORTED)

View file

@ -3,7 +3,7 @@ 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)
find_package_handle_standard_args(Settings DEFAULT_MSG Settings_INCLUDE_DIR Settings_LIBRARY)
if (Settings_FOUND)
add_library(Settings::Settings INTERFACE IMPORTED)

View file

@ -1,8 +1,8 @@
include(FindPackageHandleStandardArgs)
find_path(Signals_INCLUDE_DIR pajlada/signals/signal.hpp)
find_path(Signals_INCLUDE_DIR pajlada/signals/signal.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/signals/include)
find_package_handle_standard_args(Signals REQUIRED_VARS Signals_INCLUDE_DIR)
find_package_handle_standard_args(Signals DEFAULT_MSG Signals_INCLUDE_DIR)
if (Signals_FOUND)
add_library(Signals::Signals INTERFACE IMPORTED)

View file

@ -0,0 +1,14 @@
include(FindPackageHandleStandardArgs)
find_path(Websocketpp_INCLUDE_DIRS websocketpp/version.hpp HINTS ${CMAKE_SOURCE_DIR}/lib/websocketpp)
find_package_handle_standard_args(Websocketpp DEFAULT_MSG Websocketpp_INCLUDE_DIRS)
if (Websocketpp_FOUND)
add_library(websocketpp::websocketpp INTERFACE IMPORTED)
set_target_properties(websocketpp::websocketpp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Websocketpp_INCLUDE_DIRS}"
)
endif ()
mark_as_advanced(Websocketpp_INCLUDE_DIRS)

12
cmake/FindWinToast.cmake Normal file
View file

@ -0,0 +1,12 @@
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/WinToast/src/wintoastlib.cpp)
set(WinToast_FOUND TRUE)
add_library(WinToast ${CMAKE_SOURCE_DIR}/lib/WinToast/src/wintoastlib.cpp)
target_include_directories(WinToast PUBLIC "${CMAKE_SOURCE_DIR}/lib/WinToast/src/")
else ()
set(WinToast_FOUND FALSE)
message("WinToast submodule not found!")
endif ()

View file

@ -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/")

13
conanfile-qt5.txt Normal file
View file

@ -0,0 +1,13 @@
[requires]
qt/5.15.2
[generators]
virtualbuildenv
[options]
qt:widgets=True
qt:gui=True
# qt:network=True
qt:qtmultimedia=True
qt:qtsvg=True
# qt:concurrent=True

View file

@ -14,12 +14,10 @@ project(chatterino2-dependencies VERSION 1)
# ------------------------------------------------------------------------------------------------#
# Options with same default value on all platforms
option(BUILD_LIBCOMMUNI "Build LibCommuni" ON)
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)
option(BUILD_GOOGLETEST "Build GoogleTest library" OFF)
# ------------------------------------------------------------------------------------------------#
# General setup and initialization
@ -99,60 +97,6 @@ if (BUILD_QTKEYCHAIN)
)
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
# ------------------------------------------------------------------------------------------------#
@ -175,14 +119,14 @@ if (BUILD_SETTINGS)
endif ()
# ------------------------------------------------------------------------------------------------#
# WebSocketpp
# GoogleTest
# ------------------------------------------------------------------------------------------------#
if (BUILD_WEBSOCKETPP)
if (BUILD_GOOGLETEST)
ExternalProject_Add(
WebSocketpp
GIT_REPOSITORY https://github.com/ziocleto/websocketpp.git
GIT_TAG 1e0138c7ccedc6be859d28270ccd6195f235a94e
GoogleTest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
CMAKE_ARGS
@ -194,4 +138,3 @@ if (BUILD_WEBSOCKETPP)
)
endif ()

View file

@ -2,9 +2,9 @@ include(SourceFileUtils)
project(chatterino)
IF (MSVC)
ADD_DEFINITIONS("/EHsc")
ENDIF (MSVC)
if (MSVC)
add_definitions("/EHsc")
endif (MSVC)
set(SOURCE_FILES main.cpp
Application.{hpp,cpp}
@ -222,8 +222,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\")
include(WinToast)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME}
@ -233,9 +231,12 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Network
Qt5::Svg
Qt5::Widgets
WinToast
)
if (WinToast_FOUND)
target_link_libraries(${PROJECT_NAME} WinToast)
endif ()
if (USE_PACKAGE_MANAGER)
target_link_libraries(${PROJECT_NAME}
CONAN_PKG::boost