Fixes for compiler detection in setup.py

This commit is contained in:
Guilhem Lavaux 2021-01-24 09:40:58 +01:00
parent f0afb5dc00
commit 793c649a8d
2 changed files with 10 additions and 5 deletions

View File

@ -70,8 +70,8 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A toolbox for impatient cosmologists")
SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux") SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2")
SET(CPACK_PACKAGE_VERSION_MAJOR "1") SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "1") SET(CPACK_PACKAGE_VERSION_MINOR "2")
SET(CPACK_PACKAGE_VERSION_PATCH "2${EXTRA_VERSION}") SET(CPACK_PACKAGE_VERSION_PATCH "0${EXTRA_VERSION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_STRIP_FILES "lib/libCosmoTool.so") SET(CPACK_STRIP_FILES "lib/libCosmoTool.so")
SET(CPACK_SOURCE_IGNORE_FILES SET(CPACK_SOURCE_IGNORE_FILES

View File

@ -167,15 +167,20 @@ class BuildCMakeExt(build_ext):
# Change your cmake arguments below as necessary # Change your cmake arguments below as necessary
# Below is just an example set of arguments for building Blender as a Python module # 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, 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', '-DENABLE_OPENMP=ON','-DINTERNAL_BOOST=ON','-DINTERNAL_EIGEN=ON',
'-DINTERNAL_HDF5=ON','-DINTERNAL_NETCDF=ON', '-DINTERNAL_HDF5=ON','-DINTERNAL_NETCDF=ON',
'-DBUILD_PYTHON=ON', '-DINSTALL_PYTHON_LOCAL=OFF', '-DBUILD_PYTHON=ON', '-DINSTALL_PYTHON_LOCAL=OFF',
'-DCOSMOTOOL_PYTHON_PACKAGING=ON', '-DCOSMOTOOL_PYTHON_PACKAGING=ON',
f"-DCYTHON={cython_code}", f"-DCYTHON={cython_code}",
f"-DPYTHON_SITE_PACKAGES={build_dir.absolute()}/private_install", 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) self.announce("Building binaries", level=3)
@ -218,7 +223,7 @@ class BuildCMakeExt(build_ext):
CosmoTool_extension = CMakeExtension(name="cosmotool") CosmoTool_extension = CMakeExtension(name="cosmotool")
setup(name='cosmotool', setup(name='cosmotool',
version='1.1.2', version='1.2.0',
packages=["cosmotool"], packages=["cosmotool"],
package_dir={'cosmotool': 'python/cosmotool'}, package_dir={'cosmotool': 'python/cosmotool'},
install_requires=['numpy','cffi','numexpr','pyfftw','h5py'], install_requires=['numpy','cffi','numexpr','pyfftw','h5py'],