diff --git a/pyproject.toml b/pyproject.toml index 43c8853d7ec2934a6943834435bb5633c1a9bd44..2a529719809c352a39cf8e78ca5cd37c743f7e73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ environment-pass = [ "CPM_SOURCE_CACHE", "CCACHE_DIR", "CCACHE_MAXSIZE", + "CMAKE_ARGS", ] [tool.cibuildwheel.macos] diff --git a/setup.py b/setup.py index b5f045ebb08fab971839c4c1d77611c4986e7ea9..1b4cc31831b0e32690a04100f06625d2e80b6fbb 100644 --- a/setup.py +++ b/setup.py @@ -12,10 +12,6 @@ console_scripts = [] for b in binaries_list: console_scripts.append(f"{b}=ogs._internal.provide_ogs_cli_tools_via_wheel:{b}") -cmake_preset = "wheel" -if platform.system() == "Windows": - cmake_preset += "-win" - from pathlib import Path this_directory = Path(__file__).parent @@ -33,7 +29,13 @@ if "SETUPTOOLS_SCM_LOCAL_SCHEME" in os.environ: if os.environ["SETUPTOOLS_SCM_LOCAL_SCHEME"] in local_scheme_values: scm_local_scheme = os.environ["SETUPTOOLS_SCM_LOCAL_SCHEME"] -cmake_args = [f"--preset {cmake_preset}", "-B ."] +if not "CMAKE_ARGS" in os.environ: + cmake_preset = "wheel" + if platform.system() == "Windows": + cmake_preset += "-win" + os.environ["CMAKE_ARGS"] = f"--preset {cmake_preset}" + +cmake_args = ["-B ."] if "SKBUILD_GENERATOR" in os.environ: cmake_args.extend(["-G", os.environ["SKBUILD_GENERATOR"]]) diff --git a/web/content/docs/devguide/advanced/python-wheel/index.md b/web/content/docs/devguide/advanced/python-wheel/index.md index bc0e2474a4703f79722eafdbc0018b973a5188a0..2c5af1b3377b4b6330476dbf9d84aeb074000739 100644 --- a/web/content/docs/devguide/advanced/python-wheel/index.md +++ b/web/content/docs/devguide/advanced/python-wheel/index.md @@ -13,7 +13,7 @@ weight = 1068 Python wheel builds are driven by [scikit-build](https://scikit-build.readthedocs.io/en/latest/) which basically is a `setuptools`-wrapper for CMake-based projects. -The entry point is `setup.py` in the root directory. It uses the `wheel` CMake preset (or `wheel-win` on Windows). +The entry point is `setup.py` in the root directory. It uses the `wheel` CMake preset. The preset can be overridden and even other CMake options can be passed via the environment variable `CMAKE_ARGS`. You can locally develop and test with the following setup: