fix building python bindings (with lto)
need to set the define for header only library with internal libfmt, and whatever flags are required by external libfmt
This commit is contained in:
parent
5d13b9ed59
commit
9402db2421
@ -365,6 +365,18 @@ if (OPM_ENABLE_PYTHON)
|
||||
string(REGEX REPLACE ";" "', '" _tmp "${pybind11_INCLUDE_DIRS}")
|
||||
set(SETUP_PY_PYBIND_INCLUDE_DIR "'${_tmp}'")
|
||||
endif()
|
||||
|
||||
if (TARGET fmt::fmt)
|
||||
get_target_property(SETUP_PY_FMT_LIBS fmt::fmt LOCATION)
|
||||
get_target_property(FMT_FLAGS fmt::fmt INTERFACE_COMPILE_DEFINITIONS)
|
||||
foreach(flag ${FMT_FLAGS})
|
||||
set(SETUP_PY_FMT_FLAGS "${SETUP_PY_FMT_FLAGS} '-D${flag}',")
|
||||
endforeach()
|
||||
list(APPEND opm-common_PYTHON_LINKAGE "'${SETUP_PY_FMT_LIBS}'")
|
||||
else()
|
||||
set(SETUP_PY_FMT_FLAGS "'-DFMT_HEADER_ONLY'")
|
||||
endif()
|
||||
|
||||
configure_file (${PROJECT_SOURCE_DIR}/python/setup.py.in ${PROJECT_BINARY_DIR}/python/setup.py)
|
||||
file(COPY ${PROJECT_SOURCE_DIR}/python/README.md DESTINATION ${PROJECT_BINARY_DIR}/python)
|
||||
execute_process(COMMAND ${Python3_EXECUTABLE} target_name.py
|
||||
|
@ -67,7 +67,7 @@ ext_modules = [
|
||||
language='c++',
|
||||
undef_macros=["NDEBUG"],
|
||||
include_dirs=[@SETUP_PY_PYBIND_INCLUDE_DIR@],
|
||||
extra_compile_args=['-std=c++17', '-fopenmp'],
|
||||
extra_compile_args=['-std=c++17', '-fopenmp', @SETUP_PY_FMT_FLAGS@],
|
||||
extra_link_args=['-fopenmp', @opm-common_PYTHON_LINKAGE@]
|
||||
)
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user