Skip to content

Commit

Permalink
Merge pull request #324 from isuruf/mingw
Browse files Browse the repository at this point in the history
support mingw on windows
  • Loading branch information
isuruf authored Oct 18, 2024
2 parents d0cd616 + 9ff4cf1 commit 557de63
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
5 changes: 4 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set version = "19.1.2" %}
{% set major_version = version.split(".")[0] %}
{% set build_number = 0 %}
{% set build_number = 1 %}

# always includes minor as of v18, see https://github.com/llvm/llvm-project/issues/76273
{% set maj_min = major_version ~ "." ~ version.split(".")[1] %}
Expand Down Expand Up @@ -36,6 +36,7 @@ source:
- patches/0007-set-libclang-SOVERSION-unconditionally.patch
- patches/0008-Make-PIE-default-on-macOS-too.patch
- patches/0009-Find-ROCm-device-library-in-conda-layout.patch
- patches/0010-Add-conda-mingw-paths.patch
# name folder for easier deletion; we do the equivalent of downloading
# the subproject sources, so the work folder then has clang in it;
# for details see build scripts
Expand Down Expand Up @@ -473,6 +474,7 @@ outputs:
test:
requires:
- {{ compiler("cxx") }}
- gxx_impl_{{ target_platform }} # [win64]
files:
- mytest.cxx
commands:
Expand All @@ -481,6 +483,7 @@ outputs:
- unset CONDA_BUILD_SYSROOT # [unix]
- set "CONDA_BUILD_SYSROOT=" # [win]
- clang++ -v -c mytest.cxx
- clang++ -v mytest.cxx --target=x86_64-w64-mingw32 # [win64]

- name: clang-format-{{ major_version }}
script: install_clang_format.sh # [unix]
Expand Down
38 changes: 38 additions & 0 deletions recipe/patches/0010-Add-conda-mingw-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From b9574b59ea44cfb30ff50633b3b346faba39b39b Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Fri, 18 Oct 2024 10:28:09 -0400
Subject: [PATCH 10/10] Add conda mingw paths

---
clang/lib/Driver/ToolChains/MinGW.cpp | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index c81a7ed17029..4f47e01fda58 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -532,6 +532,10 @@ toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple,
getFilePaths().push_back(
(Base + SubdirName + llvm::sys::path::get_separator() + "mingw/lib").str());

+ // Conda
+ getFilePaths().push_back(
+ (Base + SubdirName + llvm::sys::path::get_separator() + "sysroot/usr/lib").str());
+
// Only include <base>/lib if we're not cross compiling (not even for
// windows->windows to a different arch), or if the sysroot has been set
// (where we presume the user has pointed it at an arch specific
@@ -698,6 +702,10 @@ void toolchains::MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
addSystemInclude(DriverArgs, CC1Args,
Base + SubdirName + llvm::sys::path::get_separator() + "usr/include");

+ // Conda
+ addSystemInclude(DriverArgs, CC1Args,
+ Base + SubdirName + llvm::sys::path::get_separator() + "sysroot/usr/include");
+
// Only include <base>/include if we're not cross compiling (but do allow it
// if we're on Windows and building for Windows on another architecture),
// or if the sysroot has been set (where we presume the user has pointed it
--
2.44.0

0 comments on commit 557de63

Please sign in to comment.