Skip to content

Commit

Permalink
Add manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
haohanyang committed Nov 6, 2024
1 parent a1cb5f9 commit 0e7496b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include README.md pybind11/LICENSE
graft pybind11/include
graft pybind11/tools
graft src
global-include CMakeLists.txt *.cmake
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PHREEQC
19 changes: 7 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
# Using this requires trailing slash for auto-detection & inclusion of
# auxiliary "native" libs

debug = int(os.environ.get("DEBUG", 0)
) if self.debug is None else self.debug
debug = int(os.environ.get("DEBUG", 0)) if self.debug is None else self.debug
cfg = "Debug" if debug else "Release"

# CMake lets you override the generator - we need to check this.
Expand All @@ -50,14 +49,13 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm,
"-DBUILD_TESTING=OFF",
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_SHARED_LIBS=ON",
]
build_args = []
# Adding CMake arguments set as environment variable
# (needed e.g. to build for ARM OSx on conda-forge)
if "CMAKE_ARGS" in os.environ:
cmake_args += [
item for item in os.environ["CMAKE_ARGS"].split(" ") if item]
cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item]

# In this example, we pass in the version to C++. You might not need to.
cmake_args += [f"-DEXAMPLE_VERSION_INFO={self.distribution.get_version()}"]
Expand All @@ -75,16 +73,14 @@ def build_extension(self, ext: CMakeExtension) -> None:
ninja_executable_path = Path(ninja.BIN_DIR) / "ninja"
cmake_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM:FILEPATH={
ninja_executable_path}",
f"-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_executable_path}",
]
except ImportError:
pass

else:
# Single config generators are handled "normally"
single_config = any(
x in cmake_generator for x in {"NMake", "Ninja"})
single_config = any(x in cmake_generator for x in {"NMake", "Ninja"})

# CMake allows an arch-in-generator style for backward compatibility
contains_arch = any(x in cmake_generator for x in {"ARM", "Win64"})
Expand All @@ -106,8 +102,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
# Cross-compile support for macOS - respect ARCHFLAGS if set
archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", ""))
if archs:
cmake_args += [
"-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]

# Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level
# across all generators.
Expand All @@ -134,7 +129,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
# logic and declaration, and simpler if you include description/version in a file.
setup(
name="phreeqc",
version="0.0.1",
version="0.0.3",
author="Haohan Yang",
description="Python bindings for PHREEQC Version 3",
long_description="Python bindings for PHREEQC Version 3",
Expand Down

0 comments on commit 0e7496b

Please sign in to comment.