Skip to content

Commit

Permalink
Updates to interface.py and CMakeLists.txt to enable pyMoist build co…
Browse files Browse the repository at this point in the history
…mpatability across multiple platforms
  • Loading branch information
CharlesKrop committed Jan 7, 2025
1 parent 1d3529e commit 1b45081
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (BUILD_PYMOIST_INTERFACE)
find_package(Python3 COMPONENTS Interpreter REQUIRED)

# Set up some variables in case names change
set(PYMOIST_INTERFACE_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/libpyMoist_interface_py.so)
set(PYMOIST_INTERFACE_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/libpyMoist_interface_py${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PYMOIST_INTERFACE_HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/pymoist_interface_py.h)
set(PYMOIST_INTERFACE_FLAG_HEADER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/pyMoist/pyMoist/interface/cffi_lib/moist.h)
set(PYMOIST_INTERFACE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/pyMoist/pyMoist/interface/cffi_lib/interface.py)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cffi
from mpi4py import MPI
from distutils.sysconfig import get_config_var


TMPFILEBASE = "pyMoist_interface_py"
Expand Down Expand Up @@ -105,7 +106,10 @@ def pymoist_interface_py_finalize() -> int:
data = data.replace("CFFI_DLLEXPORT", "")
ffi.embedding_api(data)

ffi.set_source(TMPFILEBASE, '#include "moist.h"')

ffi.set_source(
TMPFILEBASE,
'#include "moist.h"',
library_dirs=[get_config_var("LIBDIR")],
)
ffi.embedding_init_code(source)
ffi.compile(target="lib" + TMPFILEBASE + ".so", verbose=True)
ffi.compile(target="lib" + TMPFILEBASE + ".*", verbose=3)

0 comments on commit 1b45081

Please sign in to comment.