diff options
59 files changed, 467 insertions, 246 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a41406..305c8d2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -824,7 +824,7 @@ b:macos-x86_64-ninja: - .macos_x86_64_tags - .run_manually variables: - CMAKE_CI_JOB_CONTINUOUS: "true" + CMAKE_CI_NO_MR: "true" b:macos-arm64-ninja: extends: @@ -834,7 +834,7 @@ b:macos-arm64-ninja: - .macos_arm64_tags - .run_manually variables: - CMAKE_CI_NO_MR: "true" + CMAKE_CI_JOB_CONTINUOUS: "true" t:macos-x86_64-ninja: extends: @@ -848,8 +848,7 @@ t:macos-x86_64-ninja: needs: - b:macos-x86_64-ninja variables: - CMAKE_CI_JOB_CONTINUOUS: "true" - CMAKE_CI_JOB_NIGHTLY_NINJA: "true" + CMAKE_CI_NO_MR: "true" t:macos-arm64-ninja: extends: @@ -863,7 +862,8 @@ t:macos-arm64-ninja: needs: - b:macos-arm64-ninja variables: - CMAKE_CI_NO_MR: "true" + CMAKE_CI_JOB_CONTINUOUS: "true" + CMAKE_CI_JOB_NIGHTLY_NINJA: "true" b:macos-x86_64-makefiles: extends: @@ -884,17 +884,17 @@ t:macos-x86_64-makefiles: needs: - b:macos-x86_64-makefiles -t:macos-x86_64-ninja-multi: +t:macos-arm64-ninja-multi: extends: - - .macos_x86_64_ninja_multi + - .macos_arm64_ninja_multi - .cmake_test_macos_external - - .macos_x86_64_tags_ext + - .macos_arm64_tags_ext - .cmake_junit_artifacts - .run_dependent dependencies: - - t:macos-x86_64-ninja + - t:macos-arm64-ninja needs: - - t:macos-x86_64-ninja + - t:macos-arm64-ninja variables: CMAKE_CI_JOB_NIGHTLY: "true" @@ -909,6 +909,8 @@ t:macos-x86_64-xcode: - t:macos-x86_64-ninja needs: - t:macos-x86_64-ninja + variables: + CMAKE_CI_NO_MR: "true" t:macos-arm64-xcode: extends: @@ -921,8 +923,6 @@ t:macos-arm64-xcode: - t:macos-arm64-ninja needs: - t:macos-arm64-ninja - variables: - CMAKE_CI_NO_MR: "true" t:macos-x86_64-ninja-ub: extends: @@ -938,17 +938,17 @@ t:macos-x86_64-ninja-ub: variables: CMAKE_CI_JOB_NIGHTLY: "true" -t:macos-x86_64-xcode-ub: +t:macos-arm64-xcode-ub: extends: - - .macos_x86_64_xcode_ub + - .macos_arm64_xcode_ub - .cmake_test_macos_external - - .macos_x86_64_tags_ext + - .macos_arm64_tags_ext - .cmake_junit_artifacts - .run_dependent dependencies: - - t:macos-x86_64-ninja + - t:macos-arm64-ninja needs: - - t:macos-x86_64-ninja + - t:macos-arm64-ninja variables: CMAKE_CI_JOB_NIGHTLY: "true" @@ -957,7 +957,7 @@ b:macos-package: - .macos_package - .cmake_build_macos - .cmake_release_artifacts - - .macos_x86_64_tags_package + - .macos_arm64_tags_package - .run_only_for_package dependencies: - p:doc-package @@ -980,7 +980,7 @@ b:macos10.10-package: - .macos10.10_package - .cmake_build_macos - .cmake_release_artifacts - - .macos_x86_64_tags_package + - .macos_arm64_tags_package - .run_only_for_package dependencies: - p:doc-package diff --git a/.gitlab/ci/configure_macos_x86_64_ninja_multi.cmake b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake index b22285c..b22285c 100644 --- a/.gitlab/ci/configure_macos_x86_64_ninja_multi.cmake +++ b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake diff --git a/.gitlab/ci/configure_macos_x86_64_xcode_ub.cmake b/.gitlab/ci/configure_macos_arm64_xcode_ub.cmake index 1b976d2..1b976d2 100644 --- a/.gitlab/ci/configure_macos_x86_64_xcode_ub.cmake +++ b/.gitlab/ci/configure_macos_arm64_xcode_ub.cmake diff --git a/.gitlab/ci/env_macos_x86_64_ninja_multi.sh b/.gitlab/ci/env_macos_arm64_ninja_multi.sh index 217ff30..217ff30 100644 --- a/.gitlab/ci/env_macos_x86_64_ninja_multi.sh +++ b/.gitlab/ci/env_macos_arm64_ninja_multi.sh diff --git a/.gitlab/ci/env_macos_arm64_xcode_ub.cmake b/.gitlab/ci/env_macos_arm64_xcode_ub.cmake new file mode 100644 index 0000000..244f088 --- /dev/null +++ b/.gitlab/ci/env_macos_arm64_xcode_ub.cmake @@ -0,0 +1 @@ +set(ENV{CMAKE_OSX_ARCHITECTURES} "arm64;x86_64") diff --git a/.gitlab/ci/env_macos_x86_64_xcode_ub.cmake b/.gitlab/ci/env_macos_x86_64_xcode_ub.cmake deleted file mode 100644 index 4b5c401..0000000 --- a/.gitlab/ci/env_macos_x86_64_xcode_ub.cmake +++ /dev/null @@ -1 +0,0 @@ -set(ENV{CMAKE_OSX_ARCHITECTURES} "x86_64;arm64") diff --git a/.gitlab/ci/ispc.ps1 b/.gitlab/ci/ispc.ps1 index 13267c3..524896f 100755 --- a/.gitlab/ci/ispc.ps1 +++ b/.gitlab/ci/ispc.ps1 @@ -1,7 +1,7 @@ $erroractionpreference = "stop" -$version = "1.18.0" -$sha256sum = "9210BB2D9D3711367FACCB37ACF49966696132560B565471C1C6121F4924A17E" +$version = "1.20.0" +$sha256sum = "E212EBFB4E8AFB57ADC103A2579C52673A3CA49610FBC2A5EAE643D3D378548D" $filename = "ispc-v$version-windows" $tarball = "$filename.zip" diff --git a/.gitlab/ci/ispc.sh b/.gitlab/ci/ispc.sh index 2804277..59ee200 100755 --- a/.gitlab/ci/ispc.sh +++ b/.gitlab/ci/ispc.sh @@ -2,18 +2,23 @@ set -e -readonly version="1.18.0" +readonly version="1.20.0" case "$(uname -s)-$(uname -m)" in Linux-x86_64) shatool="sha256sum" - sha256sum="6c379bb97962e9de7d24fd48b3f7e647dc42be898e9d187948220268c646b692" + sha256sum="e6412b88aa312fcd10c46f92df0149ccc4d99e53552c4ce127aa6c634fe9b308" platform="linux" ;; + Darwin-arm64) + shatool="shasum -a 256" + sha256sum="62cee043a3a4dbff8c2f6d3885a7e573901bbc1325dd93d50f92904b7ea67fec" + platform="macOS.arm64" + ;; Darwin-x86_64) shatool="shasum -a 256" - sha256sum="d1435b541182406ff6b18446d31ecceef0eae3aed7654391ae676d3142e0000d" - platform="macOS" + sha256sum="da0f11a048a316081a8ad8170d48b170b2ed7efc3b140fc88b8611238809c8e4" + platform="macOS.x86_64" ;; *) echo "Unrecognized platform $(uname -s)-$(uname -m)" diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 6f0bea5..1579338 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -80,19 +80,19 @@ CMAKE_GENERATOR: Xcode CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true" -.macos_x86_64_xcode_ub: +.macos_arm64_xcode_ub: extends: .macos variables: - CMAKE_CONFIGURATION: macos_x86_64_xcode_ub + CMAKE_CONFIGURATION: macos_arm64_xcode_ub CMAKE_GENERATOR: Xcode CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true" -.macos_x86_64_ninja_multi: +.macos_arm64_ninja_multi: extends: .macos variables: - CMAKE_CONFIGURATION: macos_x86_64_ninja_multi + CMAKE_CONFIGURATION: macos_arm64_ninja_multi CMAKE_GENERATOR: "Ninja Multi-Config" CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true" @@ -113,15 +113,6 @@ - xcode-14.2 - nonconcurrent -.macos_x86_64_tags_package: - tags: - - cmake # Since this is a bare runner, pin to a project. - - macos-x86_64 - - shell - - xcode-14.2 - - nonconcurrent - - finder - .macos_x86_64_tags_ext: tags: - cmake # Since this is a bare runner, pin to a project. @@ -146,6 +137,15 @@ - xcode-14.2 - concurrent +.macos_arm64_tags_package: + tags: + - cmake # Since this is a bare runner, pin to a project. + - macos-arm64 + - shell + - xcode-14.2 + - nonconcurrent + - finder + ## macOS-specific scripts .before_script_macos: &before_script_macos diff --git a/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst b/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst index c8ec8b5..e1fea37 100644 --- a/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst +++ b/Help/prop_tgt/IMPORTED_NO_SYSTEM.rst @@ -25,6 +25,8 @@ system target. This has the following effects: would be by default. Entries of :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` are not affected, and will always be treated as system include directories. +* On Apple platforms, when the target is a framework, it will not be treated as + system. This property can also be enabled on a non-imported target. Doing so does not affect the build system, but does tell the :command:`install(EXPORT)` and diff --git a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst index a4c9b9f..458618b 100644 --- a/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst +++ b/Help/prop_tgt/NO_SYSTEM_FROM_IMPORTED.rst @@ -4,13 +4,14 @@ NO_SYSTEM_FROM_IMPORTED Do not treat include directories from the interfaces of consumed :ref:`imported targets` as system directories. -The contents of the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property -are treated as system includes when the consumed target's :prop_tgt:`SYSTEM` -property is set to true. By default, :prop_tgt:`SYSTEM` is true for imported -targets and false for other target types. If the ``NO_SYSTEM_FROM_IMPORTED`` -property is set to true on a *consuming* target, compilation of sources in that -consuming target will not treat the contents of the -:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of consumed imported targets as +When the consumed target's :prop_tgt:`SYSTEM` property is set to true, the +contents of the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property are +treated as system includes or, on Apple platforms, when the target is a +framework, it will be treated as system. By default, :prop_tgt:`SYSTEM` is +true for imported targets and false for other target types. If the +``NO_SYSTEM_FROM_IMPORTED`` property is set to true on a *consuming* target, +compilation of sources in that consuming target will not treat the contents of +the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of consumed imported targets as system includes, even if that imported target's :prop_tgt:`SYSTEM` property is false. diff --git a/Help/prop_tgt/SYSTEM.rst b/Help/prop_tgt/SYSTEM.rst index c7ae27e..f5c11bc 100644 --- a/Help/prop_tgt/SYSTEM.rst +++ b/Help/prop_tgt/SYSTEM.rst @@ -10,13 +10,17 @@ effects: system include directories when compiling consumers. Entries of :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` are not affected, and will always be treated as system include directories. +* On Apple platforms, If the :prop_tgt:`FRAMEWORK` target property is true, + the frameworks directory is treated as system. For imported targets, this property defaults to true, which means -that their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` are treated -as system directories by default. If their ``SYSTEM`` property is false, -then their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` will not be -treated as system. Use the :prop_tgt:`EXPORT_NO_SYSTEM` property to change -how a target's ``SYSTEM`` property is set when it is installed. +that their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` and, if the +:prop_tgt:`FRAMEWORK` target property is true, frameworks directory are +treated as system directories by default. If their ``SYSTEM`` property is +false, then their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` as well as +frameworks will not be treated as system. Use the :prop_tgt:`EXPORT_NO_SYSTEM` +property to change how a target's ``SYSTEM`` property is set when it is +installed. For non-imported targets, this target property is initialized from the :prop_dir:`SYSTEM` directory property when the target is created. diff --git a/Help/release/dev/System-Framework.rst b/Help/release/dev/System-Framework.rst new file mode 100644 index 0000000..106cf23 --- /dev/null +++ b/Help/release/dev/System-Framework.rst @@ -0,0 +1,4 @@ +System-Framework +---------------- + +* The :prop_tgt:`SYSTEM` target property is now honored for Apple Frameworks. diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index f5298df..8beebc5 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -162,7 +162,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC") get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) - if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") + if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-?[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_4}) set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_6}) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 9e38566..40934ec 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -167,7 +167,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC") get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) - if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") + if (COMPILER_BASENAME MATCHES "^(.+-)?(clang\\+\\+|[gc]\\+\\+|clang-cl)(-?[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_3}) set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5}) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 403766e..6c49096 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -1149,7 +1149,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags) ENCODING AUTO # cl prints in console output code page ) string(REPLACE "\n" "\n " msg " ${out}") - if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./)") + if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./|/)") set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE) string(APPEND msg "\nFound prefix \"${CMAKE_MATCH_2}\"") else() diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake index daf0371..f4f35e6 100644 --- a/Modules/Compiler/Clang-FindBinUtils.cmake +++ b/Modules/Compiler/Clang-FindBinUtils.cmake @@ -26,6 +26,7 @@ set(__clang_hints ${__clang_hint_1} ${__clang_hint_2}) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar" HINTS ${__clang_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH @@ -37,6 +38,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib" HINTS ${__clang_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH @@ -48,6 +50,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_CLANG_SCAN_DEPS NAMES "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}clang-scan-deps" HINTS ${__clang_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 6c544fd..a21ba43 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -173,7 +173,10 @@ macro(__compiler_clang_cxx_standards lang) unset(_clang_version_std17) - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 17.0) + set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++23") + set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23") + elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b") set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") endif() diff --git a/Modules/Compiler/GNU-FindBinUtils.cmake b/Modules/Compiler/GNU-FindBinUtils.cmake index 4dcdd53..3941715 100644 --- a/Modules/Compiler/GNU-FindBinUtils.cmake +++ b/Modules/Compiler/GNU-FindBinUtils.cmake @@ -18,6 +18,7 @@ get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPIL find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}" HINTS ${__gcc_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH @@ -29,6 +30,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${__version_x}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}" HINTS ${__gcc_hints} NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index e2cc497..1fdd754 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -2447,7 +2447,7 @@ function(ExternalProject_Add_Step name step) PROPERTY _EP_${step}_ALWAYS ) if(always) - set(touch) + set(maybe_COMMAND_touch "") # Mark stamp files for all configs as SYMBOLIC since we do not create them. # Remove any existing stamp in case the option changed in an existing tree. get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -2469,7 +2469,7 @@ function(ExternalProject_Add_Step name step) file(REMOVE ${stamp_file}) endif() else() - set(touch ${CMAKE_COMMAND} -E touch ${stamp_file}) + set(maybe_COMMAND_touch "COMMAND \${CMAKE_COMMAND} -E touch \${stamp_file}") endif() # Wrap with log script? @@ -2497,7 +2497,7 @@ function(ExternalProject_Add_Step name step) BYPRODUCTS \${byproducts} COMMENT \${comment} COMMAND ${__cmdQuoted} - COMMAND \${touch} + ${maybe_COMMAND_touch} DEPENDS \${depends} WORKING_DIRECTORY \${work_dir} VERBATIM diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cd0b310..fc29347 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 26) -set(CMake_VERSION_PATCH 20230508) +set(CMake_VERSION_PATCH 20230516) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/LexerParser/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx index 5703de1..df65472 100644 --- a/Source/LexerParser/cmFortranLexer.cxx +++ b/Source/LexerParser/cmFortranLexer.cxx @@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 54 -#define YY_END_OF_BUFFER 55 +#define YY_NUM_RULES 55 +#define YY_END_OF_BUFFER 56 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -560,29 +560,29 @@ struct yy_trans_info static const flex_int16_t yy_accept[216] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 55, 49, 51, 50, 53, 1, 49, 33, 2, 47, - 48, 35, 37, 50, 39, 49, 46, 46, 46, 46, - 46, 46, 49, 46, 51, 49, 50, 51, 49, 46, - 9, 8, 9, 9, 4, 3, 49, 0, 10, 0, - 0, 0, 0, 0, 33, 33, 34, 36, 39, 49, - 46, 46, 46, 46, 46, 46, 0, 52, 0, 46, + 56, 50, 52, 51, 54, 1, 50, 34, 2, 48, + 49, 36, 38, 51, 40, 50, 47, 47, 47, 47, + 47, 47, 50, 47, 52, 50, 51, 52, 50, 47, + 9, 8, 9, 9, 4, 3, 50, 0, 10, 0, + 0, 0, 0, 0, 34, 34, 35, 37, 40, 50, + 47, 47, 47, 47, 47, 47, 0, 53, 0, 47, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, - 0, 49, 0, 11, 46, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 29, 0, 33, 33, 33, 33, + 0, 50, 0, 11, 47, 0, 0, 0, 5, 0, + 0, 0, 0, 0, 30, 0, 34, 34, 34, 34, - 0, 0, 40, 46, 46, 46, 46, 45, 12, 12, - 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, + 0, 0, 41, 47, 47, 47, 47, 46, 12, 12, + 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 46, 46, 46, 46, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 46, 46, 46, 46, 0, 24, - 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 20, 32, 27, 0, 0, 0, 46, 46, 43, 46, - 0, 26, 21, 0, 0, 0, 19, 0, 0, 18, - 28, 0, 0, 41, 46, 46, 17, 22, 0, 7, - - 38, 7, 15, 0, 46, 46, 14, 16, 42, 44, - 0, 0, 0, 13, 0 + 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 31, 32, 0, + 0, 0, 0, 0, 47, 47, 47, 47, 0, 25, + 26, 0, 0, 0, 0, 13, 0, 0, 0, 0, + 21, 33, 28, 0, 0, 0, 47, 47, 44, 47, + 0, 27, 22, 0, 0, 13, 20, 0, 0, 19, + 29, 0, 0, 42, 47, 47, 18, 23, 0, 7, + + 39, 7, 16, 0, 47, 47, 15, 17, 43, 45, + 0, 0, 0, 14, 0 } ; static const YY_CHAR yy_ec[256] = @@ -1252,7 +1252,11 @@ YY_RULE_SETUP { return CPP_LINE_DIRECTIVE; } YY_BREAK case 13: -/* rule 13 can match eol */ +YY_RULE_SETUP +{ return CPP_LINE_DIRECTIVE; } + YY_BREAK +case 14: +/* rule 14 can match eol */ YY_RULE_SETUP { yytext[yyleng-1] = 0; @@ -1260,172 +1264,172 @@ YY_RULE_SETUP return CPP_INCLUDE_ANGLE; } YY_BREAK -case 14: +case 15: YY_RULE_SETUP { return CPP_INCLUDE; } YY_BREAK -case 15: +case 16: YY_RULE_SETUP { return F90PPR_INCLUDE; } YY_BREAK -case 16: +case 17: YY_RULE_SETUP { return COCO_INCLUDE; } YY_BREAK -case 17: +case 18: YY_RULE_SETUP { return CPP_DEFINE; } YY_BREAK -case 18: +case 19: YY_RULE_SETUP { return F90PPR_DEFINE; } YY_BREAK -case 19: +case 20: YY_RULE_SETUP { return CPP_UNDEF; } YY_BREAK -case 20: +case 21: YY_RULE_SETUP { return F90PPR_UNDEF; } YY_BREAK -case 21: +case 22: YY_RULE_SETUP { return CPP_IFDEF; } YY_BREAK -case 22: +case 23: YY_RULE_SETUP { return CPP_IFNDEF; } YY_BREAK -case 23: +case 24: YY_RULE_SETUP { return CPP_IF; } YY_BREAK -case 24: +case 25: YY_RULE_SETUP { return CPP_ELIF; } YY_BREAK -case 25: +case 26: YY_RULE_SETUP { return CPP_ELSE; } YY_BREAK -case 26: +case 27: YY_RULE_SETUP { return CPP_ENDIF; } YY_BREAK -case 27: +case 28: YY_RULE_SETUP { return F90PPR_IFDEF; } YY_BREAK -case 28: +case 29: YY_RULE_SETUP { return F90PPR_IFNDEF; } YY_BREAK -case 29: +case 30: YY_RULE_SETUP { return F90PPR_IF; } YY_BREAK -case 30: +case 31: YY_RULE_SETUP { return F90PPR_ELIF; } YY_BREAK -case 31: +case 32: YY_RULE_SETUP { return F90PPR_ELSE; } YY_BREAK -case 32: +case 33: YY_RULE_SETUP { return F90PPR_ENDIF; } YY_BREAK /* Line continuations, possible involving comments. */ -case 33: -/* rule 33 can match eol */ -YY_RULE_SETUP - - YY_BREAK case 34: /* rule 34 can match eol */ YY_RULE_SETUP YY_BREAK case 35: +/* rule 35 can match eol */ YY_RULE_SETUP -{ return COMMA; } + YY_BREAK case 36: YY_RULE_SETUP -{ return DCOLON; } +{ return COMMA; } YY_BREAK case 37: YY_RULE_SETUP -{ return COLON; } +{ return DCOLON; } YY_BREAK case 38: -/* rule 38 can match eol */ YY_RULE_SETUP -{ return GARBAGE; } +{ return COLON; } YY_BREAK case 39: +/* rule 39 can match eol */ YY_RULE_SETUP -{ return ASSIGNMENT_OP; } +{ return GARBAGE; } YY_BREAK case 40: YY_RULE_SETUP -{ return END; } +{ return ASSIGNMENT_OP; } YY_BREAK case 41: YY_RULE_SETUP -{ return INCLUDE; } +{ return END; } YY_BREAK case 42: YY_RULE_SETUP -{ return INTERFACE; } +{ return INCLUDE; } YY_BREAK case 43: YY_RULE_SETUP -{ return MODULE; } +{ return INTERFACE; } YY_BREAK case 44: YY_RULE_SETUP -{ return SUBMODULE; } +{ return MODULE; } YY_BREAK case 45: YY_RULE_SETUP -{ return USE; } +{ return SUBMODULE; } YY_BREAK case 46: YY_RULE_SETUP +{ return USE; } + YY_BREAK +case 47: +YY_RULE_SETUP { yylvalp->string = strdup(yytext); return WORD; } YY_BREAK -case 47: +case 48: YY_RULE_SETUP { return LPAREN; } YY_BREAK -case 48: +case 49: YY_RULE_SETUP { return RPAREN; } YY_BREAK -case 49: +case 50: YY_RULE_SETUP { return GARBAGE; } YY_BREAK -case 50: -/* rule 50 can match eol */ +case 51: +/* rule 51 can match eol */ YY_RULE_SETUP { return EOSTMT; } YY_BREAK -case 51: +case 52: YY_RULE_SETUP /* Ignore */ YY_BREAK -case 52: -/* rule 52 can match eol */ +case 53: +/* rule 53 can match eol */ YY_RULE_SETUP /* Ignore line-endings preceded by \ */ YY_BREAK -case 53: +case 54: YY_RULE_SETUP { return *yytext; } YY_BREAK @@ -1441,7 +1445,7 @@ case YY_STATE_EOF(str_dq): } } YY_BREAK -case 54: +case 55: YY_RULE_SETUP ECHO; YY_BREAK diff --git a/Source/LexerParser/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l index fac3181..7d97699 100644 --- a/Source/LexerParser/cmFortranLexer.in.l +++ b/Source/LexerParser/cmFortranLexer.in.l @@ -102,6 +102,7 @@ Modify cmFortranLexer.cxx: <fixed_fmt>^[cC*dD].*\n { return EOSTMT; } /* empty lines */ ^[ \t]*#([ \t]*line)?[ \t]*[0-9]+[ \t]* { return CPP_LINE_DIRECTIVE; } +^[ \t]*#[ \t]*line[ \t]* { return CPP_LINE_DIRECTIVE; } ^[ \t]*#[ \t]*include[ \t]*<[^>]+> { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 28ba60f..32f0cbd 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -794,6 +794,15 @@ void handleSystemIncludesDep(cmLocalGenerator* lg, result.append(cmGeneratorExpression::Evaluate( *dirs, lg, config, headTarget, dagChecker, depTgt, language)); } + + if (depTgt->Target->IsFrameworkOnApple()) { + if (auto fwDescriptor = depTgt->GetGlobalGenerator()->SplitFrameworkPath( + depTgt->GetLocation(config), + cmGlobalGenerator::FrameworkFormat::Strict)) { + result.push_back(fwDescriptor->Directory); + result.push_back(fwDescriptor->GetFrameworkPath()); + } + } } } @@ -3819,32 +3828,38 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( AddInterfaceEntries(this, config, "INTERFACE_INCLUDE_DIRECTORIES", lang, &dagChecker, entries, IncludeRuntimeInterface::Yes); + processIncludeDirectories(this, entries, includes, uniqueIncludes, + debugIncludes); + if (this->IsApple()) { if (cmLinkImplementationLibraries const* impl = this->GetLinkImplementationLibraries(config, LinkInterfaceFor::Usage)) { for (cmLinkImplItem const& lib : impl->Libraries) { - std::string libDir = cmSystemTools::CollapseFullPath( - lib.AsStr(), this->Makefile->GetHomeOutputDirectory()); - - static cmsys::RegularExpression frameworkCheck( - "(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); - if (!frameworkCheck.find(libDir)) { + std::string libDir; + if (lib.Target == nullptr) { + libDir = cmSystemTools::CollapseFullPath( + lib.AsStr(), this->Makefile->GetHomeOutputDirectory()); + } else if (lib.Target->Target->IsFrameworkOnApple()) { + libDir = lib.Target->GetLocation(config); + } else { continue; } - libDir = frameworkCheck.match(1); + auto fwDescriptor = + this->GetGlobalGenerator()->SplitFrameworkPath(libDir); + if (!fwDescriptor) { + continue; + } - EvaluatedTargetPropertyEntry ee(lib, cmListFileBacktrace()); - ee.Values.emplace_back(std::move(libDir)); - entries.Entries.emplace_back(std::move(ee)); + auto fwInclude = fwDescriptor->GetFrameworkPath(); + if (uniqueIncludes.insert(fwInclude).second) { + includes.emplace_back(fwInclude, cmListFileBacktrace()); + } } } } - processIncludeDirectories(this, entries, includes, uniqueIncludes, - debugIncludes); - this->IncludeDirectoriesCache.emplace(cacheKey, includes); return includes; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 84c85e0..7626fa3 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2226,9 +2226,9 @@ Compilation of source files within a target is split into the following steps: depfile = $DEP_FILE command = gfortran -cpp $DEFINES $INCLUDES $FLAGS -E $in -o $out && cmake -E cmake_ninja_depends \ - --tdi=FortranDependInfo.json --pp=$out --dep=$DEP_FILE \ - --obj=$OBJ_FILE --ddi=$DYNDEP_INTERMEDIATE_FILE \ - --lang=Fortran + --tdi=FortranDependInfo.json --lang=Fortran \ + --src=$out --out=$out --dep=$DEP_FILE --obj=$OBJ_FILE \ + --ddi=$DYNDEP_INTERMEDIATE_FILE build src.f90-pp.f90 | src.f90.o.ddi: Fortran_PREPROCESS src.f90 OBJ_FILE = src.f90.o @@ -2296,14 +2296,15 @@ struct cmSourceInfo }; cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( - std::string const& arg_tdi, std::string const& arg_pp); + std::string const& arg_tdi, std::string const& arg_src); } int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, std::vector<std::string>::const_iterator argEnd) { std::string arg_tdi; - std::string arg_pp; + std::string arg_src; + std::string arg_out; std::string arg_dep; std::string arg_obj; std::string arg_ddi; @@ -2311,8 +2312,10 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, for (std::string const& arg : cmMakeRange(argBeg, argEnd)) { if (cmHasLiteralPrefix(arg, "--tdi=")) { arg_tdi = arg.substr(6); - } else if (cmHasLiteralPrefix(arg, "--pp=")) { - arg_pp = arg.substr(5); + } else if (cmHasLiteralPrefix(arg, "--src=")) { + arg_src = arg.substr(6); + } else if (cmHasLiteralPrefix(arg, "--out=")) { + arg_out = arg.substr(6); } else if (cmHasLiteralPrefix(arg, "--dep=")) { arg_dep = arg.substr(6); } else if (cmHasLiteralPrefix(arg, "--obj=")) { @@ -2321,6 +2324,10 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, arg_ddi = arg.substr(6); } else if (cmHasLiteralPrefix(arg, "--lang=")) { arg_lang = arg.substr(7); + } else if (cmHasLiteralPrefix(arg, "--pp=")) { + // CMake 3.26 and below used '--pp=' instead of '--src=' and '--out='. + arg_src = arg.substr(5); + arg_out = arg_src; } else { cmSystemTools::Error( cmStrCat("-E cmake_ninja_depends unknown argument: ", arg)); @@ -2331,8 +2338,12 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, cmSystemTools::Error("-E cmake_ninja_depends requires value for --tdi="); return 1; } - if (arg_pp.empty()) { - cmSystemTools::Error("-E cmake_ninja_depends requires value for --pp="); + if (arg_src.empty()) { + cmSystemTools::Error("-E cmake_ninja_depends requires value for --src="); + return 1; + } + if (arg_out.empty()) { + cmSystemTools::Error("-E cmake_ninja_depends requires value for --out="); return 1; } if (arg_dep.empty()) { @@ -2354,7 +2365,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, cm::optional<cmSourceInfo> info; if (arg_lang == "Fortran") { - info = cmcmd_cmake_ninja_depends_fortran(arg_tdi, arg_pp); + info = cmcmd_cmake_ninja_depends_fortran(arg_tdi, arg_src); } else { cmSystemTools::Error( cmStrCat("-E cmake_ninja_depends does not understand the ", arg_lang, @@ -2371,7 +2382,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, { cmGeneratedFileStream depfile(arg_dep); - depfile << cmSystemTools::ConvertToUnixOutputPath(arg_pp) << ":"; + depfile << cmSystemTools::ConvertToUnixOutputPath(arg_out) << ":"; for (std::string const& include : info->Includes) { depfile << " \\\n " << cmSystemTools::ConvertToUnixOutputPath(include); } @@ -2389,7 +2400,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, namespace { cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( - std::string const& arg_tdi, std::string const& arg_pp) + std::string const& arg_tdi, std::string const& arg_src) { cm::optional<cmSourceInfo> info; cmFortranCompiler fc; @@ -2441,9 +2452,9 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran( cmFortranSourceInfo finfo; std::set<std::string> defines; cmFortranParser parser(fc, includes, defines, finfo); - if (!cmFortranParser_FilePush(&parser, arg_pp.c_str())) { + if (!cmFortranParser_FilePush(&parser, arg_src.c_str())) { cmSystemTools::Error( - cmStrCat("-E cmake_ninja_depends failed to open ", arg_pp)); + cmStrCat("-E cmake_ninja_depends failed to open ", arg_src)); return info; } if (cmFortran_yyparse(parser.Scanner) != 0) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 60f46e5..110933e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2765,7 +2765,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (emitted.insert(frameworkDir).second) { std::string incpath = this->XCodeEscapePath(frameworkDir); if (emitSystemIncludes && - gtgt->IsSystemIncludeDirectory(include, configName, + gtgt->IsSystemIncludeDirectory(frameworkDir, configName, langForIncludes)) { sysfdirs.Add(incpath); } else { @@ -3910,8 +3910,6 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) // otherwise we end up hard-coding a path to the wrong SDK for // SDK-provided frameworks that are added by their full path. std::set<std::string> emitted(cli->GetFrameworkPathsEmitted()); - const auto& fwPaths = cli->GetFrameworkPaths(); - emitted.insert(fwPaths.begin(), fwPaths.end()); BuildObjectListOrString libPaths(this, true); BuildObjectListOrString fwSearchPaths(this, true); for (auto const& libItem : configItemMap[configName]) { diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index ba0c138..b7ee4fa 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -191,16 +191,24 @@ std::string cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli) } std::string cmLinkLineComputer::ComputeFrameworkPath( - cmComputeLinkInformation& cli, std::string const& fwSearchFlag) + cmComputeLinkInformation& cli, cmValue fwSearchFlag, cmValue sysFwSearchFlag) { + if (!fwSearchFlag && !sysFwSearchFlag) { + return std::string{}; + } + std::string frameworkPath; - if (!fwSearchFlag.empty()) { - std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths(); - for (std::string const& fd : fwDirs) { + auto const& fwDirs = cli.GetFrameworkPaths(); + for (auto const& fd : fwDirs) { + if (sysFwSearchFlag && + cli.GetTarget()->IsSystemIncludeDirectory(fd, cli.GetConfig(), + cli.GetLinkLanguage())) { + frameworkPath += sysFwSearchFlag; + } else { frameworkPath += fwSearchFlag; - frameworkPath += this->ConvertToOutputFormat(fd); - frameworkPath += " "; } + frameworkPath += this->ConvertToOutputFormat(fd); + frameworkPath += " "; } return frameworkPath; } diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index 9fb222c..4e285f2 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -9,6 +9,7 @@ #include <vector> #include "cmStateDirectory.h" +#include "cmValue.h" class cmComputeLinkInformation; class cmGeneratorTarget; @@ -43,7 +44,8 @@ public: std::vector<BT<std::string>>& linkPath); std::string ComputeFrameworkPath(cmComputeLinkInformation& cli, - std::string const& fwSearchFlag); + cmValue fwSearchFlag, + cmValue sysFwSearchFlag); std::string ComputeLinkLibraries(cmComputeLinkInformation& cli, std::string const& stdLibString); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4089fd4..63b2043 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -914,7 +914,7 @@ std::string cmLocalGenerator::GetIncludeFlags( cmSystemTools::CollapseFullPath(cmStrCat(i, "/../")); if (emitted.insert(frameworkDir).second) { if (sysFwSearchFlag && target && - target->IsSystemIncludeDirectory(i, config, lang)) { + target->IsSystemIncludeDirectory(frameworkDir, config, lang)) { includeFlags << *sysFwSearchFlag; } else { includeFlags << *fwSearchFlag; @@ -1645,9 +1645,9 @@ std::vector<BT<std::string>> cmLocalGenerator::GetTargetCompileFlags( return flags; } -static std::string GetFrameworkFlags(const std::string& lang, - const std::string& config, - cmGeneratorTarget* target) +std::string cmLocalGenerator::GetFrameworkFlags(std::string const& lang, + std::string const& config, + cmGeneratorTarget* target) { cmLocalGenerator* lg = target->GetLocalGenerator(); cmMakefile* mf = lg->GetMakefile(); @@ -1656,10 +1656,13 @@ static std::string GetFrameworkFlags(const std::string& lang, return std::string(); } - std::string fwSearchFlagVar = "CMAKE_" + lang + "_FRAMEWORK_SEARCH_FLAG"; - cmValue fwSearchFlag = mf->GetDefinition(fwSearchFlagVar); - if (!cmNonempty(fwSearchFlag)) { - return std::string(); + cmValue fwSearchFlag = + mf->GetDefinition(cmStrCat("CMAKE_", lang, "_FRAMEWORK_SEARCH_FLAG")); + cmValue sysFwSearchFlag = mf->GetDefinition( + cmStrCat("CMAKE_", lang, "_SYSTEM_FRAMEWORK_SEARCH_FLAG")); + + if (!fwSearchFlag && !sysFwSearchFlag) { + return std::string{}; } std::set<std::string> emitted; @@ -1684,7 +1687,12 @@ static std::string GetFrameworkFlags(const std::string& lang, std::vector<std::string> const& frameworks = cli->GetFrameworkPaths(); for (std::string const& framework : frameworks) { if (emitted.insert(framework).second) { - flags += *fwSearchFlag; + if (sysFwSearchFlag && + target->IsSystemIncludeDirectory(framework, config, lang)) { + flags += *sysFwSearchFlag; + } else { + flags += *fwSearchFlag; + } flags += lg->ConvertToOutputFormat(framework, cmOutputConverter::SHELL); flags += " "; @@ -1694,13 +1702,6 @@ static std::string GetFrameworkFlags(const std::string& lang, return flags; } -std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, - std::string const& config, - cmGeneratorTarget* target) -{ - return ::GetFrameworkFlags(l, config, target); -} - void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, std::string const& config, std::string const& lang, @@ -1788,10 +1789,13 @@ void cmLocalGenerator::OutputLinkLibraries( cmStrCat("CMAKE_", cli.GetLinkLanguage(), "_STANDARD_LIBRARIES")); // Append the framework search path flags. - std::string fwSearchFlag = this->Makefile->GetSafeDefinition( + cmValue fwSearchFlag = this->Makefile->GetDefinition( cmStrCat("CMAKE_", linkLanguage, "_FRAMEWORK_SEARCH_FLAG")); + cmValue sysFwSearchFlag = this->Makefile->GetDefinition( + cmStrCat("CMAKE_", linkLanguage, "_SYSTEM_FRAMEWORK_SEARCH_FLAG")); - frameworkPath = linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag); + frameworkPath = + linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag, sysFwSearchFlag); linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator, linkPath); linkLineComputer->ComputeLinkLibraries(cli, stdLibString, linkLibraries); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4ed491d..5bf6a2b 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -540,12 +540,12 @@ void cmNinjaTargetGenerator::WriteLanguageRules(const std::string& language, namespace { // Create the command to run the dependency scanner -std::string GetScanCommand(const std::string& cmakeCmd, const std::string& tdi, - const std::string& lang, const std::string& ppFile, - const std::string& ddiFile) +std::string GetScanCommand(cm::string_view cmakeCmd, cm::string_view tdi, + cm::string_view lang, cm::string_view srcFile, + cm::string_view ddiFile) { return cmStrCat(cmakeCmd, " -E cmake_ninja_depends --tdi=", tdi, - " --lang=", lang, " --pp=", ppFile, + " --lang=", lang, " --src=", srcFile, " --out=$out", " --dep=$DEP_FILE --obj=$OBJ_FILE --ddi=", ddiFile); } @@ -1258,6 +1258,7 @@ namespace { cmNinjaBuild GetScanBuildStatement(const std::string& ruleName, const std::string& ppFileName, bool compilePP, bool compilePPWithDefines, + bool compilationPreprocesses, cmNinjaBuild& objBuild, cmNinjaVars& vars, const std::string& objectFileName, cmLocalGenerator* lg) @@ -1314,6 +1315,13 @@ cmNinjaBuild GetScanBuildStatement(const std::string& ruleName, } else { scanBuild.Outputs.push_back(ddiFile); scanBuild.Variables["PREPROCESSED_OUTPUT_FILE"] = ppFileName; + if (!compilationPreprocesses) { + // Compilation does not preprocess and we are not compiling an + // already-preprocessed source. Make compilation depend on the scan + // results to honor implicit dependencies discovered during scanning + // (such as Fortran INCLUDE directives). + objBuild.ImplicitDeps.emplace_back(ddiFile); + } } // Scanning always provides a depfile for preprocessor dependencies. This @@ -1520,8 +1528,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } cmNinjaBuild ppBuild = GetScanBuildStatement( - scanRuleName, ppFileName, compilePP, compilePPWithDefines, objBuild, - vars, objectFileName, this->LocalGenerator); + scanRuleName, ppFileName, compilePP, compilePPWithDefines, + compilationPreprocesses, objBuild, vars, objectFileName, + this->LocalGenerator); if (compilePP) { // In case compilation requires flags that are incompatible with diff --git a/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt index 9a255a0..a09f638 100644 --- a/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt +++ b/Tests/ISPC/ChainedStaticLibraries/CMakeLists.txt @@ -11,10 +11,15 @@ add_library(ispc_objects1 STATIC extra.ispc extra.cxx) add_library(ispc_objects2 STATIC simple.ispc) set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON) -set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4") - set_target_properties(ispc_objects2 PROPERTIES POSITION_INDEPENDENT_CODE ON) -set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4") + +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4") + set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4") +else() + set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4") + set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4") +endif() target_link_libraries(ispc_objects2 PRIVATE ispc_objects1) diff --git a/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt b/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt index d20f88e..4cf5ca1 100644 --- a/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt +++ b/Tests/ISPC/CustomHeaderSuffix/CMakeLists.txt @@ -6,7 +6,11 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(CMAKE_ISPC_FLAGS "--arch=x86") endif() -set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4") +else() + set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16") +endif() set(CMAKE_ISPC_HEADER_SUFFIX ".ispc.h") diff --git a/Tests/ISPC/Defines/CMakeLists.txt b/Tests/ISPC/Defines/CMakeLists.txt index 7645804..2b99469 100644 --- a/Tests/ISPC/Defines/CMakeLists.txt +++ b/Tests/ISPC/Defines/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.18) project(ISPCDefines CXX ISPC) -set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4") +else() + set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8") +endif() + set(CMAKE_ISPC_FLAGS -DM_PI=3.1415926535f) add_compile_definitions([==[STRUCT_DEFINE=struct{uniform int a]==]) diff --git a/Tests/ISPC/DynamicLibrary/CMakeLists.txt b/Tests/ISPC/DynamicLibrary/CMakeLists.txt index 4655090..516cdc1 100644 --- a/Tests/ISPC/DynamicLibrary/CMakeLists.txt +++ b/Tests/ISPC/DynamicLibrary/CMakeLists.txt @@ -13,8 +13,13 @@ target_sources(ispc_objects2 PRIVATE simple.cxx) set_target_properties(ispc_objects1 PROPERTIES POSITION_INDEPENDENT_CODE ON) -set_target_properties(ispc_objects1 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4") -set_target_properties(ispc_objects2 PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4") + set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4") +else() + set_property(TARGET ispc_objects1 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;avx1-i32x16;avx2-i32x4") + set_property(TARGET ispc_objects2 PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4") +endif() target_link_libraries(ispc_objects2 PUBLIC ispc_objects1) diff --git a/Tests/ISPC/ObjectGenex/CMakeLists.txt b/Tests/ISPC/ObjectGenex/CMakeLists.txt index bc0cbf6..5e64004 100644 --- a/Tests/ISPC/ObjectGenex/CMakeLists.txt +++ b/Tests/ISPC/ObjectGenex/CMakeLists.txt @@ -1,7 +1,14 @@ cmake_minimum_required(VERSION 3.18) project(ISPCObjectGenex CXX ISPC) -set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set(CMAKE_ISPC_INSTRUCTION_SETS "neon-i32x4") + set(numberOfTargets 1) +else() + set(CMAKE_ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4;avx512knl-i32x16;avx512skx-i32x8") + list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets) + math(EXPR numberOfTargets "${numberOfTargets}+1") +endif() add_library(ispc_objects OBJECT simple.ispc @@ -35,8 +42,6 @@ static std::string obj_paths = "$<TARGET_OBJECTS:ispc_objects>"; add_executable(ISPCObjectGenex main.cxx) add_dependencies(ISPCObjectGenex ispc_objects) -list(LENGTH CMAKE_ISPC_INSTRUCTION_SETS numberOfTargets) -math(EXPR numberOfTargets "${numberOfTargets}+1") target_compile_definitions(ISPCObjectGenex PRIVATE "ExpectedISPCObjects=${numberOfTargets}" "CONFIG_TYPE=gen_$<LOWER_CASE:$<CONFIG>>" diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt index a4c81a9..60ce920 100644 --- a/Tests/ISPC/ObjectLibrary/CMakeLists.txt +++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt @@ -11,8 +11,12 @@ endif() add_library(ispc_objects OBJECT simple.ispc subdir/extra.ispc) set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) -set_target_properties(ispc_objects PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set_property(TARGET ispc_objects PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4") +else() + set_property(TARGET ispc_objects PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16") +endif() add_executable(ISPCObjectLibrary main.cxx extra.cxx) target_link_libraries(ISPCObjectLibrary PRIVATE ispc_objects) diff --git a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt index 7539209..d29cb2a 100644 --- a/Tests/ISPC/ResponseAndDefine/CMakeLists.txt +++ b/Tests/ISPC/ResponseAndDefine/CMakeLists.txt @@ -14,13 +14,15 @@ add_executable(ISPCResponseAndDefine main.cxx simple.ispc) set_target_properties(ISPCResponseAndDefine PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(ISPCResponseAndDefine PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") -target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=neon-i32x4>") +else() + target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") + endif() endif() - - target_compile_definitions(ISPCResponseAndDefine PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:STRUCT_DEFINE=struct{uniform int a>;M_PI=3.14159f") target_include_directories(ISPCResponseAndDefine PRIVATE diff --git a/Tests/ISPC/StaticLibrary/CMakeLists.txt b/Tests/ISPC/StaticLibrary/CMakeLists.txt index ebe5960..76f78e5 100644 --- a/Tests/ISPC/StaticLibrary/CMakeLists.txt +++ b/Tests/ISPC/StaticLibrary/CMakeLists.txt @@ -4,9 +4,13 @@ project(ISPCStaticLibrary CXX ISPC) add_library(ispc_objects STATIC simple.ispc) -target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=neon-i32x4>") +else() + target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(ispc_objects PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") + endif() endif() set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/Tests/ISPC/SystemIncludes/CMakeLists.txt b/Tests/ISPC/SystemIncludes/CMakeLists.txt index d94e75e..3b4c289 100644 --- a/Tests/ISPC/SystemIncludes/CMakeLists.txt +++ b/Tests/ISPC/SystemIncludes/CMakeLists.txt @@ -7,8 +7,11 @@ set_target_properties(ISPCSystemIncludes PROPERTIES POSITION_INDEPENDENT_CODE ON set_target_properties(ISPCSystemIncludes PROPERTIES ISPC_HEADER_SUFFIX ".ispc.h") target_include_directories(ISPCSystemIncludes SYSTEM PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") - -target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=neon-i32x4>") +else() + target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--target=sse2-i32x4>") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(ISPCSystemIncludes PRIVATE "$<$<COMPILE_LANGUAGE:ISPC>:--arch=x86>") + endif() endif() diff --git a/Tests/RunCMake/BuildDepends/FortranInclude-build1-stderr.txt b/Tests/RunCMake/BuildDepends/FortranInclude-build1-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranInclude-build1-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/BuildDepends/FortranInclude-build2-stderr.txt b/Tests/RunCMake/BuildDepends/FortranInclude-build2-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranInclude-build2-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/BuildDepends/FortranInclude.cmake b/Tests/RunCMake/BuildDepends/FortranInclude.cmake new file mode 100644 index 0000000..fa9f399 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranInclude.cmake @@ -0,0 +1,20 @@ +enable_language(Fortran) + +set(check_pairs "") + +add_executable(preprocess FortranIncludePreprocess.F) +set_property(TARGET preprocess PROPERTY Fortran_PREPROCESS ON) +target_include_directories(preprocess PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +list(APPEND check_pairs "$<TARGET_FILE:preprocess>|${CMAKE_CURRENT_BINARY_DIR}/preprocess.inc") + +# LCC < 1.24 has no way to disable Fortran preprocessor +if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL "LCC" OR CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "1.24.00") + add_executable(no_preprocess FortranIncludeNoPreprocess.f) + set_property(TARGET no_preprocess PROPERTY Fortran_PREPROCESS OFF) + target_include_directories(no_preprocess PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + list(APPEND check_pairs "$<TARGET_FILE:no_preprocess>|${CMAKE_CURRENT_BINARY_DIR}/no_preprocess.inc") +endif() + +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs \"${check_pairs}\") +") diff --git a/Tests/RunCMake/BuildDepends/FortranInclude.step1.cmake b/Tests/RunCMake/BuildDepends/FortranInclude.step1.cmake new file mode 100644 index 0000000..53fdc2f --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranInclude.step1.cmake @@ -0,0 +1,2 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/preprocess.inc" "\tPRINT *, 'FortranIncludePreprocess 1'\n") +file(WRITE "${RunCMake_TEST_BINARY_DIR}/no_preprocess.inc" "\tPRINT *, 'FortranIncludeNoPreprocess 1'\n") diff --git a/Tests/RunCMake/BuildDepends/FortranInclude.step2.cmake b/Tests/RunCMake/BuildDepends/FortranInclude.step2.cmake new file mode 100644 index 0000000..05a9f11 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranInclude.step2.cmake @@ -0,0 +1,2 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/preprocess.inc" "\tPRINT *, 'FortranIncludePreprocess 2'\n") +file(WRITE "${RunCMake_TEST_BINARY_DIR}/no_preprocess.inc" "\tPRINT *, 'FortranIncludeNoPreprocess 2'\n") diff --git a/Tests/RunCMake/BuildDepends/FortranIncludeNoPreprocess.f b/Tests/RunCMake/BuildDepends/FortranIncludeNoPreprocess.f new file mode 100644 index 0000000..00b04dc --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranIncludeNoPreprocess.f @@ -0,0 +1,3 @@ + PROGRAM FortranIncludeNoPreprocess + INCLUDE 'no_preprocess.inc' + END diff --git a/Tests/RunCMake/BuildDepends/FortranIncludePreprocess.F b/Tests/RunCMake/BuildDepends/FortranIncludePreprocess.F new file mode 100644 index 0000000..680313a --- /dev/null +++ b/Tests/RunCMake/BuildDepends/FortranIncludePreprocess.F @@ -0,0 +1,3 @@ + PROGRAM FortranIncludePreprocess +#include "preprocess.inc" + END diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index b527580..dfa4f49 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -68,6 +68,10 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode") unset(run_BuildDepends_skip_step_2) endif() +if(CMake_TEST_Fortran) + run_BuildDepends(FortranInclude) +endif() + run_BuildDepends(Custom-Symbolic-and-Byproduct) run_BuildDepends(Custom-Always) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 3007660..cea8cff 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -292,6 +292,10 @@ if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS endif() endif() +if(CMAKE_Fortran_COMPILER) + list(APPEND BuildDepends_ARGS -DCMake_TEST_Fortran=1) +endif() + add_RunCMake_test(BuildDepends -DMSVC_VERSION=${MSVC_VERSION} -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} @@ -668,6 +672,7 @@ endif() if(XCODE_VERSION) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION} + -DCMAKE_HOST_SYSTEM_PROCESSOR=${CMAKE_HOST_SYSTEM_PROCESSOR} -DCMake_TEST_Swift=${CMake_TEST_Swift}) add_RunCMake_test(XcodeProject-Embed -DXCODE_VERSION=${XCODE_VERSION}) @@ -786,6 +791,7 @@ endif() add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DCMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN=${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR} -DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG} -DCMAKE_EXECUTABLE_FORMAT=${CMAKE_EXECUTABLE_FORMAT} -DCMake_TEST_ISPC=${CMake_TEST_ISPC} diff --git a/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake index d172281..bcf6c29 100644 --- a/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake +++ b/Tests/RunCMake/Framework/FrameworkSystemIncludeTest.cmake @@ -10,3 +10,15 @@ set_target_properties(Example::Example PROPERTIES add_library(testcase FrameworkSystemIncludeTest.c) target_compile_options(testcase PRIVATE "-Werror=#pragma-messages") target_link_libraries(testcase PRIVATE Example::Example) + + + +add_library(Example::Example2 SHARED IMPORTED) +set_target_properties(Example::Example2 PROPERTIES + FRAMEWORK 1 + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/subdir/Example.framework/Example.tbd" +) + +add_library(testcase2 FrameworkSystemIncludeTest.c) +target_compile_options(testcase2 PRIVATE "-Werror=#pragma-messages") +target_link_libraries(testcase2 PRIVATE Example::Example2) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 619e94a..6eb0b1d 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -51,6 +51,7 @@ if(WIN32) run_cmake_script(ShowIncludes-437-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) run_cmake_script(ShowIncludes-437-German -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) run_cmake_script(ShowIncludes-437-Italian -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) + run_cmake_script(ShowIncludes-437-WineMSVC -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) run_cmake_script(ShowIncludes-54936-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) run_cmake_script(ShowIncludes-65001-Chinese -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) run_cmake_script(ShowIncludes-65001-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM}) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake new file mode 100644 index 0000000..d4017ab --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-check.cmake @@ -0,0 +1,3 @@ +# 'msvc-wine -showIncludes' prefix. +set(expect "Note: including file: ") +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake) diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt new file mode 100644 index 0000000..bda7eab --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC-stdout.txt @@ -0,0 +1 @@ +-- showIncludes='Note: including file: ' diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake new file mode 100644 index 0000000..59d3bf6 --- /dev/null +++ b/Tests/RunCMake/Ninja/ShowIncludes-437-WineMSVC.cmake @@ -0,0 +1,3 @@ +set(CODEPAGE 437) +set(VSLANG "msvc-wine") # Special case for test, not a real VS value. +include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 18dde94..bc4a330 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -167,7 +167,9 @@ function(run_cmake test) "|BullseyeCoverage" "|[a-z]+\\([0-9]+\\) malloc:" "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" + "|flang-new: warning: argument unused during compilation: .-flang-experimental-exec." "|icp?x: remark: Note that use of .-g. without any optimization-level option will turn off most compiler optimizations" + "|ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations" "|lld-link: warning: procedure symbol record for .* refers to PDB item index [0-9A-Fa-fx]+ which is not a valid function ID record" "|Error kstat returned" "|Hit xcodebuild bug" diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 3910127..61f7c40 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -101,7 +101,7 @@ function(XcodeSchemaGeneration) run_cmake(XcodeSchemaGeneration) if (XCODE_VERSION VERSION_GREATER_EQUAL 13) - set(maybe_destination -destination platform=macOS) + set(maybe_destination -destination platform=macOS,arch=${CMAKE_HOST_SYSTEM_PROCESSOR}) else() set(maybe_destination "") endif() diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake index 8750a76..2d4ce66 100644 --- a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake @@ -1,6 +1,10 @@ set(objs obj1 obj2) -set(targets sse2 sse4 avx avx2) +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set(targets "") +else() + set(targets sse2 sse4 avx avx2) +endif() foreach(o IN LISTS objs) set(item "objs/${o}\\.ispc\\.(o|obj)") check_installed("${item}") diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake index ad542ed..91ed458 100644 --- a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake @@ -1,4 +1,8 @@ enable_language(ISPC) add_library(objs OBJECT obj1.ispc obj2.ispc) -set_target_properties(objs PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4") +if("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + set_property(TARGET objs PROPERTY ISPC_INSTRUCTION_SETS "neon-i32x4") +else() + set_property(TARGET objs PROPERTY ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4") +endif() install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs) diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c index 5afe04a..7d467cf 100644 --- a/Tests/RunCMake/showIncludes.c +++ b/Tests/RunCMake/showIncludes.c @@ -36,6 +36,14 @@ int main() } } + // msvc-wine (special case for test, not a real VS value). + if (strcmp(vslang, "msvc-wine") == 0) { + if (cp == 437 || cp == 65001) { + printf("Note: including file: /c/foo.h\n"); + return 0; + } + } + // German. if (strcmp(vslang, "1031") == 0) { if (cp == 437 || cp == 65001) { @@ -880,7 +880,7 @@ cmake_try_run () echo "---------- file -----------------------" cat "${TESTFILE}" echo "------------------------------------------" - "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}" + ${COMPILER} ${FLAGS} "${TESTFILE}" -o "${TMPFILE}" RES=$? if test "${RES}" -ne "0"; then echo "Test failed to compile" @@ -1206,15 +1206,18 @@ cmake_c_compiler= # If CC is set, use that for compiler, otherwise use list of known compilers if test -n "${cmake_toolchain}"; then eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}" -elif test -n "${CC}"; then - cmake_c_compilers="${CC}" else cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}" fi -# Check if C compiler works -TMPFILE=`cmake_tmp_file` -echo ' +cmake_c_compiler_try_set() +{ + test_compiler="$1" + test_thread_flags="$2" + + # Check if C compiler works + TMPFILE=`cmake_tmp_file` + echo ' #ifdef __cplusplus # error "The CMAKE_C_COMPILER is set to a C++ compiler" #endif @@ -1239,23 +1242,34 @@ int main(int argc, char* argv[]) return argc - 1; } ' > "${TMPFILE}.c" -for std in 11 99 90; do - std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`" - for compiler in ${cmake_c_compilers}; do + for std in 11 99 90; do + std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`" for std_flag in '' $std_flags; do - for thread_flag in '' $thread_flags; do - echo "Checking whether '${compiler} ${cmake_c_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1 - if cmake_try_run "${compiler}" "${cmake_c_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \ + for thread_flag in '' $test_thread_flags; do + echo "Checking whether '${test_compiler} ${cmake_c_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1 + if cmake_try_run "${test_compiler}" "${cmake_c_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \ "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then - cmake_c_compiler="${compiler}" + cmake_c_compiler="${test_compiler}" cmake_c_flags="${cmake_c_flags} ${std_flag} ${thread_flag}" - break 4 + rm -f "${TMPFILE}.c" + return 0 fi done done done -done -rm -f "${TMPFILE}.c" + rm -f "${TMPFILE}.c" + return 1 +} + +if test -n "${CC}"; then + cmake_c_compiler_try_set "${CC}" "${thread_flags}" +else + for compiler in ${cmake_c_compilers}; do + if cmake_c_compiler_try_set "${compiler}" "${thread_flags}"; then + break + fi + done +fi if test -z "${cmake_c_compiler}"; then cmake_error 6 "Cannot find appropriate C compiler on this system. @@ -1274,14 +1288,17 @@ cmake_cxx_compiler= # If CC is set, use that for compiler, otherwise use list of known compilers if test -n "${cmake_toolchain}"; then eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}" -elif test -n "${CXX}"; then - cmake_cxx_compilers="${CXX}" else cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}" fi # Check if C++ compiler works -TMPFILE=`cmake_tmp_file` +cmake_cxx_compiler_try_set() +{ + test_compiler="$1" + test_thread_flags="$2" + + TMPFILE=`cmake_tmp_file` echo ' #include <iostream> #include <memory> @@ -1360,23 +1377,34 @@ int main() return 0; } ' > "${TMPFILE}.cxx" -for std in 17 14 11; do - std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`" - for compiler in ${cmake_cxx_compilers}; do + for std in 17 14 11; do + std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`" for std_flag in '' $std_flags; do - for thread_flag in '' $thread_flags; do - echo "Checking whether '${compiler} ${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1 - if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \ + for thread_flag in '' $test_thread_flags; do + echo "Checking whether '${test_compiler} ${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1 + if cmake_try_run "${test_compiler}" "${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \ "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then - cmake_cxx_compiler="${compiler}" + cmake_cxx_compiler="${test_compiler}" cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} " - break 4 + rm -f "${TMPFILE}.cxx" + return 0 fi done done done -done -rm -f "${TMPFILE}.cxx" + rm -f "${TMPFILE}.cxx" + return 1 +} + +if test -n "${CXX}"; then + cmake_cxx_compiler_try_set "${CXX}" "${thread_flags}" +else + for compiler in ${cmake_cxx_compilers}; do + if cmake_cxx_compiler_try_set "${compiler}" "${thread_flags}"; then + break + fi + done +fi if test -z "${cmake_cxx_compiler}"; then cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags. @@ -1435,13 +1463,13 @@ cd "${cmake_bootstrap_dir}/${TMPFILE}" if test "${cmake_bootstrap_generator}" = "Ninja"; then echo ' rule cc - command = "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o $out $in + command = '"${cmake_c_compiler}"' '"${cmake_ld_flags} ${cmake_c_flags}"' -o $out $in build test: cc test.c '>"build.ninja" else echo ' test: test.c - "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c + '"${cmake_c_compiler}"' '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c '>"Makefile" fi echo ' |