From a86c9a85c219d50ca114c8b94969889e6b510531 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Wed, 23 Jun 2021 09:02:24 +0200 Subject: [PATCH] Ensure that all the flags are really passed to CMake --- conda/meta.yaml | 5 ++++- setup.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/conda/meta.yaml b/conda/meta.yaml index a91f788..3e69c41 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -3,7 +3,7 @@ package: version: "1.2.3" source: - git_rev: 03033b6 + git_rev: 793134d git_url: https://bitbucket.org/glavaux/cosmotool requirements: @@ -14,6 +14,8 @@ requirements: - numpy # [build_platform != target_platform] - {{ compiler('c') }} - {{ compiler('cxx') }} + - llvm-openmp # [osx] + - libgomp # [linux] host: - python @@ -36,6 +38,7 @@ requirements: - pyfftw - h5py - {{ pin_compatible('gsl') }} + - llvm-openmp test: imports: diff --git a/setup.py b/setup.py index 22e07e8..593d3d8 100644 --- a/setup.py +++ b/setup.py @@ -168,10 +168,16 @@ class BuildCMakeExt(build_ext): # Below is just an example set of arguments for building Blender as a Python module compilers=[] - if "CC" in os.environ: - compilers.append('-DCMAKE_C_COMPILER=' + os.environ["CC"]) - if "CXX" in os.environ: - compilers.append("-DCMAKE_CXX_COMPILER=" + os.environ["CXX"]) + fill_up_settings=[ + ("CMAKE_C_COMPILER", "CC"), + ("CMAKE_CXX_COMPILER", "CXX"), + ("CMAKE_C_FLAGS", "CFLAGS"), + ("CMAKE_EXE_LINKER_FLAGS_INIT", "LDFLAGS"), + ("CMAKE_SHARED_LINKER_FLAGS_INIT", "LDFLAGS"), + ("CMAKE_MODULE_LINKER_FLAGS_INIT", "LDFLAGS")] + for cmake_flag, os_flag: + if os_flag in os.environ: + compilers.append(f"-D{cmake_flag}={os.environ[os_flag]}") self.spawn(['cmake', '-H'+SOURCE_DIR, '-B'+self.build_temp, '-DENABLE_OPENMP=ON','-DINTERNAL_BOOST=ON','-DINTERNAL_EIGEN=ON',