diff options
65 files changed, 505 insertions, 434 deletions
diff --git a/.gitlab/ci/docker/fedora37/Dockerfile b/.gitlab/ci/docker/fedora37/Dockerfile index b36a17e..5439e9d 100644 --- a/.gitlab/ci/docker/fedora37/Dockerfile +++ b/.gitlab/ci/docker/fedora37/Dockerfile @@ -4,8 +4,7 @@ ARG BASE_IMAGE=fedora:37 FROM ${BASE_IMAGE} AS dnf-cache # Populate DNF cache w/ the fresh metadata and prefetch packages. -RUN --mount=type=bind,source=clang_tidy_headers_packages.lst,target=/root/clang_tidy_headers_packages.lst \ - --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \ +RUN --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \ --mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \ --mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \ --mount=type=tmpfs,target=/var/log \ @@ -30,17 +29,6 @@ RUN --mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \ sh /root/install_rvm.sh -FROM ${BASE_IMAGE} AS clang-tidy-headers -LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>" - -RUN --mount=type=bind,source=install_clang_tidy_headers.sh,target=/root/install_clang_tidy_headers.sh \ - --mount=type=bind,source=clang_tidy_headers_packages.lst,target=/root/clang_tidy_headers_packages.lst \ - --mount=type=cache,from=dnf-cache,source=/var/cache/dnf,target=/var/cache/dnf,sharing=private \ - --mount=type=tmpfs,target=/var/log \ - --mount=type=tmpfs,target=/tmp \ - sh /root/install_clang_tidy_headers.sh - - FROM ${BASE_IMAGE} AS iwyu-build LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>" @@ -66,8 +54,5 @@ RUN --mount=type=bind,source=install_deps.sh,target=/root/install_deps.sh \ RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \ tar -C /usr/local -xf /root/rvm.tar -RUN --mount=type=bind,from=clang-tidy-headers,source=/root,target=/root \ - tar -C /usr/include -xf /root/clang-tidy-headers.tar - RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \ tar -C / -xf /root/iwyu.tar diff --git a/.gitlab/ci/docker/fedora37/clang_tidy_headers_packages.lst b/.gitlab/ci/docker/fedora37/clang_tidy_headers_packages.lst deleted file mode 100644 index fe86105..0000000 --- a/.gitlab/ci/docker/fedora37/clang_tidy_headers_packages.lst +++ /dev/null @@ -1,4 +0,0 @@ -dnf-command(download) -rpm-build -python3-devel -clang-tools-extra diff --git a/.gitlab/ci/docker/fedora37/deps_packages.lst b/.gitlab/ci/docker/fedora37/deps_packages.lst index 51f84ff..68777f0 100644 --- a/.gitlab/ci/docker/fedora37/deps_packages.lst +++ b/.gitlab/ci/docker/fedora37/deps_packages.lst @@ -7,6 +7,7 @@ qt6-qtbase-devel # Install development tools. clang clang-tools-extra +clang-tools-extra-devel compiler-rt flang flang-devel @@ -18,6 +19,7 @@ make bzip2-devel expat-devel jsoncpp-devel +json-devel libarchive-devel libcurl-devel libuv-devel diff --git a/.gitlab/ci/docker/fedora37/install_clang_tidy_headers.sh b/.gitlab/ci/docker/fedora37/install_clang_tidy_headers.sh deleted file mode 100755 index 200fa1e..0000000 --- a/.gitlab/ci/docker/fedora37/install_clang_tidy_headers.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -# Packages for building the clang-tidy plugin. -# TODO: Upstream this as a proper Fedora package. -dnf install \ - --setopt=install_weak_deps=False \ - --setopt=fastestmirror=True \ - --setopt=max_parallel_downloads=10 \ - -y \ - $(grep '^[^#]\+$' /root/clang_tidy_headers_packages.lst) - -clang_source_rpm=$(rpm -q --queryformat '%{SOURCERPM}' clang-tools-extra) -clang_version=$(rpm -q --queryformat '%{VERSION}' clang-tools-extra) -dnf download --source -y clang -rpm -i "$clang_source_rpm" -rpmbuild -bp /root/rpmbuild/SPECS/clang.spec -cd "/root/rpmbuild/BUILD/clang-tools-extra-$clang_version.src" -find clang-tidy -name '*.h' | tar -cf /root/clang-tidy-headers.tar -T - diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 3d62b01..4ac7772 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -69,7 +69,7 @@ ### Fedora .fedora37: - image: "kitware/cmake:ci-fedora37-x86_64-2023-03-29" + image: "kitware/cmake:ci-fedora37-x86_64-2023-05-17" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes" diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 1579338..09d7598 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -7,7 +7,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-14.2.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode-14.3.app/Contents/Developer" # Avoid conflicting with other projects running on the same machine. SCCACHE_SERVER_PORT: 4227 @@ -110,7 +110,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-x86_64 - shell - - xcode-14.2 + - xcode-14.3 - nonconcurrent .macos_x86_64_tags_ext: @@ -118,7 +118,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-x86_64 - shell - - xcode-14.2 + - xcode-14.3 - concurrent .macos_arm64_tags: @@ -126,7 +126,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-14.2 + - xcode-14.3 - nonconcurrent .macos_arm64_tags_ext: @@ -134,7 +134,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-14.2 + - xcode-14.3 - concurrent .macos_arm64_tags_package: @@ -142,7 +142,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-14.2 + - xcode-14.3 - nonconcurrent - finder diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 07a479e..026f2f4 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -35,25 +35,25 @@ variables: VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" VCVARSPLATFORM: "x64" - VCVARSVERSION: "14.35.32215" + VCVARSVERSION: "14.36.32532" .windows_vcvarsall_vs2022_x86: variables: VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" VCVARSPLATFORM: "x86" - VCVARSVERSION: "14.35.32215" + VCVARSVERSION: "14.36.32532" .windows_vcvarsall_vs2022_x64_arm64: variables: VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" VCVARSPLATFORM: "x64_arm64" - VCVARSVERSION: "14.35.32215" + VCVARSVERSION: "14.36.32532" .windows_arm64_vcvarsall_vs2022: variables: VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" VCVARSPLATFORM: "arm64" - VCVARSVERSION: "14.35.32215" + VCVARSVERSION: "14.36.32532" .windows_vs2022_x64_ninja: extends: @@ -112,7 +112,7 @@ CMAKE_CONFIGURATION: windows_vs2022_x64 CMAKE_GENERATOR: "Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM: "x64" - CMAKE_GENERATOR_TOOLSET: "v143,version=14.35.32215" + CMAKE_GENERATOR_TOOLSET: "v143,version=14.36.32532" CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true" .windows_vs2019_x64: @@ -261,7 +261,7 @@ CMAKE_CONFIGURATION: windows_arm64_vs2022 CMAKE_GENERATOR: "Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM: "ARM64" - CMAKE_GENERATOR_TOOLSET: "v143,version=14.35.32215" + CMAKE_GENERATOR_TOOLSET: "v143,version=14.36.32532" CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true" .mingw_osdn_io: @@ -295,7 +295,7 @@ - windows-x86_64 - shell - vs2022 - - msvc-19.35 + - msvc-19.36 - nonconcurrent .windows_x86_64_tags_nonconcurrent_vs2022_arm64: @@ -304,7 +304,7 @@ - windows-x86_64 - shell - vs2022 - - msvc-19.35-arm64 + - msvc-19.36-arm64 - nonconcurrent .windows_x86_64_tags_concurrent_vs2022: @@ -313,7 +313,7 @@ - windows-x86_64 - shell - vs2022 - - msvc-19.35 + - msvc-19.36 - concurrent .windows_x86_64_tags_concurrent_vs2019: @@ -338,7 +338,7 @@ - windows-arm64 - shell - vs2022 - - msvc-19.35 + - msvc-19.36 - nonconcurrent .windows_arm64_tags_concurrent_vs2022: @@ -347,7 +347,7 @@ - windows-arm64 - shell - vs2022 - - msvc-19.35 + - msvc-19.36 - concurrent ## Windows-specific scripts 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/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/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 10e8ff3..604d25c 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -121,9 +121,9 @@ elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$") set(_CMAKE_IAR_ITOOLS "ARM" "RX" "RH850" "RL78" "RISCV" "RISC-V" "STM8") set(_CMAKE_IAR_XTOOLS "AVR" "MSP430" "V850" "8051") - if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) - string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _CMAKE_IAR_LOWER_ARCHITECTURE_ID) + string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _CMAKE_IAR_LOWER_ARCHITECTURE_ID) + if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) __append_IAR_tool(AR "iarchive") __append_IAR_tool(LINKER "ilink${_CMAKE_IAR_LOWER_ARCHITECTURE_ID}") @@ -132,16 +132,21 @@ elseif("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" MATCHES "^xIAR$") __append_IAR_tool(IAR_OBJMANIP "iobjmanip") __append_IAR_tool(IAR_SYMEXPORT "isymexport") - unset(_CMAKE_IAR_LOWER_ARCHITECTURE_ID) - elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_XTOOLS) __append_IAR_tool(AR "xar") - __append_IAR_tool(LINKER "xlink") + if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR" AND + (CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION VERSION_GREATER 7)) + # IAR UBROF Linker V8.10+ for Microchip AVR is `xlinkavr` + __append_IAR_tool(LINKER "xlink${_CMAKE_IAR_LOWER_ARCHITECTURE_ID}") + else() + __append_IAR_tool(LINKER "xlink") + endif() else() message(FATAL_ERROR "Failed to find linker and librarian for ${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID} on ${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}.") endif() + unset(_CMAKE_IAR_LOWER_ARCHITECTURE_ID) unset(_CMAKE_IAR_ITOOLS) unset(_CMAKE_IAR_XTOOLS) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index a21ba43..46f5fc1 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -176,6 +176,8 @@ macro(__compiler_clang_cxx_standards lang) 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") + set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26") + set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26") 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") diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index 4c0025c..5f1dac0 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -38,22 +38,26 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __assembler_iar_deps("-y" 8) set(_CMAKE_IAR_SILENCER_FLAG " -S") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r90") elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") __compiler_iar_xlink(ASM) __assembler_iar_deps("-y" 8) set(_CMAKE_IAR_SILENCER_FLAG " -S") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s43;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r43") elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850") __compiler_iar_xlink(ASM) set(_CMAKE_IAR_SILENCER_FLAG " -S") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s85;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r85") elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") __compiler_iar_xlink(ASM) set(_CMAKE_IAR_SILENCER_FLAG " -S") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r51") elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") __compiler_iar_ilink(ASM) diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index 0ef1a2a..c4907c5 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -59,7 +59,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV") elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(C) - __compiler_check_default_language_standard(C 7.10 99) + __compiler_check_default_language_standard(C 7.10 99 8.10 17) set(CMAKE_C_OUTPUT_EXTENSION ".r90") elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index 3f0ef1f..b598e36 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -68,7 +68,8 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RISCV") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(CXX) - __compiler_check_default_language_standard(CXX 7.10 98) + __compiler_check_default_language_standard(CXX 7.10 98 8.10 17) + set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") __compiler_iar_xlink(CXX) @@ -78,12 +79,12 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850") __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 1.10 98) - set(CMAKE_C_OUTPUT_EXTENSION ".r85") + set(CMAKE_CXX_OUTPUT_EXTENSION ".r85") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 6.10 98) - set(CMAKE_C_OUTPUT_EXTENSION ".r51") + set(CMAKE_CXX_OUTPUT_EXTENSION ".r51") elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") __compiler_iar_ilink(CXX) diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 32a7b3f5..8dadb76 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -23,6 +23,7 @@ macro(__compiler_iar_common lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -Oh -r -DNDEBUG") endif() + set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1) set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-f ") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-f ") diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 60d2296..7f35e07 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -2110,7 +2110,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # Use interpreter version and ABI for future searches to ensure consistency set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}) - execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETR_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c + execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.abiflags)" RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT OUTPUT_VARIABLE _${_PYTHON_PREFIX}_ABIFLAGS diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ffd095e..a1ccf30 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 20230511) +set(CMake_VERSION_PATCH 20230518) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) 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/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/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 58f06de..3997a74 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -678,6 +678,7 @@ 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-Device -DXCODE_VERSION=${XCODE_VERSION}) add_RunCMake_test(XcodeProject-Embed -DXCODE_VERSION=${XCODE_VERSION}) # This test can take a very long time due to lots of combinations. 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/XcodeProject-Device/CMakeLists.txt b/Tests/RunCMake/XcodeProject-Device/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.c b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c index 5e0f40f..5e0f40f 100644 --- a/Tests/RunCMake/XcodeProject/DeploymentTarget.c +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c diff --git a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake index 234ceef..234ceef 100644 --- a/Tests/RunCMake/XcodeProject/DeploymentTarget.cmake +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake diff --git a/Tests/RunCMake/XcodeProject/EffectivePlatformNameOFF.cmake b/Tests/RunCMake/XcodeProject-Device/EffectivePlatformNameOFF.cmake index 4a3bf56..4a3bf56 100644 --- a/Tests/RunCMake/XcodeProject/EffectivePlatformNameOFF.cmake +++ b/Tests/RunCMake/XcodeProject-Device/EffectivePlatformNameOFF.cmake diff --git a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake new file mode 100644 index 0000000..e2ed045 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake @@ -0,0 +1,303 @@ +include(RunCMake) + +# Isolate device tests from host architecture selection. +unset(ENV{CMAKE_OSX_ARCHITECTURES}) + +if(NOT XCODE_VERSION VERSION_LESS 5) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeInstallIOS) + run_cmake_command(XcodeInstallIOS-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=Darwin" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build-macOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-macOS ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesIOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build-iOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-iOS ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=watchOS" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build-watchOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-watchOS ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7.1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=tvOS" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build-tvOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-tvOS ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 7) + set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") + run_cmake(XcodeTbdStub) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 6) + # XcodeIOSInstallCombined + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombined) + run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombined-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + + # XcodeIOSInstallCombinedPrune + # FIXME(#24011): Xcode 14 removed support for older architectures the test needs. + if(XCODE_VERSION VERSION_LESS 14) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + endif() + + # XcodeIOSInstallCombinedSingleArch + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombinedSingleArch) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedSingleArch-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(NOT XCODE_VERSION VERSION_LESS 5) + # XcodeMultiplatform + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeMultiplatform-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "${IOS_DEPLOYMENT_TARGET}") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeMultiplatform) + + # build ios before macos + run_cmake_command(XcodeMultiplatform-iphonesimulator-build ${CMAKE_COMMAND} --build . -- -sdk iphonesimulator) + run_cmake_command(XcodeMultiplatform-iphonesimulator-install ${CMAKE_COMMAND} --build . --target install -- -sdk iphonesimulator DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_iphonesimulator) + + run_cmake_command(XcodeMultiplatform-macosx-build ${CMAKE_COMMAND} --build . -- -sdk macosx) + run_cmake_command(XcodeMultiplatform-macosx-install ${CMAKE_COMMAND} --build . --target install -- -sdk macosx DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_macosx) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + + # EffectivePlatformNameOFF + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EffectivePlatformNameOFF-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=iphonesimulator") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(EffectivePlatformNameOFF) + + run_cmake_command(EffectivePlatformNameOFF-iphonesimulator-build ${CMAKE_COMMAND} --build .) + run_cmake_command(EffectivePlatformNameOFF-iphonesimulator-install ${CMAKE_COMMAND} --build . --target install -- DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_iphonesimulator) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 8) + function(deployment_target_test SystemName SDK) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=${SystemName}" "-DCMAKE_OSX_SYSROOT=${SDK}") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(DeploymentTarget) + run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .) + endfunction() + + deployment_target_test(Darwin macosx) + deployment_target_test(iOS iphoneos) + deployment_target_test(iOS iphonesimulator) + deployment_target_test(tvOS appletvos) + deployment_target_test(tvOS appletvsimulator) + deployment_target_test(watchOS watchos) + deployment_target_test(watchOS watchsimulator) +endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 8) + function(xctest_lookup_test SystemName SDK) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XCTestLookup-${SDK}-build) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=${SystemName}" "-DCMAKE_OSX_SYSROOT=${SDK}") + + run_cmake(XCTestLookup) + endfunction() + + xctest_lookup_test(Darwin macosx) + xctest_lookup_test(iOS iphoneos) + xctest_lookup_test(iOS iphonesimulator) + xctest_lookup_test(tvOS appletvos) + xctest_lookup_test(tvOS appletvsimulator) +endif() + +if(XCODE_VERSION VERSION_GREATER_EQUAL 8) + function(XcodeRemoveExcessiveISystemSDK SDK) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeRemoveExcessiveISystemSDK-${SDK}-build) + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=${SDK}") + run_cmake(XcodeRemoveExcessiveISystem) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build .) + endfunction() + + XcodeRemoveExcessiveISystemSDK(iphoneos) + XcodeRemoveExcessiveISystemSDK(iphonesimulator) +endif() + +if (XCODE_VERSION VERSION_GREATER_EQUAL 7.3) + function(xctest_add_bundle_test SystemName SDK BuildSystemVersion ExpectedOutputDir) + set(RunCMake_TEST_BINARY_DIR + ${RunCMake_BINARY_DIR}/DeploymentTarget-${SystemName}-${SDK}-${BuildSystemVersion}-build) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=${SystemName}" + "-DCMAKE_OSX_SYSROOT=${SDK}" + "-DTEST_EXPECTED_OUTPUT_DIR=${ExpectedOutputDir}") + unset(RunCMake_GENERATOR_TOOLSET) + if(BuildSystemVersion) + set(RunCMake_GENERATOR_TOOLSET "buildsystem=${BuildSystemVersion}") + endif() + run_cmake(XCTestAddBundle) + endfunction() + + if(XCODE_VERSION VERSION_GREATER_EQUAL 12) + xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(Darwin macosx "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphonesimulator "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + if (XCODE_VERSION VERSION_LESS 12.5) + xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>") + else() + xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + endif() + else() + xctest_add_bundle_test(Darwin macosx "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + xctest_add_bundle_test(iOS iphonesimulator "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") + endif() +endif() diff --git a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake b/Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake index 9114fee..9114fee 100644 --- a/Tests/RunCMake/XcodeProject/XCTestAddBundle.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XCTestAddBundle.cmake diff --git a/Tests/RunCMake/XcodeProject/XCTestLookup.cmake b/Tests/RunCMake/XcodeProject-Device/XCTestLookup.cmake index 77676e5..77676e5 100644 --- a/Tests/RunCMake/XcodeProject/XCTestLookup.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XCTestLookup.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles-install-check.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeBundles-install-check.cmake index 758d730..758d730 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles-install-check.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeBundles-install-check.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake index a9fafd2..a9fafd2 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombined-cmakeinstall-check.cmake index a1ceb13..a1ceb13 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombined-cmakeinstall-check.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombined-install-check.cmake index 60bc0d8..60bc0d8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombined-install-check.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombined.cmake index f8eccc7..f8eccc7 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombined.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune-install-check.cmake index 37bb4d5..37bb4d5 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune-install-check.cmake diff --git a/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune-install-stdout.txt b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune-install-stdout.txt new file mode 100644 index 0000000..c87008a --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune-install-stdout.txt @@ -0,0 +1,2 @@ +.*Unexpected architecture `i386` detected.* +.*Unexpected architecture `arm64` detected.* diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune.cmake index e719428..e719428 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedPrune.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake index 3f7c379..3f7c379 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch-install-check.cmake index db8f869..db8f869 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch-install-check.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch.cmake index cb22e51..cb22e51 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeIOSInstallCombinedSingleArch.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt b/Tests/RunCMake/XcodeProject-Device/XcodeInstallIOS-install-stdout.txt index f2478be..f2478be 100644 --- a/Tests/RunCMake/XcodeProject/XcodeInstallIOS-install-stdout.txt +++ b/Tests/RunCMake/XcodeProject-Device/XcodeInstallIOS-install-stdout.txt diff --git a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeInstallIOS.cmake index fccd4c6..fccd4c6 100644 --- a/Tests/RunCMake/XcodeProject/XcodeInstallIOS.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeInstallIOS.cmake diff --git a/Tests/RunCMake/XcodeProject/XcodeMultiplatform.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeMultiplatform.cmake index b334b7d..b334b7d 100644 --- a/Tests/RunCMake/XcodeProject/XcodeMultiplatform.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeMultiplatform.cmake diff --git a/Tests/RunCMake/XcodeProject-Device/XcodeRemoveExcessiveISystem.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeRemoveExcessiveISystem.cmake new file mode 100644 index 0000000..b28a58e --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/XcodeRemoveExcessiveISystem.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/../XcodeProject/XcodeRemoveExcessiveISystem.cmake) diff --git a/Tests/RunCMake/XcodeProject/XcodeTbdStub-stdout.txt b/Tests/RunCMake/XcodeProject-Device/XcodeTbdStub-stdout.txt index 9d9e143..9d9e143 100644 --- a/Tests/RunCMake/XcodeProject/XcodeTbdStub-stdout.txt +++ b/Tests/RunCMake/XcodeProject-Device/XcodeTbdStub-stdout.txt diff --git a/Tests/RunCMake/XcodeProject/XcodeTbdStub.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeTbdStub.cmake index 55dd1a7..55dd1a7 100644 --- a/Tests/RunCMake/XcodeProject/XcodeTbdStub.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeTbdStub.cmake diff --git a/Tests/RunCMake/XcodeProject-Device/dummy_main.swift b/Tests/RunCMake/XcodeProject-Device/dummy_main.swift new file mode 100644 index 0000000..1aaee42 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/dummy_main.swift @@ -0,0 +1,18 @@ +#if os(iOS) +import UIKit + +@UIApplicationMain +class MyApp: UIResponder, UIApplicationDelegate { +} + +#elseif os(macOS) +import SwiftUI + +@main +struct MyApp: App { + var body: some Scene { + WindowGroup { + } + } +} +#endif diff --git a/Tests/RunCMake/XcodeProject-Device/foo.cpp b/Tests/RunCMake/XcodeProject-Device/foo.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/foo.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/XcodeProject-Device/main.c b/Tests/RunCMake/XcodeProject-Device/main.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/main.c diff --git a/Tests/RunCMake/XcodeProject-Device/main.cpp b/Tests/RunCMake/XcodeProject-Device/main.cpp new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Device/main.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/XcodeProject/main.m b/Tests/RunCMake/XcodeProject-Device/main.m index 3e70e50..3e70e50 100644 --- a/Tests/RunCMake/XcodeProject/main.m +++ b/Tests/RunCMake/XcodeProject-Device/main.m diff --git a/Tests/RunCMake/XcodeProject/osx.cmake b/Tests/RunCMake/XcodeProject-Device/osx.cmake index e021fcd..e021fcd 100644 --- a/Tests/RunCMake/XcodeProject/osx.cmake +++ b/Tests/RunCMake/XcodeProject-Device/osx.cmake diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 61f7c40..c124950 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -169,309 +169,4 @@ endfunction() BundleLinkBundle() - -# Isolate device tests from host architecture selection. -unset(ENV{CMAKE_OSX_ARCHITECTURES}) - -# Use a single build tree for a few tests without cleaning. - -if(NOT XCODE_VERSION VERSION_LESS 5) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeInstallIOS-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_BINARY_DIR}/ios_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeInstallIOS) - run_cmake_command(XcodeInstallIOS-install ${CMAKE_COMMAND} --build . --target install) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) - - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesOSX-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=Darwin" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build-macOS ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install-macOS ${CMAKE_COMMAND} --build . --target install) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) - - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesIOS-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build-iOS ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install-iOS ${CMAKE_COMMAND} --build . --target install) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) -endif() - -if(NOT XCODE_VERSION VERSION_LESS 7) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesWatchOS-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=watchOS" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build-watchOS ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install-watchOS ${CMAKE_COMMAND} --build . --target install) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) -endif() - -if(NOT XCODE_VERSION VERSION_LESS 7.1) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesTvOS-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=tvOS" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build-tvOS ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install-tvOS ${CMAKE_COMMAND} --build . --target install) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) -endif() - -if(NOT XCODE_VERSION VERSION_LESS 7) - set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") - run_cmake(XcodeTbdStub) - unset(RunCMake_TEST_OPTIONS) -endif() - -if(XCODE_VERSION VERSION_GREATER_EQUAL 6) - # XcodeIOSInstallCombined - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeIOSInstallCombined) - run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install) - endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombined-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) - - # XcodeIOSInstallCombinedPrune - # FIXME(#24011): Xcode 14 removed support for older architectures the test needs. - if(XCODE_VERSION VERSION_LESS 14) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeIOSInstallCombinedPrune) - run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) - endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) - endif() - - # XcodeIOSInstallCombinedSingleArch - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeIOSInstallCombinedSingleArch) - run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install) - endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombinedSingleArch-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) -endif() - -if(NOT XCODE_VERSION VERSION_LESS 5) - # XcodeMultiplatform - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeMultiplatform-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS "${IOS_DEPLOYMENT_TARGET}") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeMultiplatform) - - # build ios before macos - run_cmake_command(XcodeMultiplatform-iphonesimulator-build ${CMAKE_COMMAND} --build . -- -sdk iphonesimulator) - run_cmake_command(XcodeMultiplatform-iphonesimulator-install ${CMAKE_COMMAND} --build . --target install -- -sdk iphonesimulator DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_iphonesimulator) - - run_cmake_command(XcodeMultiplatform-macosx-build ${CMAKE_COMMAND} --build . -- -sdk macosx) - run_cmake_command(XcodeMultiplatform-macosx-install ${CMAKE_COMMAND} --build . --target install -- -sdk macosx DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_macosx) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) - - # EffectivePlatformNameOFF - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EffectivePlatformNameOFF-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=iphonesimulator") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(EffectivePlatformNameOFF) - - run_cmake_command(EffectivePlatformNameOFF-iphonesimulator-build ${CMAKE_COMMAND} --build .) - run_cmake_command(EffectivePlatformNameOFF-iphonesimulator-install ${CMAKE_COMMAND} --build . --target install -- DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_iphonesimulator) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) -endif() - -if(XCODE_VERSION VERSION_GREATER_EQUAL 8) - function(deployment_target_test SystemName SDK) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DeploymentTarget-${SDK}-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=${SystemName}" "-DCMAKE_OSX_SYSROOT=${SDK}") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(DeploymentTarget) - run_cmake_command(DeploymentTarget-${SDK} ${CMAKE_COMMAND} --build .) - endfunction() - - deployment_target_test(Darwin macosx) - deployment_target_test(iOS iphoneos) - deployment_target_test(iOS iphonesimulator) - deployment_target_test(tvOS appletvos) - deployment_target_test(tvOS appletvsimulator) - deployment_target_test(watchOS watchos) - deployment_target_test(watchOS watchsimulator) -endif() - -if(XCODE_VERSION VERSION_GREATER_EQUAL 8) - function(xctest_lookup_test SystemName SDK) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XCTestLookup-${SDK}-build) - set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=${SystemName}" "-DCMAKE_OSX_SYSROOT=${SDK}") - - run_cmake(XCTestLookup) - endfunction() - - xctest_lookup_test(Darwin macosx) - xctest_lookup_test(iOS iphoneos) - xctest_lookup_test(iOS iphonesimulator) - xctest_lookup_test(tvOS appletvos) - xctest_lookup_test(tvOS appletvsimulator) -endif() - -if(XCODE_VERSION VERSION_GREATER_EQUAL 8) - function(XcodeRemoveExcessiveISystemSDK SDK) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeRemoveExcessiveISystemSDK-${SDK}-build) - set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=${SDK}") - run_cmake(XcodeRemoveExcessiveISystem) - set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build .) - endfunction() - - XcodeRemoveExcessiveISystemSDK(iphoneos) - XcodeRemoveExcessiveISystemSDK(iphonesimulator) -endif() - -if (XCODE_VERSION VERSION_GREATER_EQUAL 7.3) - function(xctest_add_bundle_test SystemName SDK BuildSystemVersion ExpectedOutputDir) - set(RunCMake_TEST_BINARY_DIR - ${RunCMake_BINARY_DIR}/DeploymentTarget-${SystemName}-${SDK}-${BuildSystemVersion}-build) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=${SystemName}" - "-DCMAKE_OSX_SYSROOT=${SDK}" - "-DTEST_EXPECTED_OUTPUT_DIR=${ExpectedOutputDir}") - unset(RunCMake_GENERATOR_TOOLSET) - if(BuildSystemVersion) - set(RunCMake_GENERATOR_TOOLSET "buildsystem=${BuildSystemVersion}") - endif() - run_cmake(XCTestAddBundle) - endfunction() - - if(XCODE_VERSION VERSION_GREATER_EQUAL 12) - xctest_add_bundle_test(Darwin macosx "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(Darwin macosx "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(iOS iphonesimulator "1" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - if (XCODE_VERSION VERSION_LESS 12.5) - xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>") - else() - xctest_add_bundle_test(iOS iphonesimulator "12" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - endif() - else() - xctest_add_bundle_test(Darwin macosx "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - xctest_add_bundle_test(iOS iphonesimulator "" "$<TARGET_BUNDLE_CONTENT_DIR:TestedApp>/PlugIns") - endif() -endif() - -# Please add macOS-only tests above before the device-specific tests. +# Please add device-specific tests to '../XcodeProject-Device/RunCMakeTest.cmake'. diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt deleted file mode 100644 index 28edadc..0000000 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ -.*Unexpected architecture `i386` detected.* -.*Unexpected architecture `arm64` detected.*
\ No newline at end of file diff --git a/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake b/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake index 80107cb..6b09b51 100644 --- a/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeRemoveExcessiveISystem.cmake @@ -1,3 +1,4 @@ +# This file is also included from '../XcodeProject-Device/XcodeRemoveExcessiveISystem.cmake'. if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") set(USE_SWIFT 1) @@ -33,12 +34,12 @@ list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH /usr/local /usr / /usr/X11R6 /usr/pkg find_package(ZLIB REQUIRED) add_library (framework_dependency STATIC) -target_sources (framework_dependency PRIVATE use_cmath.cpp) +target_sources (framework_dependency PRIVATE ${CMAKE_CURRENT_LIST_DIR}/use_cmath.cpp) target_link_libraries(framework_dependency INTERFACE ZLIB::ZLIB) -add_library (framework_test SHARED use_cmath.cpp) +add_library (framework_test SHARED ${CMAKE_CURRENT_LIST_DIR}/use_cmath.cpp) if(USE_SWIFT) - target_sources(framework_test PRIVATE foo.swift) + target_sources(framework_test PRIVATE ${CMAKE_CURRENT_LIST_DIR}/foo.swift) endif() target_link_libraries (framework_test PRIVATE framework_dependency) 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) { |