set up appveyor and improve qt version finding
This commit is contained in:
parent
662ca45321
commit
43aa1d6711
67
.appveyor.yml
Normal file
67
.appveyor.yml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
version: '{branch}-{build}'
|
||||||
|
# build Configuration
|
||||||
|
configuration: Release
|
||||||
|
# clone directory
|
||||||
|
clone_folder: C:\Textractor
|
||||||
|
# Do not build feature branch with open Pull Requests
|
||||||
|
skip_branch_with_pr: false
|
||||||
|
# environment variables
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
# platform: x64
|
||||||
|
# msvc_name: Visual Studio 15 2017 Win64
|
||||||
|
# suffix: Win64
|
||||||
|
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
# platform: Win32
|
||||||
|
# msvc_name: Visual Studio 15 2017
|
||||||
|
# suffix: Win32
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
msvc_name: Visual Studio 16 2019
|
||||||
|
platform: x64
|
||||||
|
qtbin: msvc2017_64
|
||||||
|
suffix: x64
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
msvc_name: Visual Studio 16 2019
|
||||||
|
platform: Win32
|
||||||
|
qtbin: msvc2017
|
||||||
|
suffix: x86
|
||||||
|
|
||||||
|
before_build:
|
||||||
|
- cd C:\
|
||||||
|
- mkdir %suffix%
|
||||||
|
- cd %suffix%
|
||||||
|
- cmake -G "%msvc_name%" -A "%platform%" -DQt5_DIR="C:\Qt\5.13\%qtbin%\lib\cmake\Qt5" -DCMAKE_BUILD_TYPE="Release" ../Textractor
|
||||||
|
|
||||||
|
build:
|
||||||
|
project: C:\%suffix%\Textractor.sln
|
||||||
|
parallel: true
|
||||||
|
verbosity: normal
|
||||||
|
|
||||||
|
#after_test:
|
||||||
|
# - ps: if($env:APPVEYOR_REPO_BRANCH -eq "release" -and $env:packaging -eq "true") { $env:PUBLISH_BINARY = 'true' }
|
||||||
|
# - ps: if($env:APPVEYOR_REPO_COMMIT_MESSAGE.contains('[publish]') -and $env:packaging -eq "true") { $env:PUBLISH_BINARY = 'true' }
|
||||||
|
# - if [%PUBLISH_BINARY%]==[true] cmake --build c:\stellarium\build-%qtver%-%qtbin%\ --config %configuration% --target install
|
||||||
|
# - if [%PUBLISH_BINARY%]==[true] appveyor DownloadFile https://github.com/Stellarium/stellarium-data/releases/download/qt-5.6/libGLES-%suffix%.zip -FileName c:\stellarium\build-%qtver%-%qtbin%\libGLES.zip
|
||||||
|
# - if [%PUBLISH_BINARY%]==[true] 7z e c:\stellarium\build-%qtver%-%qtbin%\libGLES.zip -aoa -oc:\stellarium-%qtver%-%qtbin%\qt5stuff
|
||||||
|
# - if [%PUBLISH_BINARY%]==[true] cmake --build c:\stellarium\build-%qtver%-%qtbin%\ --config %configuration% --target stellarium-installer
|
||||||
|
# - if [%PUBLISH_BINARY%]==[true] cd c:\stellarium\installers
|
||||||
|
# - if [%PUBLISH_BINARY%]==[true] for %%i in (*.exe) do appveyor PushArtifact %%i
|
||||||
|
#
|
||||||
|
## deployment
|
||||||
|
#deploy:
|
||||||
|
#- provider: Webhook
|
||||||
|
# url: https://app.signpath.io/API/v1/a6a9173a-feb5-41ae-8973-8ca75af5e233/Integrations/AppVeyor?ProjectKey=stellarium&SigningPolicyKey=release-signing
|
||||||
|
# authorization:
|
||||||
|
# secure: k9Hka8MA6UONiSbKZeAv5koMEljPXgEZ7o1FbvEHRlPFFHMGzQcS6MQsvy53VxeTpG4Kw98FU0VXusbXoKLzug==
|
||||||
|
# on:
|
||||||
|
# branch: release
|
||||||
|
# packaging: true
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
- provider: Email
|
||||||
|
to:
|
||||||
|
- akashmozumdar@gmail.com
|
||||||
|
on_build_success: false
|
||||||
|
on_build_failure: true
|
||||||
|
on_build_status_changed: true
|
@ -1,89 +1,82 @@
|
|||||||
macro(msvc_registry_search)
|
macro(msvc_registry_search)
|
||||||
IF(MSVC)
|
if(NOT DEFINED Qt5_DIR AND MSVC)
|
||||||
# look for user-registry pointing to qtcreator
|
# look for user-registry pointing to qtcreator
|
||||||
get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
|
get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
|
||||||
|
|
||||||
# get root path so we can search for 5.3, 5.4, 5.5, etc
|
# get root path so we can search for 5.3, 5.4, 5.5, etc
|
||||||
string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
|
string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
|
||||||
list(GET QT_BIN 0 QT_BIN)
|
list(GET QT_BIN 0 QT_BIN)
|
||||||
file(GLOB QT_VERSIONS "${QT_BIN}/5.*")
|
file(GLOB QT_VERSIONS "${QT_BIN}/5.1*")
|
||||||
list(SORT QT_VERSIONS)
|
list(SORT QT_VERSIONS)
|
||||||
|
|
||||||
# assume the latest version will be last alphabetically
|
# assume the latest version will be last alphabetically
|
||||||
list(REVERSE QT_VERSIONS)
|
list(REVERSE QT_VERSIONS)
|
||||||
|
|
||||||
list(GET QT_VERSIONS 0 QT_VERSION)
|
list(GET QT_VERSIONS 0 QT_VERSION)
|
||||||
|
|
||||||
# fix any double slashes which seem to be common
|
# fix any double slashes which seem to be common
|
||||||
string(REPLACE "//" "/" QT_VERSION "${QT_VERSION}")
|
string(REPLACE "//" "/" QT_VERSION "${QT_VERSION}")
|
||||||
|
|
||||||
if(MSVC_VERSION GREATER_EQUAL "1910")
|
if(MSVC_VERSION GREATER_EQUAL 1920)
|
||||||
set(QT_MSVC "2017")
|
set(QT_MSVC 2019)
|
||||||
elseif(MSVC_VERSION GREATER_EQUAL "1900")
|
elseif(MSVC_VERSION GREATER_EQUAL 1910)
|
||||||
set(QT_MSVC "2015")
|
set(QT_MSVC 2017)
|
||||||
else()
|
elseif(MSVC_VERSION GREATER_EQUAL 1900)
|
||||||
# Latest QT versions >5.10 provides only 2015 and 2017 prebuilt binaries
|
set(QT_MSVC 2015)
|
||||||
message(WARNING "Unsupported MSVC toolchain version")
|
else()
|
||||||
endif()
|
message(WARNING "Unsupported MSVC toolchain version")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(QT_MSVC)
|
if(QT_MSVC)
|
||||||
# check for 64-bit target
|
if(CMAKE_CL_64)
|
||||||
if(CMAKE_CL_64)
|
SET(QT_SUFFIX "_64")
|
||||||
SET(QT_MSVC "${QT_MSVC}_64")
|
else()
|
||||||
endif()
|
set(QT_SUFFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(QT_TOOLCHAIN "${QT_VERSION}/msvc${QT_MSVC}")
|
# MSVC 2015+ is only backwards compatible
|
||||||
if(EXISTS ${QT_TOOLCHAIN})
|
if(EXISTS "${QT_VERSION}/msvc${QT_MSVC}${QT_SUFFIX}")
|
||||||
set(Qt5_DIR "${QT_TOOLCHAIN}/lib/cmake/Qt5")
|
set(Qt5_DIR "${QT_VERSION}/msvc${QT_MSVC}${QT_SUFFIX}/lib/cmake/Qt5")
|
||||||
elseif(QT_MSVC EQUAL "2017")
|
elseif(QT_MSVC GREATER_EQUAL 2019 AND EXISTS "${QT_VERSION}/msvc2017${QT_SUFFIX}")
|
||||||
#2017 is ABI compatible with 2015
|
set(Qt5_DIR "${QT_VERSION}/msvc2017${QT_SUFFIX}/lib/cmake/Qt5")
|
||||||
if(CMAKE_CL_64)
|
elseif(QT_MSVC GREATER_EQUAL 2017 AND EXISTS "${QT_VERSION}/msvc2015${QT_SUFFIX}")
|
||||||
set(QT_TOOLCHAIN "${QT_VERSION}/msvc2015_64")
|
set(Qt5_DIR "${QT_VERSION}/msvc2015${QT_SUFFIX}/lib/cmake/Qt5")
|
||||||
else()
|
else()
|
||||||
set(QT_TOOLCHAIN "${QT_VERSION}/msvc2015")
|
message(WARNING "Required QT5 toolchain is not installed")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
if(EXISTS ${QT_TOOLCHAIN})
|
endif()
|
||||||
set(Qt5_DIR "${QT_TOOLCHAIN}/lib/cmake/Qt5")
|
|
||||||
else()
|
|
||||||
message(WARNING "Required QT5 toolchain is not installed")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(WARNING "Required QT5 toolchain is not installed")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
ENDIF()
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(find_qt5)
|
macro(find_qt5)
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
#set(CMAKE_AUTOMOC ON)
|
#set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
|
add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
|
||||||
find_package(Qt5 COMPONENTS ${ARGN})
|
find_package(Qt5 COMPONENTS ${ARGN})
|
||||||
|
|
||||||
if(Qt5_FOUND)
|
if(Qt5_FOUND)
|
||||||
if(WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
if(WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
||||||
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
|
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX
|
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX
|
||||||
RESULT_VARIABLE return_code
|
RESULT_VARIABLE return_code
|
||||||
OUTPUT_VARIABLE qt5_install_prefix
|
OUTPUT_VARIABLE qt5_install_prefix
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe")
|
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe")
|
||||||
|
|
||||||
if(EXISTS ${imported_location})
|
if(EXISTS ${imported_location})
|
||||||
add_executable(Qt5::windeployqt IMPORTED)
|
add_executable(Qt5::windeployqt IMPORTED)
|
||||||
|
|
||||||
set_target_properties(Qt5::windeployqt PROPERTIES
|
set_target_properties(Qt5::windeployqt PROPERTIES
|
||||||
IMPORTED_LOCATION ${imported_location}
|
IMPORTED_LOCATION ${imported_location}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Cannot find QT5!")
|
message(FATAL_ERROR "Cannot find QT5!")
|
||||||
endif()
|
endif()
|
||||||
endmacro(find_qt5)
|
endmacro(find_qt5)
|
||||||
|
Loading…
Reference in New Issue
Block a user