Skip to content
Snippets Groups Projects
Verified Commit 7512578a authored by Lars Bilke's avatar Lars Bilke
Browse files

[wheel] Win builds.

parent ac90b262
No related branches found
No related tags found
No related merge requests found
import os
import platform
import subprocess
import sys
try:
from .lib64._cli import *
except ImportError:
try:
from .lib._cli import *
except ImportError:
print("ERROR: could not import OpenGeoSys Python module!")
OGS_BIN_DIR = os.path.join(os.path.join(os.path.dirname(__file__), "bin"))
binaries_list = [
"addDataToRaster",
"AddElementQuality",
......@@ -75,11 +66,26 @@ binaries_list = [
"Vtu2Grid",
]
if "PEP517_BUILD_BACKEND" not in os.environ:
if platform.system() == "Windows":
os.add_dll_directory(os.path.join(os.path.dirname(__file__), "bin"))
from .lib._cli import *
else:
try:
from .lib64._cli import *
except ImportError:
try:
from .lib._cli import *
except ImportError:
print("ERROR: could not import OpenGeoSys Python module!")
OGS_BIN_DIR = os.path.join(os.path.join(os.path.dirname(__file__), "bin"))
def _program(name, args):
return subprocess.call([os.path.join(OGS_BIN_DIR, name)] + args)
def _program(name, args):
return subprocess.call([os.path.join(OGS_BIN_DIR, name)] + args)
FUNC_TEMPLATE = """def {0}(): raise SystemExit(_program("{0}", sys.argv[1:]))"""
for f in binaries_list:
exec(FUNC_TEMPLATE.format(f))
FUNC_TEMPLATE = """def {0}(): raise SystemExit(_program("{0}", sys.argv[1:]))"""
for f in binaries_list:
exec(FUNC_TEMPLATE.format(f))
......@@ -202,6 +202,23 @@
"OGS_USE_PIP": "OFF",
"OGS_USE_MFRONT": "ON",
"BUILD_SHARED_LIBS": "ON"
},
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "wheel-win",
"inherits": "wheel",
"cacheVariables": {
"OGS_USE_MFRONT": "OFF"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
}
],
......@@ -290,6 +307,10 @@
{
"name": "wheel",
"configurePreset": "wheel"
},
{
"name": "wheel-win",
"configurePreset": "wheel-win"
}
],
"testPresets": [
......
[build-system]
requires = [
"setuptools>=42",
"scikit-build>=0.15.0",
"scikit-build @ git+https://github.com/bilke/scikit-build/@disable-cmake-install-check#egg=scikit-build ; platform_system == 'Windows'",
"scikit-build>=0.15.0 ; platform_system != 'Windows'",
"cmake>=3.22",
"ninja; platform_system!='Windows'",
"ninja ; platform_system != 'Windows'",
]
build-backend = "setuptools.build_meta"
......@@ -17,6 +18,7 @@ build = "cp3*"
skip = "*musllinux*"
test-extras = "test"
test-command = "pytest {project}/Tests/Python"
# test-command = ""
build-verbosity = "1"
[tool.cibuildwheel.linux]
......@@ -26,3 +28,6 @@ environment-pass = ["OGS_VERSION"]
[tool.cibuildwheel.macos]
skip = ["cp36-*", "cp37-*", "cp38-*x86_64"]
[tool.cibuildwheel.windows]
skip = ["cp36-*", "cp37-*"]
......@@ -13,7 +13,7 @@ def get_version():
git_version = os.environ["OGS_VERSION"]
else:
git_version = subprocess.run(
["git describe --tags"],
["git", "describe", "--tags"],
capture_output=True,
text=True,
shell=True,
......@@ -32,13 +32,18 @@ def get_version():
return git_version
sys.path.append("Applications/Python")
sys.path.append(os.path.join("Applications", "Python"))
from OpenGeoSys import binaries_list
console_scripts = []
for b in binaries_list:
console_scripts.append(f"{b}=OpenGeoSys:{b}")
import platform
cmake_preset = "wheel"
if platform.system() == "Windows":
cmake_preset += "-win"
setup(
name="OpenGeoSys",
version=get_version(),
......@@ -49,7 +54,7 @@ setup(
package_dir={"": "Applications/Python"},
cmake_install_dir="Applications/Python/OpenGeoSys",
extras_require={"test": ["pytest"]},
cmake_args=["--preset wheel", "-B ."],
cmake_args=[f"--preset {cmake_preset}", "-B ."],
python_requires=">=3.6",
entry_points={"console_scripts": console_scripts},
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment