aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-01-18 07:36:07 -0800
committerRobert Schumacher <roschuma@microsoft.com>2018-01-18 07:36:54 -0800
commitb47b4346f8c5b09cfb9826a083fc2d034a2ea9b4 (patch)
tree18cdcabab3bb5a83ed4429faa2e0a831e2bec435 /scripts/cmake
parent51da0e25fa5af242331d0a5d8b0d8b4137d98fc5 (diff)
downloadvcpkg-b47b4346f8c5b09cfb9826a083fc2d034a2ea9b4.tar.gz
vcpkg-b47b4346f8c5b09cfb9826a083fc2d034a2ea9b4.zip
[vcpkg-build-qmake][vcpkg-configure-qmake] Collapse config-specific versions.
Diffstat (limited to 'scripts/cmake')
-rw-r--r--scripts/cmake/vcpkg_build_qmake.cmake76
-rw-r--r--scripts/cmake/vcpkg_build_qmake_debug.cmake30
-rw-r--r--scripts/cmake/vcpkg_build_qmake_release.cmake30
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake4
-rw-r--r--scripts/cmake/vcpkg_configure_qmake.cmake41
-rw-r--r--scripts/cmake/vcpkg_configure_qmake_debug.cmake46
-rw-r--r--scripts/cmake/vcpkg_configure_qmake_release.cmake46
7 files changed, 89 insertions, 184 deletions
diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake
index 693f7841e..194ab8206 100644
--- a/scripts/cmake/vcpkg_build_qmake.cmake
+++ b/scripts/cmake/vcpkg_build_qmake.cmake
@@ -1,31 +1,81 @@
#.rst:
# .. command:: vcpkg_build_qmake
#
-# Build a qmake-based project, previously configured using vcpkg_configure_qmake .
-# As the CONFIG qmake option is assumed to be "debug_and_release" (the default value on Windows, see [1]),
-# both the debug and release libraries are build in the same build tree.
+# Build a qmake-based project, previously configured using vcpkg_configure_qmake.
#
# ::
# vcpkg_build_qmake()
#
-#
-# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
function(vcpkg_build_qmake)
+ cmake_parse_arguments(_csc "SKIP_MAKEFILES" "BUILD_LOGNAME" "TARGETS;RELEASE_TARGETS;DEBUG_TARGETS" ${ARGN})
vcpkg_find_acquire_program(JOM)
# Make sure that the linker finds the libraries used
set(ENV_PATH_BACKUP "$ENV{PATH}")
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/debug/lib;${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin;${CURRENT_INSTALLED_DIR}/tools/qt5;$ENV{PATH}")
- message(STATUS "Package ${TARGET_TRIPLET}")
- vcpkg_execute_required_process(
- COMMAND ${JOM}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
- LOGNAME package-${TARGET_TRIPLET}
- )
- message(STATUS "Package ${TARGET_TRIPLET} done")
+ set(DEBUG_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
+ set(RELEASE_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
+
+ file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
+
+ list(APPEND _csc_RELEASE_TARGETS ${_csc_TARGETS})
+ list(APPEND _csc_DEBUG_TARGETS ${_csc_TARGETS})
+
+ if(NOT _csc_BUILD_LOGNAME)
+ set(_csc_BUILD_LOGNAME build)
+ endif()
+
+ function(run_jom TARGETS LOG_PREFIX LOG_SUFFIX)
+ message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}")
+ vcpkg_execute_required_process(
+ COMMAND ${JOM} ${TARGETS}
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${LOG_SUFFIX}
+ LOGNAME package-${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}
+ )
+ message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX} done")
+ endfunction()
+
+ # This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings
+ set(ENV_CL_BACKUP "$ENV{_CL_}")
+ set(ENV{_CL_} "/utf-8")
+
+ #First generate the makefiles so we can modify them
+ set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/debug/lib;${CURRENT_INSTALLED_DIR}/debug/bin;${CURRENT_INSTALLED_DIR}/tools/qt5;${ENV_PATH_BACKUP}")
+ if(NOT _csc_SKIP_MAKEFILES)
+ run_jom(qmake_all makefiles dbg)
+
+ #Store debug makefiles path
+ file(GLOB_RECURSE DEBUG_MAKEFILES ${DEBUG_DIR}/*Makefile*)
+
+ foreach(DEBUG_MAKEFILE ${DEBUG_MAKEFILES})
+ file(READ "${DEBUG_MAKEFILE}" _contents)
+ string(REPLACE "zlib.lib" "zlibd.lib" _contents "${_contents}")
+ string(REPLACE "installed\\${TARGET_TRIPLET}\\lib" "installed\\${TARGET_TRIPLET}\\debug\\lib" _contents "${_contents}")
+ string(REPLACE "/LIBPATH:${NATIVE_INSTALLED_DIR}\\debug\\lib qtmaind.lib" "shell32.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\debug\\lib\\manual-link qtmaind.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\debug\\lib" _contents "${_contents}")
+ file(WRITE "${DEBUG_MAKEFILE}" "${_contents}")
+ endforeach()
+ endif()
+
+ run_jom("${_csc_DEBUG_TARGETS}" ${_csc_BUILD_LOGNAME} dbg)
+
+ set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/tools/qt5;${ENV_PATH_BACKUP}")
+ if(NOT _csc_SKIP_MAKEFILES)
+ run_jom(qmake_all makefiles rel)
+
+ #Store release makefile path
+ file(GLOB_RECURSE RELEASE_MAKEFILES ${RELEASE_DIR}/*Makefile*)
+
+ foreach(RELEASE_MAKEFILE ${RELEASE_MAKEFILES})
+ file(READ "${RELEASE_MAKEFILE}" _contents)
+ string(REPLACE "/LIBPATH:${NATIVE_INSTALLED_DIR}\\lib qtmain.lib" "shell32.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\lib\\manual-link qtmain.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\lib" _contents "${_contents}")
+ file(WRITE "${RELEASE_MAKEFILE}" "${_contents}")
+ endforeach()
+ endif()
+
+ run_jom("${_csc_RELEASE_TARGETS}" ${_csc_BUILD_LOGNAME} rel)
# Restore the original value of ENV{PATH}
set(ENV{PATH} "${ENV_PATH_BACKUP}")
+ set(ENV{_CL_} "${ENV_CL_BACKUP}")
endfunction()
diff --git a/scripts/cmake/vcpkg_build_qmake_debug.cmake b/scripts/cmake/vcpkg_build_qmake_debug.cmake
deleted file mode 100644
index a734e63cf..000000000
--- a/scripts/cmake/vcpkg_build_qmake_debug.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-#.rst:
-# .. command:: vcpkg_build_qmake_debug
-#
-# Build a qmake-based project, previously configured using vcpkg_configure_qmake_debug.
-#
-# ::
-# vcpkg_build_qmake_debug()
-#
-#
-# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
-
-function(vcpkg_build_qmake_debug)
- cmake_parse_arguments(_csc "" "" "TARGETS" ${ARGN})
- vcpkg_find_acquire_program(JOM)
-
- # Make sure that the linker finds the libraries used
- set(ENV_PATH_BACKUP "$ENV{PATH}")
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/debug/lib;${CURRENT_INSTALLED_DIR}/debug/bin;${CURRENT_INSTALLED_DIR}/debug/tools/qt5;$ENV{PATH}")
-
- message(STATUS "Package ${TARGET_TRIPLET}-dbg")
- vcpkg_execute_required_process(
- COMMAND ${JOM} ${_csc_TARGETS}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
- LOGNAME package-${TARGET_TRIPLET}-dbg
- )
- message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
-
- # Restore the original value of ENV{PATH}
- set(ENV{PATH} "${ENV_PATH_BACKUP}")
-endfunction()
diff --git a/scripts/cmake/vcpkg_build_qmake_release.cmake b/scripts/cmake/vcpkg_build_qmake_release.cmake
deleted file mode 100644
index 3daf9201b..000000000
--- a/scripts/cmake/vcpkg_build_qmake_release.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-#.rst:
-# .. command:: vcpkg_build_qmake_release
-#
-# Build a qmake-based project, previously configured using vcpkg_configure_qmake_release.
-#
-# ::
-# vcpkg_build_qmake_release()
-#
-#
-# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
-
-function(vcpkg_build_qmake_release)
- cmake_parse_arguments(_csc "" "" "TARGETS" ${ARGN})
- vcpkg_find_acquire_program(JOM)
-
- # Make sure that the linker finds the libraries used
- set(ENV_PATH_BACKUP "$ENV{PATH}")
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/tools/qt5;$ENV{PATH}")
-
- message(STATUS "Package ${TARGET_TRIPLET}-rel")
- vcpkg_execute_required_process(
- COMMAND ${JOM} ${_csc_TARGETS}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
- LOGNAME package-${TARGET_TRIPLET}-rel
- )
- message(STATUS "Package ${TARGET_TRIPLET}-rel done")
-
- # Restore the original value of ENV{PATH}
- set(ENV{PATH} "${ENV_PATH_BACKUP}")
-endfunction()
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 258b8f64a..27dd0732d 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -10,15 +10,11 @@ include(vcpkg_from_bitbucket)
include(vcpkg_build_cmake)
include(vcpkg_build_msbuild)
include(vcpkg_build_qmake)
-include(vcpkg_build_qmake_debug)
-include(vcpkg_build_qmake_release)
include(vcpkg_install_cmake)
include(vcpkg_install_meson)
include(vcpkg_configure_cmake)
include(vcpkg_configure_meson)
include(vcpkg_configure_qmake)
-include(vcpkg_configure_qmake_debug)
-include(vcpkg_configure_qmake_release)
include(vcpkg_apply_patches)
include(vcpkg_copy_pdbs)
include(vcpkg_copy_tool_dependencies)
diff --git a/scripts/cmake/vcpkg_configure_qmake.cmake b/scripts/cmake/vcpkg_configure_qmake.cmake
index 037197e48..4cc7bc9f7 100644
--- a/scripts/cmake/vcpkg_configure_qmake.cmake
+++ b/scripts/cmake/vcpkg_configure_qmake.cmake
@@ -2,11 +2,6 @@
# .. command:: vcpkg_configure_qmake
#
# Configure a qmake-based project.
-# It is assume that the qmake project CONFIG variable is
-# "debug_and_release" (the default value on Windows, see [1]).
-# Using this option, only one Makefile for building both Release and Debug
-# libraries is generated, that then can be run using the vcpkg_build_qmake
-# command.
#
# ::
# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
@@ -17,28 +12,44 @@
# The path to the *.pro qmake project file.
# ``OPTIONS``
# The options passed to qmake.
-#
-# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
function(vcpkg_configure_qmake)
cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
- # Find qmake exectuable
+ # Find qmake executable
find_program(QMAKE_COMMAND NAMES qmake.exe PATHS ${CURRENT_INSTALLED_DIR}/tools/qt5)
if(NOT QMAKE_COMMAND)
message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.")
endif()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ list(APPEND _csc_OPTIONS CONFIG+=staticlib)
+ endif()
+
# Cleanup build directories
- file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
- message(STATUS "Configuring ${TARGET_TRIPLET}")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+ configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_release.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf)
+
+ message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
vcpkg_execute_required_process(
- COMMAND ${QMAKE_COMMAND} ${_csc_OPTIONS} -d ${_csc_SOURCE_PATH}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
- LOGNAME config-${TARGET_TRIPLET}
+ COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release ${_csc_OPTIONS} -d ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf"
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
+ LOGNAME config-${TARGET_TRIPLET}-rel
)
- message(STATUS "Configuring ${TARGET_TRIPLET} done")
+ message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
+
+ configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_debug.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf)
+
+ message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
+ vcpkg_execute_required_process(
+ COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug ${_csc_OPTIONS} -d ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/qt.conf"
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
+ LOGNAME config-${TARGET_TRIPLET}-dbg
+ )
+ message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
+
endfunction() \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_configure_qmake_debug.cmake b/scripts/cmake/vcpkg_configure_qmake_debug.cmake
deleted file mode 100644
index 3eeb42cb3..000000000
--- a/scripts/cmake/vcpkg_configure_qmake_debug.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-#.rst:
-# .. command:: vcpkg_configure_qmake_debug
-#
-# Configure a qmake-based project.
-# This sets the config variable to debug and outputs to
-# a debug triplet directory.
-#
-# ::
-# vcpkg_configure_qmake_debug(SOURCE_PATH <pro_file_path>
-# [OPTIONS arg1 [arg2 ...]]
-# )
-#
-# ``SOURCE_PATH``
-# The path to the *.pro qmake project file.
-# ``OPTIONS``
-# The options passed to qmake.
-#
-# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
-
-function(vcpkg_configure_qmake_debug)
- cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
-
- # Find qmake exectuable
- find_program(QMAKE_COMMAND NAMES qmake.exe PATHS ${CURRENT_INSTALLED_DIR}/tools/qt5)
-
- if(NOT QMAKE_COMMAND)
- message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.")
- endif()
-
- # Cleanup build directories
- file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
-
- configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_debug.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf)
-
- message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
- vcpkg_execute_required_process(
- COMMAND ${QMAKE_COMMAND} CONFIG-=release CONFIG+=debug ${_csc_OPTIONS} -d ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf"
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
- LOGNAME config-${TARGET_TRIPLET}-dbg
- )
- message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
- unset(QMAKE_COMMAND)
- unset(QMAKE_COMMAND PARENT_SCOPE)
- unset(QMAKE_COMMAND CACHE)
-endfunction() \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_configure_qmake_release.cmake b/scripts/cmake/vcpkg_configure_qmake_release.cmake
deleted file mode 100644
index 60750060b..000000000
--- a/scripts/cmake/vcpkg_configure_qmake_release.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-#.rst:
-# .. command:: vcpkg_configure_qmake_release
-#
-# Configure a qmake-based project.
-# This sets the config variable to release and outputs to
-# a release triplet directory.
-#
-# ::
-# vcpkg_configure_qmake_release(SOURCE_PATH <pro_file_path>
-# [OPTIONS arg1 [arg2 ...]]
-# )
-#
-# ``SOURCE_PATH``
-# The path to the *.pro qmake project file.
-# ``OPTIONS``
-# The options passed to qmake.
-#
-# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
-
-function(vcpkg_configure_qmake_release)
- cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
-
- # Find qmake exectuable
- find_program(QMAKE_COMMAND NAMES qmake.exe PATHS ${CURRENT_INSTALLED_DIR}/tools/qt5)
-
- if(NOT QMAKE_COMMAND)
- message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.")
- endif()
-
- # Cleanup build directories
- file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
-
- configure_file(${CURRENT_INSTALLED_DIR}/tools/qt5/qt_release.conf ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf)
-
- message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
- vcpkg_execute_required_process(
- COMMAND ${QMAKE_COMMAND} CONFIG-=debug CONFIG+=release ${_csc_OPTIONS} -d ${_csc_SOURCE_PATH} -qtconf "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/qt.conf"
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
- LOGNAME config-${TARGET_TRIPLET}-rel
- )
- message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
- unset(QMAKE_COMMAND)
- unset(QMAKE_COMMAND PARENT_SCOPE)
- unset(QMAKE_COMMAND CACHE)
-endfunction() \ No newline at end of file