From 793c649a8dfe3735f9ff0e1452c6607d7ac0ddc6 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sun, 24 Jan 2021 09:40:58 +0100 Subject: [PATCH] Fixes for compiler detection in setup.py --- CMakeLists.txt | 4 ++-- setup.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c64358..e7bc520 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,8 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A toolbox for impatient cosmologists") SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2") SET(CPACK_PACKAGE_VERSION_MAJOR "1") -SET(CPACK_PACKAGE_VERSION_MINOR "1") -SET(CPACK_PACKAGE_VERSION_PATCH "2${EXTRA_VERSION}") +SET(CPACK_PACKAGE_VERSION_MINOR "2") +SET(CPACK_PACKAGE_VERSION_PATCH "0${EXTRA_VERSION}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") SET(CPACK_STRIP_FILES "lib/libCosmoTool.so") SET(CPACK_SOURCE_IGNORE_FILES diff --git a/setup.py b/setup.py index 6975776..95542a8 100644 --- a/setup.py +++ b/setup.py @@ -167,15 +167,20 @@ class BuildCMakeExt(build_ext): # Change your cmake arguments below as necessary # 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"]) + self.spawn(['cmake', '-H'+SOURCE_DIR, '-B'+self.build_temp, - '-DCMAKE_C_COMPILER=' + os.environ["CC"], "-DCMAKE_CXX_COMPILER=" + os.environ["CXX"], '-DENABLE_OPENMP=ON','-DINTERNAL_BOOST=ON','-DINTERNAL_EIGEN=ON', '-DINTERNAL_HDF5=ON','-DINTERNAL_NETCDF=ON', '-DBUILD_PYTHON=ON', '-DINSTALL_PYTHON_LOCAL=OFF', '-DCOSMOTOOL_PYTHON_PACKAGING=ON', f"-DCYTHON={cython_code}", f"-DPYTHON_SITE_PACKAGES={build_dir.absolute()}/private_install", - f"-DPYTHON_EXECUTABLE={sys.executable}"]) + f"-DPYTHON_EXECUTABLE={sys.executable}"] + compilers) self.announce("Building binaries", level=3) @@ -218,7 +223,7 @@ class BuildCMakeExt(build_ext): CosmoTool_extension = CMakeExtension(name="cosmotool") setup(name='cosmotool', - version='1.1.2', + version='1.2.0', packages=["cosmotool"], package_dir={'cosmotool': 'python/cosmotool'}, install_requires=['numpy','cffi','numexpr','pyfftw','h5py'],