Skip to content

Commit

Permalink
meson does not work. Switching back to basic makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
leonfoks committed Oct 13, 2024
1 parent 3c7156a commit d94ba16
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 39 deletions.
40 changes: 40 additions & 0 deletions python/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SHELL = /bin/sh

.SUFFIXES:
.SUFFIXES: .cpp .o

cxxflags += -fPIC
ldflags += -shared
bindir = gatdaem1d

srcdir = ../src
objdir = ./obj
includes = -I$(srcdir) -I$(FFTW_ROOT)/include -I../submodules/cpp-utils/include
libs = -L$(FFTW_ROOT)/lib -lfftw3
library = $(bindir)/gatdaem1d.so

all: compile link
allclean: clean compile link

objects = \
$(objdir)/gatdaem1d.o \

$(objects): $(objdir)/%.o: $(srcdir)/%.cpp
mkdir -p $(objdir)
@echo ' '
@echo Compiling $<
$(cxx) -c $(includes) $(cxxflags) $< -o $@

compile: $(objects)

link: $(objects)
mkdir -p $(bindir)
@echo ' '
@echo Creating library
$(cxx) $(ldflags) $(objects) $(libs) -o $(library)

clean:
@echo ' '
@echo Cleaning
rm -f $(objects)
rm -f $(library)
10 changes: 7 additions & 3 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
The Python (>=v3.5) interface consists of a C/C++ shared library (.so on Linux or .dll on Windows) called gatdaem1d which contains time-domain forward modelling and derivative functions which are called by the Python interpreter.

## Compiling and installing the C/C++ shared libraries
We are using Meson to automatically build the required C++ library.
Ensure that the GNU C++ compiler is available, and FFTW has been installed.

Mac OSX currently has issues using cmake and brew installed gcc compilers. So we are stuck using a Makefile. Simply type "make" in the python folder. On Linux, the easiest option is to use "make" also.

Two environment variables need to be set before compilation using "export cxx=g++" and "export FFTW_ROOT=<path to FFTW>".

On Windows, follow the documentation in the root folder. Once the library is compiled, go ahead and pip install.

## PIP install of the Python package
- To install as a python package you can then,
```bash
cd [ga-aem-install-dir]/python
pip install .
```
- Note that **`python`** may need to be **`python3`** on your system.
- Note that **`python`** may need to be **`python3`** on your system, and make sure the correct environment is activated/sourced.

## Examples
- The directory [ga-aem-install-dir]/python/examples contains an example of how to use the gatdaem1d package.
Expand Down
29 changes: 0 additions & 29 deletions python/meson.build

This file was deleted.

17 changes: 10 additions & 7 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["meson-python"]
build-backend = "mesonpy"
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "gatdaem1d"
Expand All @@ -10,7 +10,10 @@ readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
authors = [{ name = "Ross C Brodie", email = "[email protected]" }]
keywords = ["electromagnetic", "geophysics"]
dependencies = ["numpy"]
dependencies = [
"numpy",
"matplotlib"
]
classifiers = [
'License :: OSI Approved',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
Expand All @@ -19,8 +22,8 @@ classifiers = [
'Topic :: Electromagnetic :: Airborne :: Forward modelling :: Geophysics'
]

[tool.spin]
package = 'gatdaem1d'

[tool.setuptools.packages.find]
gatdaem1d = ["."]
where = ["."]

[tool.setuptools.package-data]
gatdaem1d = ['gatdaem1d.*']

0 comments on commit d94ba16

Please sign in to comment.