1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-05 10:32:28 +01:00

Add first working cmake version for ScreenPlay

Refactor stomt sdk from qmake/github to cmake/gitlab
This commit is contained in:
Elias Steurer 2020-04-30 20:03:14 +02:00
parent 5d7a97ff8b
commit c7fd69a78e
14 changed files with 211 additions and 115 deletions

13
.gitignore vendored
View File

@ -75,3 +75,16 @@ Common/vcpkg/**
*.DS_Store
/Common/vcpkg/
/Docs/html/screemplay.index
#CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

4
.gitmodules vendored
View File

@ -4,3 +4,7 @@
[submodule "Common/qt-breakpad"]
path = Common/qt-breakpad
url = https://github.com/kelteseth/qt-breakpad
[submodule "Common/stomt-qml"]
path = Common/stomt-qml
url = https://gitlab.com/kelteseth/stomt-qml.git
branch = master

View File

@ -1,12 +1,40 @@
cmake_minimum_required(VERSION 3.0.0 )
cmake_minimum_required(VERSION 3.17.0 )
if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows")
elseif(APPLE)
set(VCPKG_TARGET_TRIPLET "x64-osx")
elseif(UNIX)
set(VCPKG_TARGET_TRIPLET "x64-linux")
endif()
set(ABSOLUTE_VCPKG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake)
# If setting the toolchain file fails we can the it inside QtCreator: Extras ->
# Tools -> Kits -> <Your Kit> -> CMake Configuration -> Append this:
# CMAKE_TOOLCHAIN_FILE:STRING=%{CurrentProject:Path}/Common/vcpkg/scripts/buildsystems/vcpkg.cmake
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE ${ABSOLUTE_VCPKG_PATH})
endif()
# This sets cmake to compile all dlls into the main directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_CXX_STANDARD 17)
set(QT_TELEMTRY_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-google-analytics/)
set(QT_BREAKPAD_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-breakpad/)
project(ScreenPlay)
add_subdirectory(ScreenPlay)
add_subdirectory(ScreenPlaySDK)
add_subdirectory(ScreenPlayWallpaper)
add_subdirectory(ScreenPlayWidget)
add_subdirectory(ScreenPlaySysInfo)
add_subdirectory(Common/stomt-qt-sdk/sdk)
add_subdirectory(Common/qt-google-analytics)
add_subdirectory(Common/stomt-qml)
add_subdirectory(Common/qt-breakpad)

1
Common/stomt-qml Submodule

@ -0,0 +1 @@
Subproject commit e7e871512a18d227652a5dd825415e3b59a01de0

View File

@ -1,77 +1,28 @@
cmake_minimum_required(VERSION 3.16.0)
set (DEPENDENCIES "openSSL"
"libzippp"
"nlohmann-json")
if(NOT DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../Common/vcpkg)
endif()
if(NOT EXISTS ${VCPKG_ROOT})
message("Cloning vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git clone https://github.com/Microsoft/vcpkg.git ${VCPKG_ROOT})
# execute_process(COMMAND git checkout 745a0aea597771a580d0b0f4886ea1e3a94dbca6 WORKING_DIRECTORY ${VCPKG_ROOT})
else()
# The following command has no effect if the vcpkg repository is in a detached head state.
message("Auto-updating vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git pull WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_ROOT}/README.md)
message(FATAL_ERROR "***** FATAL ERROR: Could not clone vcpkg *****")
endif()
if(WIN32)
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg.exe)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.bat)
else()
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.sh)
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message("Bootstrapping vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND ${VCPKG_BOOTSTRAP} WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message(FATAL_ERROR "***** FATAL ERROR: Could not bootstrap vcpkg *****")
endif()
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
message(STATUS "***** Checking project third party dependencies in ${VCPKG_ROOT} *****")
execute_process(COMMAND ${VCPKG_EXEC} install ${DEPENDENCIES} WORKING_DIRECTORY ${VCPKG_ROOT})
cmake_minimum_required(VERSION 3.17)
project(ScreenPlay)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Qml)
find_package(Qt5Quick)
find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5Core)
find_package(
Qt5
COMPONENTS Quick
QML
Widgets
Gui
WebEngine
REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
find_package(libzippp CONFIG REQUIRED)
target_link_libraries(main PRIVATE libzippp::libzippp)
find_package(nlohmann_json CONFIG REQUIRED)
target_link_libraries(main PRIVATE nlohmann_json nlohmann_json::nlohmann_json)
set(src main.cpp
app.cpp
../Common/qt-google-analytics/ganalytics.cpp
src/createimportvideo.cpp
src/installedlistmodel.cpp
src/monitorlistmodel.cpp
@ -85,7 +36,9 @@ set(src main.cpp
src/screenplaymanager.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
@ -105,8 +58,29 @@ set(headers app.h
src/create.h)
set(resources Resources.qrc)
add_executable(ScreenPlay ${src} ${headers} ${resources})
target_link_libraries(ScreenPlay Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core)
#target_compile_definitions( PRIVATE GIT_VERSION=///"$$GIT_VERSION///")
install(TARGETS DESTINATION Bin)
add_executable(ScreenPlay ${src} ${headers} ${resources})
target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}")
target_link_libraries(ScreenPlay PRIVATE
Qt5::Qml
Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
Qt5::WebEngine
nlohmann_json::nlohmann_json
libzippp::libzippp
ScreenPlaySDK
QTBreakpadplugin)
target_include_directories(${PROJECT_NAME}
PRIVATE
${QT_TELEMTRY_INCLUDE}
${QT_BREAKPAD_INCLUDE})
execute_process(COMMAND git log --pretty=format:'%h' -n 1
OUTPUT_VARIABLE GIT_VERSION
ERROR_QUIET)

View File

@ -110,7 +110,7 @@ Settings::Settings(const shared_ptr<GlobalVariables>& globalVariables,
}
setupWidgetAndWindowPaths();
setGitBuildHash(GIT_VERSION);
setGitBuildHash("GIT_VERSION");
}
/*!

View File

@ -1,16 +1,24 @@
cmake_minimum_required(VERSION 3.16.0)
project(ScreenPlaySDK)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core)
find_package(Qt5Quick)
find_package(Qt5Gui)
find_package(Qt5Qml)
find_package(
Qt5
COMPONENTS Quick
QML
Widgets
Gui
Network
Core
REQUIRED)
set(src screenplay-sdk_plugin.cpp
screenplaysdk.cpp)
set(headers screenplay-sdk_plugin.h
screenplaysdk.h)
add_library(screenplaysdk MODULE ${src} ${headers})
target_link_libraries(screenplaysdk PRIVATE Qt5::Core Qt5::Quick Qt5::Gui Qt5::Qml)
set_target_properties(screenplaysdk PROPERTIES DEBUG_POSTFIX "d")
install(TARGETS screenplaysdk DESTINATION Libs)
add_library(${PROJECT_NAME} ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui Qt5::Qml Qt5::Network)

View File

@ -1,11 +1,16 @@
cmake_minimum_required(VERSION 3.16.0)
project(ScreenPlaySysInfo)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core)
find_package(Qt5Quick)
find_package(Qt5Gui)
find_package(Qt5Qml)
find_package(
Qt5
COMPONENTS Quick
QML
Core
REQUIRED)
set(src screenplaysysinfo_plugin.cpp
sysinfo.cpp
cpu.cpp
@ -18,6 +23,7 @@ set(headers screenplaysysinfo_plugin.h
mathhelper.h
storage.h)
add_library(screenplaysysinfo MODULE ${src} ${headers})
target_link_libraries(screenplaysysinfo PRIVATE Qt5::Core Qt5::Quick Qt5::Gui Qt5::Qml)
install(TARGETS screenplaysysinfo DESTINATION Libs)
add_library(${PROJECT_NAME} ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Qml)

View File

@ -1,30 +1,58 @@
cmake_minimum_required(VERSION 3.16.0)
project(ScreenPlayWallpaper)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Qml)
find_package(Qt5Quick)
find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5Core)
set(src main.cpp
src/basewindow.cpp
src/linuxwindow.cpp
src/windowsdesktopproperties.cpp
src/winwindow.cpp
src/macintegration.cpp
src/macwindow.cpp)
set(headers src/basewindow.h
src/linuxwindow.h
src/windowsdesktopproperties.h
src/winwindow.h
src/macintegration.h
src/macbridge.h
src/macwindow.h)
find_package(
Qt5
COMPONENTS Quick
QML
Widgets
Gui
WebEngine
REQUIRED)
if(WIN32)
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)
elseif(UNIX)
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(resources SPWResources.qrc)
add_executable(ScreenPlayWallpaper ${src} ${headers} ${resources})
target_link_libraries( ScreenPlayWallpaper Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core)
add_executable(${PROJECT_NAME} ${src} ${headers} ${src_plattform} ${headers_plattform} ${resources})
install(TARGETS DESTINATION Bin)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Qml
Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
Qt5::WebEngine
ScreenPlaySDK
)

View File

@ -6,7 +6,6 @@
#include <QtWebEngine>
#if defined(Q_OS_WIN)
#include "qt_breakpad.h"
#include "src/winwindow.h"
#endif
@ -40,7 +39,6 @@ int main(int argc, char* argv[])
//Set the monitor number to test
#if defined(Q_OS_WIN)
QtBreakpad::init(QDir::current().absolutePath());
//WinWindow window1({ 0 }, "test", "appid", "1", "fill");
//WinWindow window2({ 1 }, "test", "appid", "1", "fill");

View File

@ -13,5 +13,14 @@ set(src main.cpp
set(headers src/widgetwindow.h)
set(resources SPWidgetResources.qrc)
add_executable(ScreenPlayWidget ${src} ${headers} ${resources})
target_link_libraries( ScreenPlayWidget Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core)
target_link_libraries( ScreenPlayWidget
PRIVATE
Qt5::Qml
Qt5::Quick
Qt5::Gui
Qt5::Widgets
Qt5::Core
ScreenPlaySDK
)

View File

@ -0,0 +1,16 @@
git submodule update --init
git submodule update --recursive
cd Common
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git pull
git checkout origin/master
chmod +x bootstrap-vcpkg.sh
./bootstrap-vcpkg.sh
chmod +x vcpkg
if [[ "$OSTYPE" == "darwin"* ]]; then
./vcpkg install libzippp:x64-osx nlohmann-json:x64-osx openssl-unix:x64-osx libzip:x64-osx
else
./vcpkg install libzippp:x64-linux nlohmann-json:x64-linux openssl-unix:x64-linux libzip:x64-linux
fi

View File

@ -0,0 +1,10 @@
git submodule update --init
git submodule update --recursive
cd Common
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git pull
git checkout 2bc6cd714
call bootstrap-vcpkg.bat
vcpkg.exe install zlib libzip libzippp nlohmann-json openssl breakpad --triplet x64-windows --recurse
pause

1
stomt-qml Submodule

@ -0,0 +1 @@
Subproject commit e7e871512a18d227652a5dd825415e3b59a01de0