Fix for default MacOS build with python

This commit is contained in:
guilhem.lavaux@iap.fr 2024-01-16 07:21:56 +01:00
parent 6adf02b287
commit 26e095fc71
3 changed files with 19 additions and 14 deletions

View File

@ -39,7 +39,7 @@ CHECK_CHANGE_STATE(INTERNAL_DLIB DLIB_INCLUDE_DIR DLIB_LIBRARIES)
IF(ENABLE_OPENMP)
IF (NOT OPENMP_FOUND)
MESSAGE(ERROR "No known compiler option for enabling OpenMP")
MESSAGE(NOTICE "No known compiler option for enabling OpenMP")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

View File

@ -69,13 +69,10 @@ target_link_libraries(_fast_interp PRIVATE ${CosmoTool_local} )
SET(ct_TARGETS _cosmotool _project _cosmo_power _cosmo_cic _fast_interp _cosmomath)
if (Boost_FOUND)
message(STATUS "Building bispectrum support (path = ${Boost_INCLUDE_DIRS})")
message(STATUS "Building bispectrum support")
include_directories(${Boost_INCLUDE_DIRS})
add_library(_cosmo_bispectrum MODULE _cosmo_bispectrum.cpp)
target_link_libraries(_cosmo_bispectrum ${MATH_LIBRARY})
if(ENABLE_OPENMP)
set_target_properties(_cosmo_bispectrum PROPERTIES COMPILE_FLAGS "${OpenMP_CXX_FLAGS}" LINK_FLAGS "${OpenMP_CXX_FLAGS}")
endif()
if (Boost_DEP)
add_dependencies(_cosmo_bispectrum ${Boost_DEP})
endif()

View File

@ -2,6 +2,7 @@ import stat
import os
import sys
import shutil
from sysconfig import get_config_var
from distutils.command.install_data import install_data
import pathlib
from setuptools import find_packages, setup, Extension
@ -167,17 +168,24 @@ 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
c_compiler=os.environ.get('CC', get_config_var("CC"))
cxx_compiler=os.environ.get('CXX', get_config_var("CXX"))
compilers=[]
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 in fill_up_settings:
if os_flag in os.environ:
compilers.append(f"-D{cmake_flag}={os.environ[os_flag]}")
("CMAKE_C_COMPILER", "CC", get_config_var("CC")),
("CMAKE_CXX_COMPILER", "CXX", get_config_var("CXX")),
("CMAKE_C_FLAGS", "CFLAGS", None),
("CMAKE_CXX_FLAGS", "CXXFLAGS", None),
("CMAKE_EXE_LINKER_FLAGS_INIT", "LDFLAGS", None),
("CMAKE_SHARED_LINKER_FLAGS_INIT", "LDFLAGS", None),
("CMAKE_MODULE_LINKER_FLAGS_INIT", "LDFLAGS", None)]
for cmake_flag, os_flag, default_flag in fill_up_settings:
if os_flag in os.environ or default_flag is not None:
c = os.environ.get(os_flag, default_flag)
if not c is None:
compilers.append(f"-D{cmake_flag}={c}")
print(compilers)
self.spawn(['cmake', '-H'+SOURCE_DIR, '-B'+self.build_temp,
'-DENABLE_OPENMP=ON','-DINTERNAL_BOOST=ON','-DINTERNAL_EIGEN=ON',