First changes to build systems

For the time being I hardcoded qt6 in cmake for convenience, but in the end there'll be a flag you should specify for building with either Qt6 or Qt5
This commit is contained in:
zneix 2021-07-30 17:08:31 +02:00
parent 3f0db00360
commit e14050d40c
No known key found for this signature in database
GPG key ID: 911916E0523B22F6
3 changed files with 23 additions and 23 deletions

View file

@ -13,7 +13,7 @@ option(BUILD_APP "Build Chatterino" ON)
option(BUILD_TESTS "Build the tests for Chatterino" OFF) option(BUILD_TESTS "Build the tests for Chatterino" OFF)
option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF) option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF)
option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF) option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF)
option(USE_SYSTEM_QT5KEYCHAIN "Use system Qt5Keychain library" OFF) option(USE_SYSTEM_QT6KEYCHAIN "Use system Qt6Keychain library" OFF)
option(USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) option(USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
option(USE_CONAN "Use conan" OFF) option(USE_CONAN "Use conan" OFF)
@ -31,7 +31,7 @@ endif ()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/GIT.cmake) include(${CMAKE_CURRENT_LIST_DIR}/cmake/GIT.cmake)
find_package(Qt5 REQUIRED find_package(Qt6 REQUIRED
COMPONENTS COMPONENTS
Core Core
Widgets Widgets
@ -72,17 +72,17 @@ endif()
# Link QtKeychain statically # Link QtKeychain statically
option(QTKEYCHAIN_STATIC "" ON) option(QTKEYCHAIN_STATIC "" ON)
if (USE_SYSTEM_QT5KEYCHAIN) if (USE_SYSTEM_QT6KEYCHAIN)
find_package(Qt5Keychain REQUIRED) find_package(Qt6Keychain REQUIRED)
else() else()
set(QT5KEYCHAIN_ROOT_LIB_FOLDER "${CMAKE_SOURCE_DIR}/lib/qtkeychain") set(QT6KEYCHAIN_ROOT_LIB_FOLDER "${CMAKE_SOURCE_DIR}/lib/qtkeychain")
if (NOT EXISTS "${QT5KEYCHAIN_ROOT_LIB_FOLDER}/CMakeLists.txt") if (NOT EXISTS "${QT6KEYCHAIN_ROOT_LIB_FOLDER}/CMakeLists.txt")
message(FATAL_ERROR "Submodules probably not loaded, unable to find lib/qtkeychain/CMakeLists.txt") message(FATAL_ERROR "Submodules probably not loaded, unable to find lib/qtkeychain/CMakeLists.txt")
endif() endif()
add_subdirectory("${QT5KEYCHAIN_ROOT_LIB_FOLDER}" EXCLUDE_FROM_ALL) add_subdirectory("${QT6KEYCHAIN_ROOT_LIB_FOLDER}" EXCLUDE_FROM_ALL)
if (NOT TARGET qt5keychain) if (NOT TARGET qt6keychain)
message(FATAL_ERROR "qt5keychain target was not created :@") message(FATAL_ERROR "qt6keychain target was not created :@")
endif() endif()
endif() endif()

View file

@ -1,9 +1,9 @@
freebsd { freebsd {
INCLUDEPATH += /usr/local/include/qt5keychain INCLUDEPATH += /usr/local/include/qt6keychain
LIBS += -lqt5keychain LIBS += -lqt6keychain
} else { } else {
unix:!android:!macx:!ios { unix:!android:!macx:!ios {
DEFINES += KEYCHAIN_DBUS DEFINES += KEYCHAIN_DBUS
} }
include(qtkeychain/qt5keychain.pri) include(qtkeychain/qt6keychain.pri)
} }

View file

@ -476,16 +476,16 @@ add_library(${LIBRARY_PROJECT} OBJECT ${SOURCE_FILES})
target_link_libraries(${LIBRARY_PROJECT} target_link_libraries(${LIBRARY_PROJECT}
PUBLIC PUBLIC
Qt5::Core Qt6::Core
Qt5::Widgets Qt6::Widgets
Qt5::Gui Qt6::Gui
Qt5::Network Qt6::Network
Qt5::Multimedia Qt6::Multimedia
Qt5::Svg Qt6::Svg
Qt5::Concurrent Qt6::Concurrent
LibCommuni::LibCommuni LibCommuni::LibCommuni
qt5keychain qt6keychain
Pajlada::Serialize Pajlada::Serialize
Pajlada::Settings Pajlada::Settings
Pajlada::Signals Pajlada::Signals
@ -514,8 +514,8 @@ if (BUILD_APP)
) )
if (MSVC) if (MSVC)
get_target_property(Qt5_Core_Location Qt5::Core LOCATION) get_target_property(Qt6_Core_Location Qt6::Core LOCATION)
get_filename_component(QT_BIN_DIR ${Qt5_Core_Location} DIRECTORY) get_filename_component(QT_BIN_DIR ${Qt6_Core_Location} DIRECTORY)
set(WINDEPLOYQT_COMMAND "${QT_BIN_DIR}/windeployqt.exe" $<TARGET_FILE:${EXECUTABLE_PROJECT}> --release --no-compiler-runtime --no-translations --no-opengl-sw) set(WINDEPLOYQT_COMMAND "${QT_BIN_DIR}/windeployqt.exe" $<TARGET_FILE:${EXECUTABLE_PROJECT}> --release --no-compiler-runtime --no-translations --no-opengl-sw)
install(TARGETS ${EXECUTABLE_PROJECT} install(TARGETS ${EXECUTABLE_PROJECT}
@ -572,7 +572,7 @@ target_compile_definitions(${LIBRARY_PROJECT} PUBLIC
CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\" CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\"
CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\" CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\"
) )
if (USE_SYSTEM_QT5KEYCHAIN) if (USE_SYSTEM_QT6KEYCHAIN)
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC target_compile_definitions(${LIBRARY_PROJECT} PUBLIC
CMAKE_BUILD CMAKE_BUILD
) )