vcpkg/ports/qt5-base/cmake/configure_qt.cmake

152 lines
8.3 KiB
CMake
Raw Normal View History

function(configure_qt)
cmake_parse_arguments(_csc "" "SOURCE_PATH;TARGET_PLATFORM;HOST_PLATFORM;HOST_TOOLS_ROOT" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN})
if(NOT _csc_TARGET_PLATFORM)
message(FATAL_ERROR "configure_qt requires a TARGET_PLATFORM argument.")
endif()
if(DEFINED _csc_HOST_PLATFORM)
list(APPEND _csc_OPTIONS -platform ${_csc_HOST_PLATFORM})
endif()
if(DEFINED _csc_HOST_TOOLS_ROOT)
## vcpkg internal file struture assumed here!
message(STATUS "Building Qt with prepared host tools from ${_csc_HOST_TOOLS_ROOT}!")
vcpkg_add_to_path("${_csc_HOST_TOOLS_ROOT}/bin")
vcpkg_add_to_path("${_csc_HOST_TOOLS_ROOT}")
set(EXT_BIN_DIR -external-hostbindir ${_csc_HOST_TOOLS_ROOT}/bin) # we only use release binaries for building
find_program(QMAKE_COMMAND NAMES qmake PATHS ${_csc_HOST_TOOLS_ROOT}/bin NO_DEFAULT_PATH)
set(INVOKE "${QMAKE_COMMAND}" )
else()
if(CMAKE_HOST_WIN32)
set(CONFIGURE_BAT "configure.bat")
else()
set(CONFIGURE_BAT "configure")
endif()
set(INVOKE "${_csc_SOURCE_PATH}/${CONFIGURE_BAT}")
endif()
#Cleanup previous build folders
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
#Find and ad Perl to PATH
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
vcpkg_add_to_path("${PERL_EXE_PATH}")
if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static")
list(APPEND _csc_OPTIONS -static)
else()
#list(APPEND _csc_OPTIONS_DEBUG -separate-debug-info)
endif()
if(VCPKG_TARGET_IS_WINDOWS AND "${VCPKG_CRT_LINKAGE}" STREQUAL "static")
list(APPEND _csc_OPTIONS -static-runtime)
endif()
list(APPEND _csc_OPTIONS_RELEASE -release)
list(APPEND _csc_OPTIONS_DEBUG -debug)
#Replace with VCPKG variables if PR #7733 is merged
unset(BUILDTYPES)
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug")
set(_buildname "DEBUG")
list(APPEND BUILDTYPES ${_buildname})
set(_short_name_${_buildname} "dbg")
set(_path_suffix_${_buildname} "/debug")
set(_build_type_${_buildname} "debug")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release")
set(_buildname "RELEASE")
list(APPEND BUILDTYPES ${_buildname})
set(_short_name_${_buildname} "rel")
set(_path_suffix_${_buildname} "")
set(_build_type_${_buildname} "release")
endif()
unset(_buildname)
vcpkg_find_acquire_program(PKGCONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}")
get_filename_component(PKGCONFIG_PATH "${PKGCONFIG}" DIRECTORY)
vcpkg_add_to_path("${PKGCONFIG_PATH}")
foreach(_buildname ${BUILDTYPES})
set(PKGCONFIG_INSTALLED_DIR "${_VCPKG_INSTALLED_PKGCONF}${_path_suffix_${_buildname}}/lib/pkgconfig")
set(PKGCONFIG_INSTALLED_SHARE_DIR "${_VCPKG_INSTALLED_PKGCONF}/share/pkgconfig")
set(PKGCONFIG_PACKAGES_DIR "${_VCPKG_PACKAGES_PKGCONF}${_path_suffix_${_buildname}}/lib/pkgconfig")
set(PKGCONFIG_PACKAGES_SHARE_DIR "${_VCPKG_PACKAGES_PKGCONF}/share/pkgconfig")
if(DEFINED ENV{PKG_CONFIG_PATH})
set(BACKUP_ENV_PKG_CONFIG_PATH_${_config} $ENV{PKG_CONFIG_PATH})
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}")
else()
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}")
endif()
set(_build_triplet ${TARGET_TRIPLET}-${_short_name_${_buildname}})
message(STATUS "Configuring ${_build_triplet}")
set(_build_dir "${CURRENT_BUILDTREES_DIR}/${_build_triplet}")
file(MAKE_DIRECTORY ${_build_dir})
# These paths get hardcoded into qmake. So point them into the CURRENT_INSTALLED_DIR instead of CURRENT_PACKAGES_DIR
# makefiles will be fixed to install into CURRENT_PACKAGES_DIR in install_qt
set(BUILD_OPTIONS ${_csc_OPTIONS} ${_csc_OPTIONS_${_buildname}}
-prefix ${CURRENT_INSTALLED_DIR}
#-extprefix ${CURRENT_INSTALLED_DIR}
${EXT_BIN_DIR}
-hostprefix ${CURRENT_INSTALLED_DIR}/tools/qt5${_path_suffix_${_buildname}}
[Qt[latest]] Update to 5.14.2 (#10644) * make qt5 all features and add the missing qt modules * fix control * qt5 webengine enviromnent setup * copy qtminimal plugin to tools * add opengles3 option for testing * [qt5-imageformats] freeglut is not a dependency on osx * [qt5-base] fontconfig can require iconv on linux and osx * include the jasper fix to get CI coverage? * trying to get ci coverage for qt on osx * Revert "trying to get ci coverage for qt on osx" This reverts commit 8b9b188839ec90c25b54b49d17cf03c50987a49b. * apply the correct ci hack * fix wrapper to include macosx debug suffix * update baseline * first try to fix the Qt5 cmake configs at the root. * fix missing backslash * fix plugin patch * fix qt config patch * remove 90% of fixcmake.py * update baseline * experimental removal of fixcmake.py and dll copying into tools/qt5/bin * fix experimental dll copying. * fix static windows builds * fix static builds * fix plugin copy * add quotes around configuration to make it work * remove dll debug messages * note about the cmake fix * revert fontconfig changes on linux. Make qt.conf relative and not absolute * make qt.conf relative * trying to fix ogre osx ci regression * fix silly path error * Revert "trying to fix ogre osx ci regression" This reverts commit 708d8250d6eae81bb9a030ff7edef22d2ea1e67c. * add ogre:x64-osx=fail to CI baseline * retry on osx * fix configure error. since in qt5-base everything is in the package directory and not in the installed * revert change to ci.baseline * update ci baseline * update Qt Control fields * update qt hashes to 5.12.7 * update baseline update missing hashes update empty include/packages add info for placeholder ports not yet correctly working (e.g. qt5-wayland) * fix linux qt targets not having debug properties. * remove most of the wrapper * actual forgot to commit the prl parser * fix the config a bit differently. have to check linux configs again * add xlib patch. * make qt-base fail to get logs on linux * Need logs from qt5-base * update versions I missed * ws change * lets see if this is enough to make qt5-x11extras happy * add upstream patch. * add newline to patch * ws change to trigger rebuild and maybe get logs on osx failure * need generated cmakescripts to check linkage. * rename cmake files to end on .log so that i can inspect them after CI failure * fix patch * make qt run * androidextras only supports android * qt5-doc will only be build on linux * ws ci trigger due to download failure * WS to retrigger CI due to download failure * add code for debug tools * lets see if we can do it with only the release tools * update baseline * fix create link error on linx * update baseline * revert changes which tried to use release tools only * fix dependencies * add debug qt.conf * add another copyright install * qtdoc does not have any include files * fix wrong copy pasta * update latest port hashes. * make the patches versions dependent * cleanup qt5 control a bit * update qt5-base control for ci run to use latest * fix patches for latest * forgot to commit the portfile changes * fix imageformat dependencies for latest qt * update last hash * fix translations dependencies * get cmake scripts from CI * new patch for creating correct configs * patch precompiled headers away from qt5-webengine * fix patch for 5.12.7. (Patch was for 5.14.1) * trigger CI rebuild * add simple gl path to fix the chormium build error * comment out debug message from prl parser * bump control * update webengine control * update CI to skip webengine. * update baseline * ws change to osg-qt * remove kd-soap from faillist * reset ci baseline to upstream/master * update baseline * fix osg-qt? * skip ms-angle on osx and linux since the normal angle port should be used! * update ci baseline * try adding fontconfig manually * update ci baseline to remove osg-qt for the time being * remove manual library. * remove wrapper and get plugin info also from linux and osx * allow build of complete qt * fix missing parameter in populate plugin. * need more info from CI * fix foreach CI loop * comment out CI code colllection to make a full qt5 ci run * fix qt5-imageformats regression on linux * update baseline * - add patch to find the debug library - manually fix EGL path in Qt5GuiConfigExtras.cmake * bump control * update hashes to 5.14.2 * comment out messages for debugging * bump version in control * fix create cmake patch * add qtmain path corrections for single configuration build. * fix escaping of . in regex * remove one to many \\ * remove latest as a default feature * reenable messages to debug osg-qt issue on osx. * small cmake options details. might need to patch cmakelists.txt if this is not working * remove unnecessary comment * make prl parser silent again. * remove canvas3d from the default features since it has been deprecated and will be removed in the future * remove ws change * remove newline and ws * trigger ci test * revert 199a3ef92f83775a61bd0f9beee0c48698bff1b6 * add messages to qt5-webengine and adjust baseline * add jpeg and zlib to JASPER_LIBS Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2020-04-24 12:19:45 +08:00
#-hostprefix ${CURRENT_INSTALLED_DIR}/tools/qt5
-hostlibdir ${CURRENT_INSTALLED_DIR}/tools/qt5${_path_suffix_${_buildname}}/lib # could probably be move to manual-link
-hostbindir ${CURRENT_INSTALLED_DIR}/tools/qt5${_path_suffix_${_buildname}}/bin
[Qt[latest]] Update to 5.14.2 (#10644) * make qt5 all features and add the missing qt modules * fix control * qt5 webengine enviromnent setup * copy qtminimal plugin to tools * add opengles3 option for testing * [qt5-imageformats] freeglut is not a dependency on osx * [qt5-base] fontconfig can require iconv on linux and osx * include the jasper fix to get CI coverage? * trying to get ci coverage for qt on osx * Revert "trying to get ci coverage for qt on osx" This reverts commit 8b9b188839ec90c25b54b49d17cf03c50987a49b. * apply the correct ci hack * fix wrapper to include macosx debug suffix * update baseline * first try to fix the Qt5 cmake configs at the root. * fix missing backslash * fix plugin patch * fix qt config patch * remove 90% of fixcmake.py * update baseline * experimental removal of fixcmake.py and dll copying into tools/qt5/bin * fix experimental dll copying. * fix static windows builds * fix static builds * fix plugin copy * add quotes around configuration to make it work * remove dll debug messages * note about the cmake fix * revert fontconfig changes on linux. Make qt.conf relative and not absolute * make qt.conf relative * trying to fix ogre osx ci regression * fix silly path error * Revert "trying to fix ogre osx ci regression" This reverts commit 708d8250d6eae81bb9a030ff7edef22d2ea1e67c. * add ogre:x64-osx=fail to CI baseline * retry on osx * fix configure error. since in qt5-base everything is in the package directory and not in the installed * revert change to ci.baseline * update ci baseline * update Qt Control fields * update qt hashes to 5.12.7 * update baseline update missing hashes update empty include/packages add info for placeholder ports not yet correctly working (e.g. qt5-wayland) * fix linux qt targets not having debug properties. * remove most of the wrapper * actual forgot to commit the prl parser * fix the config a bit differently. have to check linux configs again * add xlib patch. * make qt-base fail to get logs on linux * Need logs from qt5-base * update versions I missed * ws change * lets see if this is enough to make qt5-x11extras happy * add upstream patch. * add newline to patch * ws change to trigger rebuild and maybe get logs on osx failure * need generated cmakescripts to check linkage. * rename cmake files to end on .log so that i can inspect them after CI failure * fix patch * make qt run * androidextras only supports android * qt5-doc will only be build on linux * ws ci trigger due to download failure * WS to retrigger CI due to download failure * add code for debug tools * lets see if we can do it with only the release tools * update baseline * fix create link error on linx * update baseline * revert changes which tried to use release tools only * fix dependencies * add debug qt.conf * add another copyright install * qtdoc does not have any include files * fix wrong copy pasta * update latest port hashes. * make the patches versions dependent * cleanup qt5 control a bit * update qt5-base control for ci run to use latest * fix patches for latest * forgot to commit the portfile changes * fix imageformat dependencies for latest qt * update last hash * fix translations dependencies * get cmake scripts from CI * new patch for creating correct configs * patch precompiled headers away from qt5-webengine * fix patch for 5.12.7. (Patch was for 5.14.1) * trigger CI rebuild * add simple gl path to fix the chormium build error * comment out debug message from prl parser * bump control * update webengine control * update CI to skip webengine. * update baseline * ws change to osg-qt * remove kd-soap from faillist * reset ci baseline to upstream/master * update baseline * fix osg-qt? * skip ms-angle on osx and linux since the normal angle port should be used! * update ci baseline * try adding fontconfig manually * update ci baseline to remove osg-qt for the time being * remove manual library. * remove wrapper and get plugin info also from linux and osx * allow build of complete qt * fix missing parameter in populate plugin. * need more info from CI * fix foreach CI loop * comment out CI code colllection to make a full qt5 ci run * fix qt5-imageformats regression on linux * update baseline * - add patch to find the debug library - manually fix EGL path in Qt5GuiConfigExtras.cmake * bump control * update hashes to 5.14.2 * comment out messages for debugging * bump version in control * fix create cmake patch * add qtmain path corrections for single configuration build. * fix escaping of . in regex * remove one to many \\ * remove latest as a default feature * reenable messages to debug osg-qt issue on osx. * small cmake options details. might need to patch cmakelists.txt if this is not working * remove unnecessary comment * make prl parser silent again. * remove canvas3d from the default features since it has been deprecated and will be removed in the future * remove ws change * remove newline and ws * trigger ci test * revert 199a3ef92f83775a61bd0f9beee0c48698bff1b6 * add messages to qt5-webengine and adjust baseline * add jpeg and zlib to JASPER_LIBS Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2020-04-24 12:19:45 +08:00
#-hostbindir ${CURRENT_INSTALLED_DIR}/tools/qt5/bin
# Qt VS Plugin requires a /bin subfolder with the executables in the root dir. But to use the wizard a correctly setup lib folder is also required
# So with the vcpkg layout there is no way to make it work unless all dll are are copied to tools/qt5/bin and all libs to tools/qt5/lib
-archdatadir ${CURRENT_INSTALLED_DIR}/tools/qt5${_path_suffix_${_buildname}}
-datadir ${CURRENT_INSTALLED_DIR}${_path_suffix}/share/qt5${_path_suffix_${_buildname}}
-plugindir ${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/plugins
-qmldir ${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/qml
-headerdir ${CURRENT_INSTALLED_DIR}/include/qt5
-libexecdir ${CURRENT_INSTALLED_DIR}/tools/qt5${_path_suffix_${_buildname}}
-bindir ${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/bin
-libdir ${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/lib
-I ${CURRENT_INSTALLED_DIR}/include
-I ${CURRENT_INSTALLED_DIR}/include/qt5
-L ${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/lib
-L ${CURRENT_INSTALLED_DIR}${_path_suffix_${_buildname}}/lib/manual-link
-platform ${_csc_TARGET_PLATFORM}
)
if(DEFINED _csc_HOST_TOOLS_ROOT) #use qmake
if(WIN32)
set(INVOKE_OPTIONS "QMAKE_CXX.QMAKE_MSC_VER=1911" "QMAKE_MSC_VER=1911")
endif()
vcpkg_execute_required_process(
COMMAND ${INVOKE} "${_csc_SOURCE_PATH}" "${INVOKE_OPTIONS}" -- ${BUILD_OPTIONS}
WORKING_DIRECTORY ${_build_dir}
LOGNAME config-${_build_triplet}
)
else()# call configure (builds qmake for triplet and calls it like above)
vcpkg_execute_required_process(
COMMAND "${INVOKE}" ${BUILD_OPTIONS}
WORKING_DIRECTORY ${_build_dir}
LOGNAME config-${_build_triplet}
)
endif()
# Note archdatadir and datadir are required to be prefixed with the hostprefix?
message(STATUS "Configuring ${_build_triplet} done")
# Copy configuration dependent qt.conf
file(TO_CMAKE_PATH "${CURRENT_PACKAGES_DIR}" CMAKE_CURRENT_PACKAGES_DIR_PATH)
file(TO_CMAKE_PATH "${CURRENT_INSTALLED_DIR}" CMAKE_CURRENT_INSTALLED_DIR_PATH)
file(READ "${CURRENT_BUILDTREES_DIR}/${_build_triplet}/bin/qt.conf" _contents)
string(REPLACE "${CMAKE_CURRENT_PACKAGES_DIR_PATH}" "\${CURRENT_INSTALLED_DIR}" _contents ${_contents})
string(REPLACE "${CMAKE_CURRENT_INSTALLED_DIR_PATH}" "\${CURRENT_INSTALLED_DIR}" _contents ${_contents})
#string(REPLACE "HostPrefix=\${CURRENT_PACKAGES_DIR}" "HostPrefix=\${CURRENT_INSTALLED_DIR}" _contents ${_contents})
string(REPLACE "[EffectivePaths]\nPrefix=..\n" "" _contents ${_contents})
string(REPLACE "[EffectiveSourcePaths]\nPrefix=${_csc_SOURCE_PATH}\n" "" _contents ${_contents})
string(REPLACE "Sysroot=\n" "" _contents ${_contents})
string(REPLACE "SysrootifyPrefix=false\n" "" _contents ${_contents})
file(WRITE "${CURRENT_PACKAGES_DIR}/tools/qt5/qt_${_build_type_${_buildname}}.conf" "${_contents}")
endforeach()
endfunction()