From 6e3a69b4cf5c526443b96cf857847d6c3b0586d8 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:52:39 +0200 Subject: build: consistently set build type regardless of generator or platform #19760 Change the default build type to always be Debug, and allow only four predefined build types: Debug, Release, RelWithDebInfo and MinRelSize. Furthermore, flags meant for single-configuration generator (make, ninja) will not be used for multi-configuration generators (visual studio, Xcode), and flags meant for multi-configuration generators will not be used for single-configuration generators. This will allow Debug builds to be built with MSVC which requires that all dependencies are also built with the Debug build type to avoid runtime library mismatch. The correct way to specify build type (for example Release) for single-configuration generators (Make and Ninja) is to run cmake -B build -D CMAKE_BUILD_TYPE=Release cmake --build build while for multi-configuration generators (Visual Studio, Xcode and Ninja Multi-Config) is to run cmake -B build cmake --build build --config Release Passing CMAKE_BUILD_TYPE for multi-config generators will now not only not be used, but also generate a warning for the user. Co-authored-by: dundargoc --- cmake.deps/cmake/BuildGettext.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index f36c00c559..d903fbc737 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -23,8 +23,8 @@ if(MSVC) -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX} - BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} - INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}) + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $ + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $) else() message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") endif() -- cgit From 3ce325cfa26d7fbecf49a32a1f59bd07768c6f4b Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 14 Sep 2022 12:03:19 +0200 Subject: build: remove code for cross-compilation We don't support cross-compilation at the moment, so these can be safely removed. --- cmake.deps/cmake/BuildGettext.cmake | 2 -- 1 file changed, 2 deletions(-) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index d903fbc737..173b9675d6 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -16,8 +16,6 @@ if(MSVC) ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/gettext -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - # Pass toolchain - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ${BUILD_TYPE_STRING} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -- cgit From 59d5f692f8f563bf6f7c232f971ad764316e4466 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 29 Sep 2022 21:46:14 +0200 Subject: build: rely on builtin cmake downloading rather than custom script DownloadAndExtractFile.cmake was initially introduced as a workaround to avoid the massive amounts of logs generated by the download progress. This is not a problem anymore as ExternalProject_Add has had the DOWNLOAD_NO_PROGRESS option since cmake version 3.1. --- cmake.deps/cmake/BuildGettext.cmake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index 173b9675d6..f2fdd68e28 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -2,15 +2,9 @@ if(MSVC) ExternalProject_Add(gettext PREFIX ${DEPS_BUILD_DIR} URL ${GETTEXT_URL} + URL_HASH SHA256=${GETTEXT_SHA256} + DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/gettext - -DURL=${GETTEXT_URL} - -DEXPECTED_SHA256=${GETTEXT_SHA256} - -DTARGET=gettext - -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt -- cgit From fbc66d798ce834c4ba05360c3c07ce7af40d6fc9 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 1 Oct 2022 14:54:58 +0200 Subject: build: define EP_PREFIX property This is just to avoid the boilerplate of definining PREFIX for each dependency. --- cmake.deps/cmake/BuildGettext.cmake | 1 - 1 file changed, 1 deletion(-) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index f2fdd68e28..4bcfeea32a 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -1,6 +1,5 @@ if(MSVC) ExternalProject_Add(gettext - PREFIX ${DEPS_BUILD_DIR} URL ${GETTEXT_URL} URL_HASH SHA256=${GETTEXT_SHA256} DOWNLOAD_NO_PROGRESS TRUE -- cgit From 61da959bb401b83454be0748b7a8b482f1be76e5 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 6 Oct 2022 09:14:38 -0400 Subject: build(deps): restore support for USE_EXISTING_SRC_DIR (#20491) 59d5f692f removed cmake.deps/cmake/DownloadAndExtractFile.cmake and support for USE_EXISTING_SRC_DIR. The Ubuntu nightly PPA still relies on USE_EXISTING_SRC_DIR functionality since it can't access the network during the build. Supplying an empty value for ExternalProject_Add()'s URL value appears to provide the needed mechanism to avoid re-downloading when the sources are already present. This is undocumented behavior, though, so it may break in the future. Now, if USE_EXISTING_SRC_DIR is set, the ExternalProject's URL variable is unset, preventing the download and erroring out if the source doesn't actually exist. --- cmake.deps/cmake/BuildGettext.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index 4bcfeea32a..aecd5da626 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -1,4 +1,7 @@ if(MSVC) + if(USE_EXISTING_SRC_DIR) + unset(GETTEXT_URL) + endif() ExternalProject_Add(gettext URL ${GETTEXT_URL} URL_HASH SHA256=${GETTEXT_SHA256} -- cgit From bc7daddaf00e50bb3c985b2613763045307d159b Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 21 Oct 2022 11:37:19 +0200 Subject: build: rely on default cmake installation if possible The default cmake installation process for dependencies that use cmake on all platforms is in general more robust and less verbose, so we rely on that if possible. --- cmake.deps/cmake/BuildGettext.cmake | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index aecd5da626..4ba1f46d2e 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -7,18 +7,16 @@ if(MSVC) URL_HASH SHA256=${GETTEXT_SHA256} DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy + PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt - ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt - COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/gettext - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - ${BUILD_TYPE_STRING} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include - -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX} - BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $ - INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $) + ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} + ${BUILD_TYPE_STRING} + -DCMAKE_GENERATOR=${CMAKE_GENERATOR} + -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include + -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}) else() message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") endif() -- cgit From b8288df99be8df701308167e4b0b497f003f25e9 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 25 Jan 2023 14:36:17 +0100 Subject: build: introduce default build variables (#21991) There are a number of cmake variables and cache variables that need to be passed to all dependencies. This is not only cumbersome, but also fragile as it's easy to miss adding or removing a flag from a dependency by accident. Introducing a global variable that controls all builds makes it much easier to handle our dependencies. Also fixes the currently broken release workflow as we need to pass the CMAKE_OSX_ARCHITECTURES variable to all dependencies built with cmake. --- cmake.deps/cmake/BuildGettext.cmake | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'cmake.deps/cmake/BuildGettext.cmake') diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index 4ba1f46d2e..1f9fd38702 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -10,13 +10,10 @@ if(MSVC) PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - ${BUILD_TYPE_STRING} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + CMAKE_ARGS ${DEPS_CMAKE_ARGS} -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include - -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}) + -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) else() message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") endif() -- cgit