diff options
Diffstat (limited to 'scripts/cmake')
| -rw-r--r-- | scripts/cmake/vcpkg_common_functions.cmake | 1 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_configure_qmake.cmake | 16 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_install_qmake.cmake | 64 |
3 files changed, 73 insertions, 8 deletions
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 4aa115f47..564ac9421 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -26,6 +26,7 @@ include(vcpkg_install_meson) include(vcpkg_install_msbuild) include(vcpkg_install_make) include(vcpkg_install_nmake) +include(vcpkg_install_qmake) include(vcpkg_configure_cmake) include(vcpkg_configure_meson) include(vcpkg_configure_qmake) diff --git a/scripts/cmake/vcpkg_configure_qmake.cmake b/scripts/cmake/vcpkg_configure_qmake.cmake index a04a4c8f6..ad5682a3d 100644 --- a/scripts/cmake/vcpkg_configure_qmake.cmake +++ b/scripts/cmake/vcpkg_configure_qmake.cmake @@ -26,7 +26,7 @@ function(vcpkg_configure_qmake) message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.") endif() - if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "static") + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") list(APPEND _csc_OPTIONS "CONFIG-=shared") list(APPEND _csc_OPTIONS "CONFIG*=static") else() @@ -35,10 +35,10 @@ function(vcpkg_configure_qmake) list(APPEND _csc_OPTIONS_DEBUG "CONFIG*=separate_debug_info") endif() - if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_CRT_LINKAGE} STREQUAL "static") + if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static") list(APPEND _csc_OPTIONS "CONFIG*=static-runtime") endif() - + # Cleanup build directories file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) @@ -55,9 +55,9 @@ function(vcpkg_configure_qmake) set(BUILD_OPT -- ${_csc_BUILD_OPTIONS} ${_csc_BUILD_OPTIONS_RELEASE}) endif() vcpkg_execute_required_process( - COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release - ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} ${_csc_SOURCE_PATH} - -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf" + COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release + ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} ${_csc_SOURCE_PATH} + -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf" ${BUILD_OPT} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME config-${TARGET_TRIPLET}-rel @@ -74,8 +74,8 @@ function(vcpkg_configure_qmake) set(BUILD_OPT -- ${_csc_BUILD_OPTIONS} ${_csc_BUILD_OPTIONS_DEBUG}) endif() vcpkg_execute_required_process( - COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug - ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} ${_csc_SOURCE_PATH} + COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug + ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf" ${BUILD_OPT} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg diff --git a/scripts/cmake/vcpkg_install_qmake.cmake b/scripts/cmake/vcpkg_install_qmake.cmake new file mode 100644 index 000000000..571b55a68 --- /dev/null +++ b/scripts/cmake/vcpkg_install_qmake.cmake @@ -0,0 +1,64 @@ +## # vcpkg_install_qmake
+##
+## Build and install a qmake project.
+##
+## ## Usage:
+## ```cmake
+## vcpkg_install_qmake(...)
+## ```
+##
+## ## Parameters:
+## See [`vcpkg_build_qmake()`](vcpkg_build_qmake.md).
+##
+## ## Notes:
+## This command transparently forwards to [`vcpkg_build_qmake()`](vcpkg_build_qmake.md).
+##
+## Additionally, this command will copy produced .libs/.dlls/.as/.dylibs/.sos to the appropriate
+## staging directories.
+##
+## ## Examples
+##
+## * [libqglviewer](https://github.com/Microsoft/vcpkg/blob/master/ports/libqglviewer/portfile.cmake)
+
+function(vcpkg_install_qmake)
+ vcpkg_build_qmake(${ARGN})
+ file(GLOB_RECURSE RELEASE_LIBS
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.lib
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.a
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.so
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.so.*
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dylib
+ )
+ file(GLOB_RECURSE RELEASE_BINS
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dll
+ )
+ file(GLOB_RECURSE DEBUG_LIBS
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.lib
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.a
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.so
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.so.*
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dylib
+ )
+ file(GLOB_RECURSE DEBUG_BINS
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dll
+ )
+ if(NOT RELEASE_LIBS AND NOT DEBUG_LIBS)
+ message(FATAL_ERROR "Build did not appear to produce any libraries. If this is intended, use `vcpkg_build_qmake()` directly.")
+ endif()
+ if(RELEASE_LIBS)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib)
+ file(COPY ${RELEASE_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ endif()
+ if(DEBUG_LIBS)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
+ file(COPY ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ endif()
+ if(RELEASE_BINS)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(COPY ${RELEASE_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+ endif()
+ if(DEBUG_BINS)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY ${DEBUG_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ endif()
+endfunction()
|
