forked from qt-creator/qt-creator
auto-setup: cleanup script
Remove the Qt SDK detection of conan. This is no longer valid with the
scripts being copied to ${buildDir}/.qtc/. Qt SDK also doesn't ship
conan anymore.
Do validation for conan via "conan --version" and vcpkg via "vcpkg
version".
For vcpkg the program path is resolved for symlinks and for Windows the
target architecture is being detected from the compiler path.
Change-Id: If0da79c952392d5ac9f8352e262b0802d6eb9ed3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -31,32 +31,6 @@ macro(qtc_auto_setup_conan)
|
|||||||
option(QT_CREATOR_SKIP_CONAN_SETUP "Skip Qt Creator's conan package manager auto-setup" OFF)
|
option(QT_CREATOR_SKIP_CONAN_SETUP "Skip Qt Creator's conan package manager auto-setup" OFF)
|
||||||
set(QT_CREATOR_CONAN_BUILD_POLICY "missing" CACHE STRING "Qt Creator's conan package manager auto-setup build policy. This is used for the BUILD property of cmake_conan_run")
|
set(QT_CREATOR_CONAN_BUILD_POLICY "missing" CACHE STRING "Qt Creator's conan package manager auto-setup build policy. This is used for the BUILD property of cmake_conan_run")
|
||||||
|
|
||||||
# Get conan from Qt SDK
|
|
||||||
set(qt_creator_ini "${CMAKE_CURRENT_LIST_DIR}/../QtProject/QtCreator.ini")
|
|
||||||
if (EXISTS ${qt_creator_ini})
|
|
||||||
file(STRINGS ${qt_creator_ini} install_settings REGEX "^InstallSettings=.*$")
|
|
||||||
if (install_settings)
|
|
||||||
string(REPLACE "InstallSettings=" "" install_settings "${install_settings}")
|
|
||||||
set(qt_creator_ini "${install_settings}/QtProject/QtCreator.ini")
|
|
||||||
file(TO_CMAKE_PATH "${qt_creator_ini}" qt_creator_ini)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(STRINGS ${qt_creator_ini} conan_executable REGEX "^ConanFilePath=.*$")
|
|
||||||
if (conan_executable)
|
|
||||||
string(REPLACE "ConanFilePath=" "" conan_executable "${conan_executable}")
|
|
||||||
file(TO_CMAKE_PATH "${conan_executable}" conan_executable)
|
|
||||||
get_filename_component(conan_path "${conan_executable}" DIRECTORY)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(path_sepparator ":")
|
|
||||||
if (WIN32)
|
|
||||||
set(path_sepparator ";")
|
|
||||||
endif()
|
|
||||||
if (conan_path)
|
|
||||||
set(ENV{PATH} "${conan_path}${path_sepparator}$ENV{PATH}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(conan_program conan)
|
find_program(conan_program conan)
|
||||||
if (NOT conan_program)
|
if (NOT conan_program)
|
||||||
message(WARNING "Qt Creator: conan executable not found. "
|
message(WARNING "Qt Creator: conan executable not found. "
|
||||||
@@ -64,6 +38,13 @@ macro(qtc_auto_setup_conan)
|
|||||||
"To disable this warning set QT_CREATOR_SKIP_CONAN_SETUP to ON.")
|
"To disable this warning set QT_CREATOR_SKIP_CONAN_SETUP to ON.")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
execute_process(COMMAND ${conan_program} --version
|
||||||
|
RESULT_VARIABLE result_code
|
||||||
|
OUTPUT_VARIABLE conan_version_output
|
||||||
|
ERROR_VARIABLE conan_version_output)
|
||||||
|
if (NOT result_code EQUAL 0)
|
||||||
|
message(FATAL_ERROR "conan --version failed='${result_code}: ${conan_version_output}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(conanfile_timestamp_file "${CMAKE_BINARY_DIR}/conan-dependencies/conanfile.timestamp")
|
set(conanfile_timestamp_file "${CMAKE_BINARY_DIR}/conan-dependencies/conanfile.timestamp")
|
||||||
file(TIMESTAMP "${conanfile_txt}" conanfile_timestamp)
|
file(TIMESTAMP "${conanfile_txt}" conanfile_timestamp)
|
||||||
@@ -147,7 +128,17 @@ macro(qtc_auto_setup_vcpkg)
|
|||||||
"To disable this warning set QT_CREATOR_SKIP_VCPKG_SETUP to ON.")
|
"To disable this warning set QT_CREATOR_SKIP_VCPKG_SETUP to ON.")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
get_filename_component(vpkg_root ${vcpkg_program} DIRECTORY)
|
execute_process(COMMAND ${vcpkg_program} version
|
||||||
|
RESULT_VARIABLE result_code
|
||||||
|
OUTPUT_VARIABLE vcpkg_version_output
|
||||||
|
ERROR_VARIABLE vcpkg_version_output)
|
||||||
|
if (NOT result_code EQUAL 0)
|
||||||
|
message(FATAL_ERROR "vcpkg version failed='${result_code}: ${vcpkg_version_output}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Resolve any symlinks
|
||||||
|
get_filename_component(vpkg_program_real_path ${vcpkg_program} REALPATH)
|
||||||
|
get_filename_component(vpkg_root ${vpkg_program_real_path} DIRECTORY)
|
||||||
|
|
||||||
if (NOT EXISTS "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake")
|
if (NOT EXISTS "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake")
|
||||||
message(STATUS "Qt Creator: vcpkg package manager auto-setup. "
|
message(STATUS "Qt Creator: vcpkg package manager auto-setup. "
|
||||||
@@ -168,8 +159,8 @@ macro(qtc_auto_setup_vcpkg)
|
|||||||
else()
|
else()
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(vcpkg_triplet x64-mingw-static)
|
set(vcpkg_triplet x64-mingw-static)
|
||||||
if (CMAKE_CXX_COMPILER MATCHES "cl.exe")
|
if (CMAKE_CXX_COMPILER MATCHES ".*/(.*)/cl.exe")
|
||||||
set(vcpkg_triplet x64-windows)
|
set(vcpkg_triplet ${CMAKE_MATCH_1}-windows)
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(vcpkg_triplet x64-osx)
|
set(vcpkg_triplet x64-osx)
|
||||||
|
|||||||
Reference in New Issue
Block a user