1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00

Add some Qt6 cmake support

WebEngine is missing because the current 6.2 installed
has a broken WebEngine
This commit is contained in:
Elias Steurer 2021-06-20 18:50:54 +02:00
parent 7410052139
commit a577decdc9
8 changed files with 79 additions and 61 deletions

View File

@ -18,8 +18,7 @@ elseif(APPLE)
set(VCPKG_ARCH "x64-osx")
endif()
# Assume built-in pthreads on MacOS
# https://stackoverflow.com/questions/54587052/cmake-on-mac-could-not-find-threads-missing-threads-found
# Assume built-in pthreads on MacOS https://stackoverflow.com/questions/54587052/cmake-on-mac-could-not-find-threads-missing-threads-found
if(APPLE)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)

View File

@ -5,16 +5,17 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
QuickCompiler
Widgets
Gui
WebEngine
LinguistTools
WebSockets
QT NAMES Qt6 Qt5
COMPONENTS Quick Widgets Gui LinguistTools WebSockets
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick Widgets Gui LinguistTools WebSockets
REQUIRED)
message(STATUS "[PROJECT] QT_VERSION_MAJOR = ${QT_VERSION_MAJOR}")
find_package(OpenSSL REQUIRED)
find_package(benchmark CONFIG REQUIRED)
find_package(doctest CONFIG REQUIRED)
@ -73,10 +74,10 @@ set(l10n
translations/ScreenPlay_vi.ts)
set_source_files_properties(${l10n} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/translations")
qt5_add_translation(qmFiles ${l10n})
qt_add_translation(qmFiles ${l10n})
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
qt5_add_resources(qml qml.qrc Resources.qrc)
qt_add_resources(qml qml.qrc Resources.qrc)
else()
qtquick_compiler_add_resources(qml qml.qrc Resources.qrc)
endif()
@ -100,12 +101,11 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}")
target_link_libraries(
${PROJECT_NAME}
PRIVATE Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
Qt5::WebEngine
Qt5::WebSockets
PRIVATE Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::WebSockets
ScreenPlaySDK
ScreenPlayUtil
benchmark::benchmark
@ -127,10 +127,4 @@ if(WIN32)
endforeach()
configure_file(${VCPKG_INSTALLED_PATH}/tools/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
elseif(APPLE)
# cmake-format: off
# Auto ffmpeg download missing for osx
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
# cmake-format: on
endif()

View File

@ -3,9 +3,12 @@ project(ScreenPlaySDK LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
QT NAMES Qt6 Qt5
COMPONENTS Quick Network Core
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick Network Core
REQUIRED)
@ -15,6 +18,7 @@ set(headers inc/screenplay-sdk_plugin.h inc/screenplaysdk.h)
add_library(${PROJECT_NAME} ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui Qt5::Network)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network)
target_include_directories(${PROJECT_NAME} PUBLIC inc)

View File

@ -3,9 +3,12 @@ project(ScreenPlayShader LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
QT NAMES Qt6 Qt5
COMPONENTS Quick Core
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick Core
REQUIRED)
@ -17,7 +20,7 @@ set(shader shader.qrc)
add_library(${PROJECT_NAME} SHARED ${src} ${headers} ${shader})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Gui)
target_include_directories(${PROJECT_NAME} PUBLIC inc)
@ -25,7 +28,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC inc)
set(URI "ScreenPlay/Shader")
string(REPLACE "." "/" TARGETPATH ${URI})
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "Cannot find qmake")
endif()

View File

@ -6,7 +6,12 @@ set(CMAKE_AUTOMOC ON)
find_package(infoware CONFIG REQUIRED)
find_package(
Qt5
QT NAMES Qt6 Qt5
COMPONENTS Quick Core
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick Core
REQUIRED)
@ -31,13 +36,13 @@ set(headers
add_library(${PROJECT_NAME} SHARED ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick infoware)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick infoware)
# QML module deployment
set(URI "ScreenPlay/Sysinfo")
string(REPLACE "." "/" TARGETPATH ${URI})
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "Cannot find qmake")
endif()

View File

@ -3,25 +3,24 @@ project(ScreenPlayUtil LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
QT NAMES Qt6 Qt5
COMPONENTS Core
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Core
REQUIRED)
set(SOURCES
src/util.cpp
src/contenttypes.cpp
)
set(SOURCES src/util.cpp src/contenttypes.cpp)
set(HEADER
inc/public/ScreenPlayUtil/util.h
inc/public/ScreenPlayUtil/contenttypes.h
inc/public/ScreenPlayUtil/projectfile.h
)
set(HEADER inc/public/ScreenPlayUtil/util.h inc/public/ScreenPlayUtil/contenttypes.h inc/public/ScreenPlayUtil/projectfile.h)
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADER})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core )
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core)
target_include_directories(${PROJECT_NAME} PUBLIC inc/public/ PRIVATE src/)
target_include_directories(
${PROJECT_NAME}
PUBLIC inc/public/
PRIVATE src/)

View File

@ -3,10 +3,13 @@ project(ScreenPlayWallpaper LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick Widgets Gui WebEngine QuickCompiler
QT NAMES Qt6 Qt5
COMPONENTS Quick Widgets Gui
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick Widgets Gui WebEngine
REQUIRED)
if(WIN32)
@ -43,6 +46,13 @@ if(APPLE)
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa")
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine shcore.lib ScreenPlaySDK ScreenPlayUtil)
target_link_libraries(
${PROJECT_NAME}
PRIVATE Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::WebEngine
shcore.lib
ScreenPlaySDK
ScreenPlayUtil)

View File

@ -3,10 +3,13 @@ project(ScreenPlayWidget LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick Widgets Gui QuickCompiler WebEngine
QT NAMES Qt6 Qt5
COMPONENTS Quick Widgets Gui
REQUIRED)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick Widgets Gui WebEngine
REQUIRED)
set(src main.cpp src/widgetwindow.cpp)
@ -31,4 +34,5 @@ if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core ScreenPlaySDK ScreenPlayUtil)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Core ScreenPlaySDK ScreenPlayUtil)