1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 02:32:29 +01:00

Call format-cmake.py

This commit is contained in:
Elias Steurer 2020-10-29 18:53:52 +01:00
parent 72a5485e7f
commit 8e117cebfd
7 changed files with 128 additions and 249 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16.0 )
cmake_minimum_required(VERSION 3.16.0)
project(ScreenPlay)
@ -17,14 +17,13 @@ elseif(APPLE)
set(VCPKG_ARCH "x64-osx")
endif()
set(VCPKG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/include/)
set(VCPKG_TOOLS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/tools/)
set(VCPKG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/include/)
set(VCPKG_TOOLS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/tools/)
set(QT_TELEMTRY_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-google-analytics/)
find_package(Git REQUIRED)
if(WIN32)
set(date_command "CMD" )
set(date_command "CMD")
set(date_arg "/c date /t")
elseif(APPLE)
@ -35,27 +34,25 @@ elseif(UNIX)
set(date_arg "")
endif()
execute_process(COMMAND
${date_command} ${date_arg}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE BUILD_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${date_command} ${date_arg}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE BUILD_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_HASH ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
add_compile_definitions(COMPILE_INFO="${BUILD_DATE} + ${GIT_COMMIT_HASH}")
if(UNIX)
# Fixes QWebEngine linker errors
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
# Fixes QWebEngine linker errors
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
endif()
add_subdirectory(ScreenPlay)
add_subdirectory(ScreenPlaySDK)
add_subdirectory(ScreenPlayShader)
@ -63,5 +60,5 @@ add_subdirectory(ScreenPlayWallpaper)
add_subdirectory(ScreenPlayWidget)
if(WIN32)
add_subdirectory(ScreenPlaySysInfo)
add_subdirectory(ScreenPlaySysInfo)
endif()

View File

@ -1,62 +1,58 @@
project(ScreenPlay LANGUAGES CXX)
project(ScreenPlay LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
QuickCompiler
Widgets
Gui
WebEngine
LinguistTools
REQUIRED)
Qt5
COMPONENTS Quick QuickCompiler Widgets Gui WebEngine LinguistTools
REQUIRED)
find_package(OpenSSL REQUIRED)
if(WIN32)
find_package(sentry CONFIG REQUIRED)
find_package(sentry CONFIG REQUIRED)
endif()
set(src main.cpp
app.cpp
../Common/qt-google-analytics/ganalytics.cpp
src/globalvariables.cpp
src/createimportvideo.cpp
src/installedlistmodel.cpp
src/monitorlistmodel.cpp
src/screenplaywallpaper.cpp
src/screenplaywidget.cpp
src/settings.cpp
src/profilelistmodel.cpp
src/installedlistfilter.cpp
src/projectsettingslistmodel.cpp
src/screenplaymanager.cpp
src/sdkconnection.cpp
src/util.cpp
src/create.cpp)
set(src
main.cpp
app.cpp
../Common/qt-google-analytics/ganalytics.cpp
src/globalvariables.cpp
src/createimportvideo.cpp
src/installedlistmodel.cpp
src/monitorlistmodel.cpp
src/screenplaywallpaper.cpp
src/screenplaywidget.cpp
src/settings.cpp
src/profilelistmodel.cpp
src/installedlistfilter.cpp
src/projectsettingslistmodel.cpp
src/screenplaymanager.cpp
src/sdkconnection.cpp
src/util.cpp
src/create.cpp)
set(headers app.h
../Common/qt-google-analytics/ganalytics.h
src/globalvariables.h
src/createimportvideo.h
src/installedlistmodel.h
src/monitorlistmodel.h
src/screenplaywallpaper.h
src/screenplaywidget.h
src/settings.h
src/profilelistmodel.h
src/profile.h
src/projectfile.h
src/installedlistfilter.h
src/projectsettingslistmodel.h
src/screenplaymanager.h
src/sdkconnection.h
src/util.h
src/create.h)
set(headers
app.h
../Common/qt-google-analytics/ganalytics.h
src/globalvariables.h
src/createimportvideo.h
src/installedlistmodel.h
src/monitorlistmodel.h
src/screenplaywallpaper.h
src/screenplaywidget.h
src/settings.h
src/profilelistmodel.h
src/profile.h
src/projectfile.h
src/installedlistfilter.h
src/projectsettingslistmodel.h
src/screenplaymanager.h
src/sdkconnection.h
src/util.h
src/create.h)
set(l10n
translations/ScreenPlay_de.ts
@ -66,13 +62,11 @@ set(l10n
translations/ScreenPlay_fr.ts
translations/ScreenPlay_ko.ts
translations/ScreenPlay_ru.ts
translations/ScreenPlay_vi.ts
)
translations/ScreenPlay_vi.ts)
set_source_files_properties(${l10n} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/translations")
qt5_add_translation(qmFiles ${l10n})
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
qt5_add_resources(qml qml.qrc resources.qrc)
else()
@ -83,40 +77,27 @@ add_executable(${PROJECT_NAME} ${src} ${headers} ${resources} ${qml})
if(WIN32)
# Icon
target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc)
target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc)
# Disable console window on Windows
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}")
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
ScreenPlaySDK
)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry)
endif()
target_include_directories(${PROJECT_NAME}
PRIVATE
${QT_TELEMTRY_INCLUDE})
target_include_directories(${PROJECT_NAME} PRIVATE ${QT_TELEMTRY_INCLUDE})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)
# Copy ffmpeg. If the ffmpeg files are missing, start the
# install_dependencies_XXX for your system!
# Copy ffmpeg. If the ffmpeg files are missing, start the install_dependencies_XXX for your system!
if(WIN32)
file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/*")
@ -124,8 +105,8 @@ if(WIN32)
configure_file(${filename} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/vcpkg/installed/x64-windows/tools/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/vcpkg/installed/x64-windows/tools/sentry-native/crashpad_handler.exe
${CMAKE_BINARY_DIR}/bin/ COPYONLY)
elseif(APPLE)
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)

View File

@ -1,32 +1,19 @@
project(ScreenPlaySDK LANGUAGES CXX)
project(ScreenPlaySDK LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
Network
Core
REQUIRED)
Qt5
COMPONENTS Quick Network Core
REQUIRED)
set(src src/screenplay-sdk_plugin.cpp
src/screenplaysdk.cpp)
set(src src/screenplay-sdk_plugin.cpp src/screenplaysdk.cpp)
set(headers
inc/screenplay-sdk_plugin.h
inc/screenplaysdk.h)
set(headers inc/screenplay-sdk_plugin.h inc/screenplaysdk.h)
add_library(${PROJECT_NAME} ${src} ${headers})
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 Qt5::Core Qt5::Quick Qt5::Gui Qt5::Network)
target_include_directories(
${PROJECT_NAME}
PUBLIC inc
)
target_include_directories(${PROJECT_NAME} PUBLIC inc)

View File

@ -1,49 +1,32 @@
project(ScreenPlayShader LANGUAGES CXX)
project(ScreenPlayShader LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
Core
REQUIRED)
Qt5
COMPONENTS Quick Core
REQUIRED)
set(src
screenplayshader_plugin.cpp
shaderlibrary.cpp
)
set(src screenplayshader_plugin.cpp shaderlibrary.cpp)
set(headers
screenplayshader_plugin.h
shaderlibrary.h
)
set(headers screenplayshader_plugin.h shaderlibrary.h)
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_include_directories(
${PROJECT_NAME}
PUBLIC inc
)
add_library(${PROJECT_NAME} SHARED ${src} ${headers} ${shader})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui)
target_include_directories(${PROJECT_NAME} PUBLIC inc)
# QML module deployment
set(URI "ScreenPlay/Shader")
string(REPLACE "." "/" TARGETPATH ${URI})
if (NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
if (NOT QT_QMAKE_EXECUTABLE)
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "Cannot find qmake")
endif()
endif()
@ -57,10 +40,8 @@ file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY)
# Copies ScreenPlayShader.* into qt qml plugins folder
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlayShader>
${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>)
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlayShader> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>)

View File

@ -1,42 +1,26 @@
project(ScreenPlaySysInfo LANGUAGES CXX)
project(ScreenPlaySysInfo LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
Core
REQUIRED)
Qt5
COMPONENTS Quick Core
REQUIRED)
set(src screenplaysysinfo_plugin.cpp sysinfo.cpp cpu.cpp ram.cpp storage.cpp)
set(headers screenplaysysinfo_plugin.h sysinfo.h cpu.h ram.h mathhelper.h storage.h)
set(src screenplaysysinfo_plugin.cpp
sysinfo.cpp
cpu.cpp
ram.cpp
storage.cpp)
set(headers screenplaysysinfo_plugin.h
sysinfo.h
cpu.h
ram.h
mathhelper.h
storage.h)
add_library(${PROJECT_NAME} SHARED ${src} ${headers})
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Core
Qt5::Quick)
add_library(${PROJECT_NAME} SHARED ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick)
# 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)
if (NOT QT_QMAKE_EXECUTABLE)
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "Cannot find qmake")
endif()
endif()
@ -50,10 +34,8 @@ file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY)
# Copies ScreenPlaySysInfo.* into qt qml plugins folder
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlaySysInfo>
${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlaySysInfo>)
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlaySysInfo> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlaySysInfo>)

View File

@ -1,70 +1,37 @@
project(ScreenPlayWallpaper LANGUAGES CXX)
project(ScreenPlayWallpaper LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
Widgets
Gui
WebEngine
QuickCompiler
REQUIRED)
Qt5
COMPONENTS Quick Widgets Gui WebEngine QuickCompiler
REQUIRED)
if(WIN32)
set(src_plattform
src/windowsdesktopproperties.cpp
src/winwindow.cpp)
set(headers_plattform
src/windowsdesktopproperties.h
src/winwindow.h)
set(src_plattform src/windowsdesktopproperties.cpp src/winwindow.cpp)
set(headers_plattform src/windowsdesktopproperties.h src/winwindow.h)
elseif(APPLE)
set(src_plattform
src/macintegration.cpp
src/macwindow.cpp)
set(headers_plattform
src/macintegration.h
src/macbridge.h
src/macwindow.h)
set(src_plattform src/macintegration.cpp src/macwindow.cpp)
set(headers_plattform src/macintegration.h src/macbridge.h src/macwindow.h)
elseif(UNIX)
set(src_plattform
main.cpp
src/linuxwindow.cpp)
set(headers_plattform
src/linuxwindow.h)
set(src_plattform main.cpp src/linuxwindow.cpp)
set(headers_plattform src/linuxwindow.h)
endif()
set( src
main.cpp
src/basewindow.cpp)
set( headers
src/basewindow.h)
set(src main.cpp src/basewindow.cpp)
set(headers src/basewindow.h)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(resources SPWResources.qrc)
else()
qtquick_compiler_add_resources(resources SPWResources.qrc )
qtquick_compiler_add_resources(resources SPWResources.qrc)
endif()
add_executable(${PROJECT_NAME} ${src} ${headers} ${src_plattform} ${headers_plattform} ${resources})
add_executable(${PROJECT_NAME} ${src} ${headers} ${src_plattform} ${headers_plattform} ${resources})
# Disable console window on Windows
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
Qt5::WebEngine
ScreenPlaySDK
)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK)

View File

@ -1,29 +1,22 @@
project(ScreenPlayWidget LANGUAGES CXX)
project(ScreenPlayWidget LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
Widgets
Gui
QuickCompiler
WebEngine
REQUIRED)
Qt5
COMPONENTS Quick Widgets Gui QuickCompiler WebEngine
REQUIRED)
set(src main.cpp
src/widgetwindow.cpp)
set(src main.cpp src/widgetwindow.cpp)
set(headers
src/widgetwindow.h)
set(headers src/widgetwindow.h)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(resources SPWidgetResources.qrc)
else()
qtquick_compiler_add_resources(resources SPWidgetResources.qrc )
qtquick_compiler_add_resources(resources SPWidgetResources.qrc)
endif()
add_executable(${PROJECT_NAME} ${src} ${headers} ${resources})
@ -32,13 +25,4 @@ add_executable(${PROJECT_NAME} ${src} ${headers} ${resources})
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
ScreenPlaySDK
)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core ScreenPlaySDK)