Skip to content

Commit ea97843

Browse files
committed
c flags???
1 parent 11c9df1 commit ea97843

File tree

10 files changed

+88
-42
lines changed

10 files changed

+88
-42
lines changed

.github/actions/setup_base/action.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ runs:
117117
ccache: ${{ startsWith(inputs.os, 'windows') || startsWith(inputs.os, 'ubuntu') }}
118118
vcvarsall: ${{ startsWith(inputs.os, 'windows') }}
119119

120-
# https://github.com/actions/runner-images/issues/10035
121-
- name: Use the Command Line Tools
122-
shell: bash
123-
if: ${{ startsWith(inputs.os, 'macos') && inputs.arch == 'x86_64' }}
124-
run: |
125-
sudo xcode-select -s /Library/Developer/CommandLineTools
126-
127120
- name: "Set CC/CXX"
128121
shell: bash
129122
run: |
@@ -175,11 +168,12 @@ runs:
175168
ccache -z
176169
177170
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
171+
echo "CMAKE_MAKE_PROGRAM=Ninja" >> $GITHUB_ENV
178172
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
179173
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
180174
echo "Python3_EXECUTABLE=$(which $python3_command)" >> $GITHUB_ENV
181175
182-
if [[ "${{ inputs.arch }}" != "wasm32-wasi" ]]; then
176+
if [[ "${{ inputs.os }}" == "ubuntu" ]] || [[ "${{ inputs.os }}" == "windows" ]]; then
183177
echo "CMAKE_EXE_LINKER_FLAGS_INIT=-fuse-ld=lld" >> $GITHUB_ENV
184178
echo "CMAKE_SHARED_LINKER_FLAGS_INIT=-fuse-ld=lld" >> $GITHUB_ENV
185179
echo "CMAKE_MODULE_LINKER_FLAGS_INIT=-fuse-ld=lld" >> $GITHUB_ENV

.github/workflows/build_llvm.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ jobs:
127127
# double nested so that upload artifacts uploads a folder
128128
export LLVM_INSTALL_DIR="$PWD/llvm-install/llvm-install"
129129
130+
# because macos-13 is broken so we need to cross-compile from macos-14, which is an arm runner
131+
if [[ "${{ matrix.arch }}" == "macos_arm64" ]]; then
132+
export CMAKE_OSX_ARCHITECTURES="x86_64;arm64"
133+
fi
134+
130135
ccache -z
131136
$python3_command -m pip install -r third_party/llvm-project/mlir/python/requirements.txt
132137

.github/workflows/build_test_release_eudsl.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ jobs:
5757
runs-on: "macos-14"
5858
os: "macos"
5959
arch: "aarch64"
60-
- name: "macos_x86_64"
61-
runs-on: "macos-13"
62-
os: "macos"
63-
arch: "x86_64"
6460

6561
runs-on: ${{ matrix.runs-on }}
6662

@@ -120,17 +116,6 @@ jobs:
120116
echo "PIP_FIND_LINKS=$PWD/wheelhouse" >> $GITHUB_ENV
121117
fi
122118
123-
# these have to match the deployment targets of the LLVM build runners
124-
# ld: warning: object file (libLLVMTableGen.a[3](Error.cpp.o)) was built for newer 'macOS' version (13.7) than being linked (10.13)
125-
if [[ "${{ matrix.runs-on }}" == "macos-14" ]]; then
126-
echo MACOSX_DEPLOYMENT_TARGET=14.0 >> $GITHUB_ENV
127-
fi
128-
# https://github.com/wjakob/nanobind/issues/433
129-
# i don't know why i need this here but the llvm build doesn't?
130-
if [[ "${{ matrix.runs-on }}" == "macos-13" ]]; then
131-
echo CMAKE_CXX_FLAGS="-fno-aligned-allocation" >> $GITHUB_ENV
132-
fi
133-
134119
$python3_command -m pip install cibuildwheel
135120
if [[ "${{ matrix.os }}" == "ubuntu" ]] && [[ "${{ matrix.arch }}" == "aarch64" ]]; then
136121
sudo apt-get install libarchive-dev antlr libxml2-dev libxslt-dev libcurl4-openssl-dev
@@ -139,6 +124,12 @@ jobs:
139124
brew install antlr boost
140125
fi
141126
127+
# these have to match the deployment targets of the LLVM build runners
128+
# ld: warning: object file (libLLVMTableGen.a[3](Error.cpp.o)) was built for newer 'macOS' version (13.7) than being linked (10.13)
129+
if [[ "${{ matrix.runs-on }}" == "macos-14" ]]; then
130+
echo MACOSX_DEPLOYMENT_TARGET=14.0 >> $GITHUB_ENV
131+
fi
132+
142133
$python3_command -m pip install -r requirements-dev.txt
143134
144135
- name: "Build eudsl-tblgen"
@@ -242,7 +233,7 @@ jobs:
242233
strategy:
243234
fail-fast: false
244235
matrix:
245-
runs-on: ["ubuntu-22.04", "ubuntu-22.04-arm", "macos-13", "macos-14", "windows-2019"]
236+
runs-on: ["ubuntu-22.04", "ubuntu-22.04-arm", "macos-14", "windows-2019"]
246237
python-version: [
247238
# "3.9", "3.10", "3.11",
248239
"3.12"
@@ -252,7 +243,7 @@ jobs:
252243
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
253244
{runs-on: "windows-2019", name: "windows_x86_64", os: "windows"},
254245
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
255-
{runs-on: "macos-13", name: "macos_x86_64", os: "macos"}
246+
# {runs-on: "macos-13", name: "macos_x86_64", os: "macos"}
256247
]
257248

258249
runs-on: ${{ matrix.runs-on }}
@@ -366,7 +357,6 @@ jobs:
366357
"ubuntu-22.04",
367358
"ubuntu-22.04-arm",
368359
"macos-14",
369-
"macos-13",
370360
"windows-2019"
371361
]
372362
python-version: [
@@ -378,7 +368,7 @@ jobs:
378368
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
379369
{runs-on: "windows-2019", name: "windows_x86_64", os: "windows"},
380370
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
381-
{runs-on: "macos-13", name: "macos_x86_64", os: "macos"}
371+
# {runs-on: "macos-13", name: "macos_x86_64", os: "macos"}
382372
]
383373

384374
runs-on: ${{ matrix.runs-on }}
@@ -439,7 +429,7 @@ jobs:
439429
"ubuntu_x86_64",
440430
"ubuntu_aarch64",
441431
"macos_arm64",
442-
"macos_x86_64",
432+
# "macos_x86_64",
443433
"windows_x86_64"
444434
]
445435

projects/eudsl-llvmpy/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ include_directories("${EUDSLLLVM_BINARY_DIR}/generated")
120120
file(GLOB _gen_src CONFIGURE_DEPENDS "${EUDSLLLVM_BINARY_DIR}/generated/*.cpp")
121121

122122
nanobind_add_module(eudslllvm_ext
123-
NB_STATIC
123+
NB_STATIC STABLE_ABI
124124
NB_DOMAIN eudslllvm
125125
src/eudslllvm_ext.cpp
126126
${_gen_src}
@@ -155,7 +155,13 @@ set_target_properties(eudslllvm_ext
155155
)
156156

157157
target_compile_options(eudslllvm_ext PRIVATE ${nanobind_options})
158-
target_compile_options(nanobind-static PRIVATE ${nanobind_options})
158+
set(_nanobind_tgt)
159+
if(TARGET nanobind-static)
160+
set(_nanobind_tgt nanobind-static)
161+
elseif(TARGET nanobind-static-abi3)
162+
set(_nanobind_tgt nanobind-static-abi3)
163+
endif()
164+
target_compile_options(${_nanobind_tgt} PRIVATE ${nanobind_options})
159165

160166
# note WORKING_DIRECTORY
161167
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen"

projects/eudsl-llvmpy/pyproject.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ Homepage = "https://github.com/llvm/eudsl"
1212

1313
[build-system]
1414
requires = [
15+
"ninja",
1516
"scikit-build-core==0.10.7",
1617
"nanobind==2.4.0",
1718
"typing_extensions==4.12.2",
1819
"litgen @ git+https://github.com/pthom/litgen@f5d154c6f7679e755baa1047563d7c340309bc00",
19-
"eudsl-tblgen"
20+
"eudsl-tblgen",
2021
]
2122
build-backend = "scikit_build_core.build"
2223

@@ -25,6 +26,7 @@ minimum-version = "0.4"
2526
build-dir = "build/{wheel_tag}"
2627
cmake.source-dir = "."
2728
wheel.packages = ["src/llvm"]
29+
wheel.py-api = "cp312"
2830
editable.mode = "inplace"
2931
editable.verbose = true
3032
editable.rebuild = false
@@ -35,6 +37,9 @@ CMAKE_C_FLAGS = { env = "CMAKE_C_FLAGS", default = "" }
3537
CMAKE_CXX_FLAGS = { env = "CMAKE_CXX_FLAGS", default = "" }
3638
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
3739
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
40+
CMAKE_EXE_LINKER_FLAGS_INIT = { env = "CMAKE_EXE_LINKER_FLAGS_INIT", default = "" }
41+
CMAKE_SHARED_LINKER_FLAGS_INIT = { env = "CMAKE_SHARED_LINKER_FLAGS_INIT", default = "" }
42+
CMAKE_MODULE_LINKER_FLAGS_INIT = { env = "CMAKE_MODULE_LINKER_FLAGS_INIT", default = "" }
3843
CMAKE_C_VISIBILITY_PRESET = "hidden"
3944
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
4045
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"
@@ -80,3 +85,9 @@ before-all = [
8085
]
8186
# synchronize TZ with host so ccache files have correct timestamp
8287
container-engine = { name = "docker", create-args = ["-v", "/etc/timezone:/etc/timezone:ro", "-v", "/etc/localtime:/etc/localtime:ro"] }
88+
89+
[tool.cibuildwheel.macos]
90+
before-build = [
91+
"ccache -z"
92+
]
93+
environment = { MACOSX_DEPLOYMENT_TARGET = "14.0" }

projects/eudsl-nbgen/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ CMAKE_C_FLAGS = { env = "CMAKE_C_FLAGS", default = "" }
3131
CMAKE_CXX_FLAGS = { env = "CMAKE_CXX_FLAGS", default = "" }
3232
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
3333
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
34+
CMAKE_EXE_LINKER_FLAGS_INIT = { env = "CMAKE_EXE_LINKER_FLAGS_INIT", default = "" }
35+
CMAKE_SHARED_LINKER_FLAGS_INIT = { env = "CMAKE_SHARED_LINKER_FLAGS_INIT", default = "" }
36+
CMAKE_MODULE_LINKER_FLAGS_INIT = { env = "CMAKE_MODULE_LINKER_FLAGS_INIT", default = "" }
3437
CMAKE_C_VISIBILITY_PRESET = "hidden"
3538
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
3639
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"

projects/eudsl-py/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ eudsl_nbgen(EUDSLGen_tosa
355355
#)
356356

357357
nanobind_add_module(eudslpy_ext
358-
NB_STATIC
358+
NB_STATIC STABLE_ABI
359359
NB_DOMAIN eudsl
360360
src/eudslpy_ext.cpp
361361
)
@@ -427,7 +427,13 @@ set_install_rpath_origin(eudslpy_ext)
427427
install(IMPORTED_RUNTIME_ARTIFACTS MLIR LLVM LIBRARY DESTINATION eudsl)
428428

429429
target_compile_options(eudslpy_ext PRIVATE ${nanobind_options})
430-
target_compile_options(nanobind-static PRIVATE ${nanobind_options})
430+
set(_nanobind_tgt)
431+
if(TARGET nanobind-static)
432+
set(_nanobind_tgt nanobind-static)
433+
elseif(TARGET nanobind-static-abi3)
434+
set(_nanobind_tgt nanobind-static-abi3)
435+
endif()
436+
target_compile_options(${_nanobind_tgt} PRIVATE ${nanobind_options})
431437

432438
# note WORKING_DIRECTORY
433439
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen"

projects/eudsl-py/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ CMAKE_C_FLAGS = { env = "CMAKE_C_FLAGS", default = "" }
3636
CMAKE_CXX_FLAGS = { env = "CMAKE_CXX_FLAGS", default = "" }
3737
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
3838
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
39+
CMAKE_EXE_LINKER_FLAGS_INIT = { env = "CMAKE_EXE_LINKER_FLAGS_INIT", default = "" }
40+
CMAKE_SHARED_LINKER_FLAGS_INIT = { env = "CMAKE_SHARED_LINKER_FLAGS_INIT", default = "" }
41+
CMAKE_MODULE_LINKER_FLAGS_INIT = { env = "CMAKE_MODULE_LINKER_FLAGS_INIT", default = "" }
3942
CMAKE_C_VISIBILITY_PRESET = "hidden"
4043
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
4144
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"
@@ -96,6 +99,7 @@ container-engine = { name = "docker", create-args = ["-v", "/etc/timezone:/etc/t
9699
before-build = [
97100
"ccache -z"
98101
]
102+
environment = { MACOSX_DEPLOYMENT_TARGET = "14.0" }
99103

100104
[tool.cibuildwheel.windows]
101105
before-build = [

projects/eudsl-tblgen/CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,25 @@ nanobind_add_module(eudsl_tblgen_ext NB_STATIC STABLE_ABI
6060
)
6161
target_link_libraries(eudsl_tblgen_ext
6262
PRIVATE LLVMTableGenCommon LLVMTableGen LLVMCore)
63-
target_compile_options(eudsl_tblgen_ext
64-
PUBLIC
63+
set(nanobind_options
6564
-Wno-cast-qual
65+
-Wno-deprecated-literal-operator
66+
-Wno-covered-switch-default
67+
-Wno-nested-anon-types
68+
-Wno-zero-length-array
69+
-Wno-c++98-compat-extra-semi
70+
-Wno-c++20-extensions
6671
$<$<PLATFORM_ID:Linux>:-fexceptions -frtti>
6772
$<$<PLATFORM_ID:Darwin>:-fexceptions -frtti>
6873
$<$<PLATFORM_ID:Windows>:/EHsc /GR>)
74+
target_compile_options(eudsl_tblgen_ext PRIVATE ${nanobind_options})
75+
set(_nanobind_tgt)
76+
if(TARGET nanobind-static)
77+
set(_nanobind_tgt nanobind-static)
78+
elseif(TARGET nanobind-static-abi3)
79+
set(_nanobind_tgt nanobind-static-abi3)
80+
endif()
81+
target_compile_options(${_nanobind_tgt} PRIVATE ${nanobind_options})
6982

7083
# note WORKING_DIRECTORY
7184
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen"

projects/eudsl-tblgen/pyproject.toml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ minimum-version = "0.4"
2020
build-dir = "build/{wheel_tag}"
2121
cmake.source-dir = "."
2222
wheel.packages = ["src/eudsl_tblgen"]
23+
wheel.py-api = "cp312"
2324

2425
[tool.scikit-build.cmake.define]
25-
LLVM_DIR = { env = "LLVM_DIR", default = "EMPTY" }
26-
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
26+
CMAKE_PREFIX_PATH = { env = "CMAKE_PREFIX_PATH", default = "" }
27+
CMAKE_C_FLAGS = { env = "CMAKE_C_FLAGS", default = "" }
28+
CMAKE_CXX_FLAGS = { env = "CMAKE_CXX_FLAGS", default = "" }
2729
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
2830
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
29-
CMAKE_PREFIX_PATH = { env = "CMAKE_PREFIX_PATH", default = "" }
31+
CMAKE_EXE_LINKER_FLAGS_INIT = { env = "CMAKE_EXE_LINKER_FLAGS_INIT", default = "" }
32+
CMAKE_SHARED_LINKER_FLAGS_INIT = { env = "CMAKE_SHARED_LINKER_FLAGS_INIT", default = "" }
33+
CMAKE_MODULE_LINKER_FLAGS_INIT = { env = "CMAKE_MODULE_LINKER_FLAGS_INIT", default = "" }
34+
CMAKE_C_VISIBILITY_PRESET = "hidden"
35+
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
36+
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"
37+
CMAKE_VERBOSE_MAKEFILE = "ON"
38+
LLVM_DIR = { env = "LLVM_DIR", default = "EMPTY" }
3039
LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN = "ON"
3140

3241
[tool.cibuildwheel]
@@ -36,19 +45,23 @@ archs = ["auto64"]
3645
manylinux-x86_64-image = "manylinux_2_28"
3746
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_34_aarch64"
3847
environment-pass = [
39-
"LLVM_DIR",
40-
"CMAKE_GENERATOR",
4148
"CMAKE_PREFIX_PATH",
49+
"CMAKE_C_FLAGS",
50+
"CMAKE_CXX_FLAGS",
51+
"CMAKE_C_COMPILER_LAUNCHER",
52+
"CMAKE_CXX_COMPILER_LAUNCHER",
53+
"CMAKE_GENERATOR",
4254
"CC",
4355
"CXX",
56+
"LLVM_DIR",
4457
# ccache
4558
"CCACHE_DIR",
4659
"CCACHE_MAXSIZE=700M",
4760
"CCACHE_SLOPPINESS",
4861
"CCACHE_CPP2",
4962
"CCACHE_UMASK",
50-
"CMAKE_C_COMPILER_LAUNCHER",
51-
"CMAKE_CXX_COMPILER_LAUNCHER"
63+
"CCACHE_NOHASHDIR",
64+
"PIP_FIND_LINKS",
5265
]
5366
before-build = [
5467
"export CCACHE_DIR=$CCACHE_DIR/$(python -c 'import platform; print(platform.python_version())')",
@@ -74,6 +87,7 @@ container-engine = { name = "docker", create-args = ["-v", "/etc/timezone:/etc/t
7487
before-build = [
7588
"ccache -z"
7689
]
90+
environment = { MACOSX_DEPLOYMENT_TARGET = "14.0" }
7791

7892
[tool.cibuildwheel.windows]
7993
before-build = [

0 commit comments

Comments
 (0)