Skip to content

Commit

Permalink
c flags???
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Jan 31, 2025
1 parent 11c9df1 commit e909504
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/build_test_release_eudsl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,9 @@ jobs:
# these have to match the deployment targets of the LLVM build runners
# ld: warning: object file (libLLVMTableGen.a[3](Error.cpp.o)) was built for newer 'macOS' version (13.7) than being linked (10.13)
if [[ "${{ matrix.runs-on }}" == "macos-14" ]]; then
echo MACOSX_DEPLOYMENT_TARGET=14.0 >> $GITHUB_ENV
fi
# https://github.com/wjakob/nanobind/issues/433
# i don't know why i need this here but the llvm build doesn't?
if [[ "${{ matrix.runs-on }}" == "macos-13" ]]; then
echo CMAKE_CXX_FLAGS="-fno-aligned-allocation" >> $GITHUB_ENV
# alse aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.14 or newer
if [[ "${{ matrix.runs-on }}" == "macos" ]]; then
echo MACOSX_DEPLOYMENT_TARGET=14 >> $GITHUB_ENV
fi
$python3_command -m pip install cibuildwheel
Expand Down
13 changes: 10 additions & 3 deletions projects/eudsl-tblgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,26 @@ find_package(nanobind CONFIG REQUIRED)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${EUDSL_TBLGEN_SRC_DIR}/eudsl_tblgen)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

nanobind_add_module(eudsl_tblgen_ext NB_STATIC STABLE_ABI
nanobind_add_module(eudsl_tblgen_ext NB_STATIC
src/eudsl_tblgen_ext.cpp
src/TGParser.cpp
src/TGLexer.cpp
)
target_link_libraries(eudsl_tblgen_ext
PRIVATE LLVMTableGenCommon LLVMTableGen LLVMCore)
target_compile_options(eudsl_tblgen_ext
PUBLIC
set(nanobind_options
-Wno-cast-qual
-Wno-deprecated-literal-operator
-Wno-covered-switch-default
-Wno-nested-anon-types
-Wno-zero-length-array
-Wno-c++98-compat-extra-semi
-Wno-c++20-extensions
$<$<PLATFORM_ID:Linux>:-fexceptions -frtti>
$<$<PLATFORM_ID:Darwin>:-fexceptions -frtti>
$<$<PLATFORM_ID:Windows>:/EHsc /GR>)
target_compile_options(eudsl_tblgen_ext PRIVATE ${nanobind_options})
target_compile_options(nanobind-static PRIVATE ${nanobind_options})

# note WORKING_DIRECTORY
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen"
Expand Down
23 changes: 16 additions & 7 deletions projects/eudsl-tblgen/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ cmake.source-dir = "."
wheel.packages = ["src/eudsl_tblgen"]

[tool.scikit-build.cmake.define]
LLVM_DIR = { env = "LLVM_DIR", default = "EMPTY" }
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
CMAKE_PREFIX_PATH = { env = "CMAKE_PREFIX_PATH", default = "" }
CMAKE_C_FLAGS = { env = "CMAKE_C_FLAGS", default = "" }
CMAKE_CXX_FLAGS = { env = "CMAKE_CXX_FLAGS", default = "" }
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
CMAKE_PREFIX_PATH = { env = "CMAKE_PREFIX_PATH", default = "" }
CMAKE_C_VISIBILITY_PRESET = "hidden"
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"
CMAKE_VERBOSE_MAKEFILE = "ON"
LLVM_DIR = { env = "LLVM_DIR", default = "EMPTY" }
LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN = "ON"

[tool.cibuildwheel]
Expand All @@ -36,19 +41,23 @@ archs = ["auto64"]
manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_34_aarch64"
environment-pass = [
"LLVM_DIR",
"CMAKE_GENERATOR",
"CMAKE_PREFIX_PATH",
"CMAKE_C_FLAGS",
"CMAKE_CXX_FLAGS",
"CMAKE_C_COMPILER_LAUNCHER",
"CMAKE_CXX_COMPILER_LAUNCHER",
"CMAKE_GENERATOR",
"CC",
"CXX",
"LLVM_DIR",
# ccache
"CCACHE_DIR",
"CCACHE_MAXSIZE=700M",
"CCACHE_SLOPPINESS",
"CCACHE_CPP2",
"CCACHE_UMASK",
"CMAKE_C_COMPILER_LAUNCHER",
"CMAKE_CXX_COMPILER_LAUNCHER"
"CCACHE_NOHASHDIR",
"PIP_FIND_LINKS",
]
before-build = [
"export CCACHE_DIR=$CCACHE_DIR/$(python -c 'import platform; print(platform.python_version())')",
Expand Down

0 comments on commit e909504

Please sign in to comment.