1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 20:22:39 +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

@ -21,7 +21,6 @@ set(VCPKG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCP
set(VCPKG_TOOLS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/tools/) 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/) set(QT_TELEMTRY_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-google-analytics/)
find_package(Git REQUIRED) find_package(Git REQUIRED)
if(WIN32) if(WIN32)
set(date_command "CMD") set(date_command "CMD")
@ -35,17 +34,16 @@ elseif(UNIX)
set(date_arg "") set(date_arg "")
endif() endif()
execute_process(COMMAND execute_process(
${date_command} ${date_arg} COMMAND ${date_command} ${date_arg}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE BUILD_DATE OUTPUT_VARIABLE BUILD_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND execute_process(
"${GIT_EXECUTABLE}" describe --always COMMAND "${GIT_EXECUTABLE}" describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_VARIABLE GIT_COMMIT_HASH ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
add_compile_definitions(COMPILE_INFO="${BUILD_DATE} + ${GIT_COMMIT_HASH}") add_compile_definitions(COMPILE_INFO="${BUILD_DATE} + ${GIT_COMMIT_HASH}")
@ -55,7 +53,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
endif() endif()
add_subdirectory(ScreenPlay) add_subdirectory(ScreenPlay)
add_subdirectory(ScreenPlaySDK) add_subdirectory(ScreenPlaySDK)
add_subdirectory(ScreenPlayShader) add_subdirectory(ScreenPlayShader)

View File

@ -2,18 +2,12 @@ project(ScreenPlay LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
find_package( find_package(
Qt5 Qt5
COMPONENTS Quick COMPONENTS Quick QuickCompiler Widgets Gui WebEngine LinguistTools
QuickCompiler
Widgets
Gui
WebEngine
LinguistTools
REQUIRED) REQUIRED)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
@ -21,7 +15,8 @@ if(WIN32)
find_package(sentry CONFIG REQUIRED) find_package(sentry CONFIG REQUIRED)
endif() endif()
set(src main.cpp set(src
main.cpp
app.cpp app.cpp
../Common/qt-google-analytics/ganalytics.cpp ../Common/qt-google-analytics/ganalytics.cpp
src/globalvariables.cpp src/globalvariables.cpp
@ -39,7 +34,8 @@ set(src main.cpp
src/util.cpp src/util.cpp
src/create.cpp) src/create.cpp)
set(headers app.h set(headers
app.h
../Common/qt-google-analytics/ganalytics.h ../Common/qt-google-analytics/ganalytics.h
src/globalvariables.h src/globalvariables.h
src/createimportvideo.h src/createimportvideo.h
@ -66,13 +62,11 @@ set(l10n
translations/ScreenPlay_fr.ts translations/ScreenPlay_fr.ts
translations/ScreenPlay_ko.ts translations/ScreenPlay_ko.ts
translations/ScreenPlay_ru.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") set_source_files_properties(${l10n} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/translations")
qt5_add_translation(qmFiles ${l10n}) qt5_add_translation(qmFiles ${l10n})
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
qt5_add_resources(qml qml.qrc resources.qrc) qt5_add_resources(qml qml.qrc resources.qrc)
else() else()
@ -90,33 +84,20 @@ if(WIN32)
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true) set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
endif() 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} target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK)
PRIVATE
Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
Qt5::WebEngine
ScreenPlaySDK
)
if(WIN32) if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry) target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry)
endif() endif()
target_include_directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME} PRIVATE ${QT_TELEMTRY_INCLUDE})
PRIVATE
${QT_TELEMTRY_INCLUDE})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY) configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)
# Copy ffmpeg. If the ffmpeg files are missing, start the # Copy ffmpeg. If the ffmpeg files are missing, start the install_dependencies_XXX for your system!
# install_dependencies_XXX for your system!
if(WIN32) if(WIN32)
file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/*") file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/*")
@ -124,8 +105,8 @@ if(WIN32)
configure_file(${filename} ${CMAKE_BINARY_DIR}/bin/ COPYONLY) configure_file(${filename} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
endforeach() endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/vcpkg/installed/x64-windows/tools/sentry-native/crashpad_handler.exe
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/vcpkg/installed/x64-windows/tools/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY) ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
elseif(APPLE) elseif(APPLE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg ${CMAKE_BINARY_DIR}/bin/ COPYONLY) 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) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)

View File

@ -5,28 +5,15 @@ set(CMAKE_AUTOMOC ON)
find_package( find_package(
Qt5 Qt5
COMPONENTS Quick COMPONENTS Quick Network Core
Network
Core
REQUIRED) REQUIRED)
set(src src/screenplay-sdk_plugin.cpp set(src src/screenplay-sdk_plugin.cpp src/screenplaysdk.cpp)
src/screenplaysdk.cpp)
set(headers set(headers inc/screenplay-sdk_plugin.h inc/screenplaysdk.h)
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} target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui Qt5::Network)
PRIVATE
Qt5::Core
Qt5::Quick
Qt5::Gui
Qt5::Network)
target_include_directories( target_include_directories(${PROJECT_NAME} PUBLIC inc)
${PROJECT_NAME}
PUBLIC inc
)

View File

@ -1,5 +1,4 @@
project(ScreenPlayShader LANGUAGES CXX) project(ScreenPlayShader LANGUAGES CXX)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
@ -7,36 +6,20 @@ set(CMAKE_AUTOMOC ON)
find_package( find_package(
Qt5 Qt5
COMPONENTS Quick COMPONENTS Quick Core
Core
REQUIRED) REQUIRED)
set(src set(src screenplayshader_plugin.cpp shaderlibrary.cpp)
screenplayshader_plugin.cpp
shaderlibrary.cpp
)
set(headers set(headers screenplayshader_plugin.h shaderlibrary.h)
screenplayshader_plugin.h
shaderlibrary.h
)
set(shader shader.qrc) set(shader shader.qrc)
add_library(${PROJECT_NAME} SHARED ${src} ${headers} ${shader}) add_library(${PROJECT_NAME} SHARED ${src} ${headers} ${shader})
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui)
PRIVATE
Qt5::Core
Qt5::Quick
Qt5::Gui)
target_include_directories(
${PROJECT_NAME}
PUBLIC inc
)
target_include_directories(${PROJECT_NAME} PUBLIC inc)
# QML module deployment # QML module deployment
set(URI "ScreenPlay/Shader") set(URI "ScreenPlay/Shader")
@ -57,10 +40,8 @@ file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY) configure_file(qmldir ${DESTDIR} COPYONLY)
# Copies ScreenPlayShader.* into qt qml plugins folder # Copies ScreenPlayShader.* into qt qml plugins folder
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlayShader> COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlayShader> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>)
${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>)

View File

@ -1,4 +1,3 @@
project(ScreenPlaySysInfo LANGUAGES CXX) project(ScreenPlaySysInfo LANGUAGES CXX)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
@ -6,30 +5,15 @@ set(CMAKE_AUTOMOC ON)
find_package( find_package(
Qt5 Qt5
COMPONENTS Quick COMPONENTS Quick Core
Core
REQUIRED) REQUIRED)
set(src screenplaysysinfo_plugin.cpp sysinfo.cpp cpu.cpp ram.cpp storage.cpp)
set(src screenplaysysinfo_plugin.cpp set(headers screenplaysysinfo_plugin.h sysinfo.h cpu.h ram.h mathhelper.h storage.h)
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}) add_library(${PROJECT_NAME} SHARED ${src} ${headers})
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick)
PRIVATE
Qt5::Core
Qt5::Quick)
# QML module deployment # QML module deployment
set(URI "ScreenPlay/Sysinfo") set(URI "ScreenPlay/Sysinfo")
@ -50,10 +34,8 @@ file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY) configure_file(qmldir ${DESTDIR} COPYONLY)
# Copies ScreenPlaySysInfo.* into qt qml plugins folder # Copies ScreenPlaySysInfo.* into qt qml plugins folder
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlaySysInfo> COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlaySysInfo> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlaySysInfo>)
${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlaySysInfo>)

View File

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

View File

@ -1,5 +1,4 @@
project(ScreenPlayWidget LANGUAGES CXX) project(ScreenPlayWidget LANGUAGES CXX)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
@ -7,18 +6,12 @@ set(CMAKE_AUTOMOC ON)
find_package( find_package(
Qt5 Qt5
COMPONENTS Quick COMPONENTS Quick Widgets Gui QuickCompiler WebEngine
Widgets
Gui
QuickCompiler
WebEngine
REQUIRED) REQUIRED)
set(src main.cpp set(src main.cpp src/widgetwindow.cpp)
src/widgetwindow.cpp)
set(headers set(headers src/widgetwindow.h)
src/widgetwindow.h)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(resources SPWidgetResources.qrc) set(resources SPWidgetResources.qrc)
@ -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 # 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) 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
)