From 2a4e8f03ef602969e9691b4f2c35fc7602ccc856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= Date: Mon, 12 Feb 2024 18:12:25 +0100 Subject: MinGW: Add support for OBJC and OBJCXX --- Help/release/3.29.rst | 5 +++++ Modules/Platform/Windows-Clang-OBJC.cmake | 18 ++++++++++++++++++ Modules/Platform/Windows-Clang-OBJCXX.cmake | 18 ++++++++++++++++++ Modules/Platform/Windows-GNU-OBJC-ABI.cmake | 1 + Modules/Platform/Windows-GNU-OBJC.cmake | 2 ++ Modules/Platform/Windows-GNU-OBJCXX-ABI.cmake | 1 + Modules/Platform/Windows-GNU-OBJCXX.cmake | 2 ++ 7 files changed, 47 insertions(+) create mode 100644 Modules/Platform/Windows-Clang-OBJC.cmake create mode 100644 Modules/Platform/Windows-Clang-OBJCXX.cmake create mode 100644 Modules/Platform/Windows-GNU-OBJC-ABI.cmake create mode 100644 Modules/Platform/Windows-GNU-OBJC.cmake create mode 100644 Modules/Platform/Windows-GNU-OBJCXX-ABI.cmake create mode 100644 Modules/Platform/Windows-GNU-OBJCXX.cmake diff --git a/Help/release/3.29.rst b/Help/release/3.29.rst index 96f161f..659237e 100644 --- a/Help/release/3.29.rst +++ b/Help/release/3.29.rst @@ -39,6 +39,11 @@ Compilers * The LLVM/Clang GNU-like frontend on Windows (``clang++``) may now be used to compile ``CUDA`` language sources. +* Compilers targeting the GNU ABI on Windows (MinGW) may now be used to + compile Objective C (``OBJC``) and Objective C++ (``OBJCXX``). These + include GNU compilers (``gcc`` and ``g++``) and the LLVM/Clang GNU-like + frontends (``clang`` and ``clang++``). + * TI Clang-based compilers are now supported with :variable:`compiler id _COMPILER_ID>` ``TIClang``. diff --git a/Modules/Platform/Windows-Clang-OBJC.cmake b/Modules/Platform/Windows-Clang-OBJC.cmake new file mode 100644 index 0000000..7babb98 --- /dev/null +++ b/Modules/Platform/Windows-Clang-OBJC.cmake @@ -0,0 +1,18 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(OBJC) + +if("x${CMAKE_OBJC_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJC) + set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE) + endif() +elseif("x${CMAKE_OBJC_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJC) + # dependencies are computed by the compiler itself + set(CMAKE_OBJC_DEPFILE_FORMAT gcc) + set(CMAKE_OBJC_DEPENDS_USE_COMPILER TRUE) + endif() +endif() diff --git a/Modules/Platform/Windows-Clang-OBJCXX.cmake b/Modules/Platform/Windows-Clang-OBJCXX.cmake new file mode 100644 index 0000000..3bc1673 --- /dev/null +++ b/Modules/Platform/Windows-Clang-OBJCXX.cmake @@ -0,0 +1,18 @@ +include(Platform/Windows-Clang) +__windows_compiler_clang(OBJCXX) + +if("x${CMAKE_OBJCXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJCXX) + set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE) + endif() +elseif("x${CMAKE_OBJCXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake" + AND CMAKE_DEPFILE_FLAGS_OBJCXX) + # dependencies are computed by the compiler itself + set(CMAKE_OBJCXX_DEPFILE_FORMAT gcc) + set(CMAKE_OBJCXX_DEPENDS_USE_COMPILER TRUE) + endif() +endif() diff --git a/Modules/Platform/Windows-GNU-OBJC-ABI.cmake b/Modules/Platform/Windows-GNU-OBJC-ABI.cmake new file mode 100644 index 0000000..c8b2ea6 --- /dev/null +++ b/Modules/Platform/Windows-GNU-OBJC-ABI.cmake @@ -0,0 +1 @@ +__windows_compiler_gnu_abi(OBJC) diff --git a/Modules/Platform/Windows-GNU-OBJC.cmake b/Modules/Platform/Windows-GNU-OBJC.cmake new file mode 100644 index 0000000..42cf3f8 --- /dev/null +++ b/Modules/Platform/Windows-GNU-OBJC.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(OBJC) diff --git a/Modules/Platform/Windows-GNU-OBJCXX-ABI.cmake b/Modules/Platform/Windows-GNU-OBJCXX-ABI.cmake new file mode 100644 index 0000000..9a11514 --- /dev/null +++ b/Modules/Platform/Windows-GNU-OBJCXX-ABI.cmake @@ -0,0 +1 @@ +__windows_compiler_gnu_abi(OBJCXX) diff --git a/Modules/Platform/Windows-GNU-OBJCXX.cmake b/Modules/Platform/Windows-GNU-OBJCXX.cmake new file mode 100644 index 0000000..072cf28 --- /dev/null +++ b/Modules/Platform/Windows-GNU-OBJCXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(OBJCXX) -- cgit v0.12