From 8b347cad9f2331e8fcf59fb40c7f5914a68e19d2 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Mon, 16 Mar 2020 11:50:35 +0100 Subject: [PATCH] Fix version an add auto install script to replace install-dependencies --- ScreenPlay/CMakeLists.txt | 66 +++++++++++++++++++++++++++++- ScreenPlaySDK/CMakeLists.txt | 2 +- ScreenPlaySysInfo/CMakeLists.txt | 2 +- ScreenPlayWallpaper/CMakeLists.txt | 2 +- ScreenPlayWidget/CMakeLists.txt | 2 +- 5 files changed, 68 insertions(+), 6 deletions(-) diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 580052b9..cd02db63 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -1,13 +1,75 @@ -cmake_minimum_required(VERSION 3.0.0 ) +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}) + + 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(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 src/createimportvideo.cpp @@ -45,6 +107,6 @@ set(headers app.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\\\") +#target_compile_definitions( PRIVATE GIT_VERSION=///"$$GIT_VERSION///") install(TARGETS DESTINATION Bin) diff --git a/ScreenPlaySDK/CMakeLists.txt b/ScreenPlaySDK/CMakeLists.txt index 4f19684f..005851b3 100644 --- a/ScreenPlaySDK/CMakeLists.txt +++ b/ScreenPlaySDK/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0 ) +cmake_minimum_required(VERSION 3.16.0) project(ScreenPlaySDK) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) diff --git a/ScreenPlaySysInfo/CMakeLists.txt b/ScreenPlaySysInfo/CMakeLists.txt index 885e52de..9b2fc604 100644 --- a/ScreenPlaySysInfo/CMakeLists.txt +++ b/ScreenPlaySysInfo/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0 ) +cmake_minimum_required(VERSION 3.16.0) project(ScreenPlaySysInfo) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) diff --git a/ScreenPlayWallpaper/CMakeLists.txt b/ScreenPlayWallpaper/CMakeLists.txt index 00b763be..3289fb61 100644 --- a/ScreenPlayWallpaper/CMakeLists.txt +++ b/ScreenPlayWallpaper/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0 ) +cmake_minimum_required(VERSION 3.16.0) project(ScreenPlayWallpaper) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTORCC ON) diff --git a/ScreenPlayWidget/CMakeLists.txt b/ScreenPlayWidget/CMakeLists.txt index b4c0baa7..7d00b187 100644 --- a/ScreenPlayWidget/CMakeLists.txt +++ b/ScreenPlayWidget/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0 ) +cmake_minimum_required(VERSION 3.16.0) project(ScreenPlayWidget) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTORCC ON)