mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
more cleanup
This commit is contained in:
+21
-34
@@ -72,7 +72,7 @@ PROJECT_NAME="IfcOpenShell"
|
|||||||
if os.getenv("USE_CURRENT_PYTHON_VERSION"):
|
if os.getenv("USE_CURRENT_PYTHON_VERSION"):
|
||||||
PYTHON_VERSIONS = [platform.python_version()]
|
PYTHON_VERSIONS = [platform.python_version()]
|
||||||
else:
|
else:
|
||||||
PYTHON_VERSIONS=["3.6.13", "3.7.10", "3.8.8", "3.9.2"]
|
PYTHON_VERSIONS = ["3.6.14", "3.7.12", "3.8.12", "3.9.7", "3.10.0"]
|
||||||
JSON_VERSION = "v3.6.1"
|
JSON_VERSION = "v3.6.1"
|
||||||
OCE_VERSION = "0.18"
|
OCE_VERSION = "0.18"
|
||||||
OCCT_VERSION = "7.5.3"
|
OCCT_VERSION = "7.5.3"
|
||||||
@@ -145,14 +145,13 @@ TARGET_ARCH = os.getenv("TARGET_ARCH", sp.check_output([uname, "-m"], encoding="
|
|||||||
|
|
||||||
CMAKE_DIR = os.path.realpath(os.path.join("..", "cmake"))
|
CMAKE_DIR = os.path.realpath(os.path.join("..", "cmake"))
|
||||||
|
|
||||||
try:
|
|
||||||
DEPS_DIR = os.environ["DEPS_DIR"]
|
|
||||||
except KeyError:
|
|
||||||
path = ["..", "build", sp.check_output(uname, encoding="utf-8").strip(), TARGET_ARCH]
|
path = ["..", "build", sp.check_output(uname, encoding="utf-8").strip(), TARGET_ARCH]
|
||||||
if TOOLSET:
|
if TOOLSET:
|
||||||
path.append(TOOLSET)
|
path.append(TOOLSET)
|
||||||
|
DEFAULT_DEPS_DIR = os.path.realpath(os.path.join(*path))
|
||||||
|
|
||||||
DEPS_DIR = os.path.realpath(os.path.join(*path))
|
DEPS_DIR = os.getenv("DEPS_DIR", DEFAULT_DEPS_DIR)
|
||||||
|
|
||||||
if not os.path.exists(DEPS_DIR):
|
if not os.path.exists(DEPS_DIR):
|
||||||
os.makedirs(DEPS_DIR)
|
os.makedirs(DEPS_DIR)
|
||||||
@@ -189,7 +188,7 @@ cecho(""" - How many compiler processes may be run in parallel.
|
|||||||
|
|
||||||
dependency_tree = {
|
dependency_tree = {
|
||||||
'IfcParse': ('boost', 'libxml2', 'hdf5'),
|
'IfcParse': ('boost', 'libxml2', 'hdf5'),
|
||||||
'IfcGeom': ('IfcParse', 'occ', 'OpenCOLLADA', 'json', 'cgal'),
|
'IfcGeom': ('IfcParse', 'occ', 'json', 'cgal'),
|
||||||
'IfcConvert': ('IfcGeom',),
|
'IfcConvert': ('IfcGeom',),
|
||||||
'OpenCOLLADA': ('libxml2', 'pcre'),
|
'OpenCOLLADA': ('libxml2', 'pcre'),
|
||||||
'IfcGeomServer': ('IfcGeom',),
|
'IfcGeomServer': ('IfcGeom',),
|
||||||
@@ -593,30 +592,14 @@ if "python" in targets:
|
|||||||
if get_os() == "Darwin":
|
if get_os() == "Darwin":
|
||||||
PYTHON_CONFIGURE_ARGS = ["--disable-static", "--enable-shared"]
|
PYTHON_CONFIGURE_ARGS = ["--disable-static", "--enable-shared"]
|
||||||
|
|
||||||
def get_python_unicode_confs(py_ver):
|
for PYTHON_VERSION in PYTHON_VERSIONS:
|
||||||
if py_ver < "3.3":
|
|
||||||
return [("--enable-unicode=ucs2",""), ("--enable-unicode=ucs4","u")]
|
|
||||||
else: return [("","")]
|
|
||||||
|
|
||||||
def PYTHON_VERSION_CONFS():
|
|
||||||
for v in PYTHON_VERSIONS:
|
|
||||||
for unicode_conf, abi_tag in get_python_unicode_confs(v):
|
|
||||||
yield v, unicode_conf, abi_tag
|
|
||||||
|
|
||||||
for PYTHON_VERSION, unicode_conf, abi_tag in PYTHON_VERSION_CONFS():
|
|
||||||
try:
|
|
||||||
build_dependency(
|
build_dependency(
|
||||||
f"python-{PYTHON_VERSION}{abi_tag}",
|
f"python-{PYTHON_VERSION}",
|
||||||
"autoconf",
|
"autoconf",
|
||||||
PYTHON_CONFIGURE_ARGS + [unicode_conf],
|
PYTHON_CONFIGURE_ARGS,
|
||||||
f"http://www.python.org/ftp/python/{PYTHON_VERSION}/",
|
f"http://www.python.org/ftp/python/{PYTHON_VERSION}/",
|
||||||
f"Python-{PYTHON_VERSION}.tgz"
|
f"Python-{PYTHON_VERSION}.tgz"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
|
||||||
pyver2 = PYTHON_VERSION[:PYTHON_VERSION.rfind('.')]
|
|
||||||
if os.path.exists(f"{DEPS_DIR}/install/python-{PYTHON_VERSION}{abi_tag}/bin/python{pyver2}"):
|
|
||||||
print("Installation partially failed")
|
|
||||||
else: raise e
|
|
||||||
|
|
||||||
os.environ["CXXFLAGS"] = OLD_CXX_FLAGS
|
os.environ["CXXFLAGS"] = OLD_CXX_FLAGS
|
||||||
os.environ["CFLAGS"] = OLD_C_FLAGS
|
os.environ["CFLAGS"] = OLD_C_FLAGS
|
||||||
@@ -654,7 +637,7 @@ if "cgal" in targets:
|
|||||||
)
|
)
|
||||||
|
|
||||||
build_dependency(
|
build_dependency(
|
||||||
name="mpfr-%s" % (MPFR_VERSION,),
|
name=f"mpfr-{MPFR_VERSION}",
|
||||||
mode="autoconf",
|
mode="autoconf",
|
||||||
build_tool_args=["--disable-shared", f"--with-gmp={DEPS_DIR}/install/gmp-{GMP_VERSION}"],
|
build_tool_args=["--disable-shared", f"--with-gmp={DEPS_DIR}/install/gmp-{GMP_VERSION}"],
|
||||||
download_url=f"http://www.mpfr.org/mpfr-{MPFR_VERSION}/",
|
download_url=f"http://www.mpfr.org/mpfr-{MPFR_VERSION}/",
|
||||||
@@ -662,7 +645,7 @@ if "cgal" in targets:
|
|||||||
)
|
)
|
||||||
|
|
||||||
build_dependency(
|
build_dependency(
|
||||||
name="cgal-{CGAL_VERSION}",
|
name=f"cgal-{CGAL_VERSION}",
|
||||||
mode="cmake",
|
mode="cmake",
|
||||||
build_tool_args=[
|
build_tool_args=[
|
||||||
f"-DGMP_LIBRARIES={DEPS_DIR}/install/gmp-{GMP_VERSION}/lib/libgmp.a",
|
f"-DGMP_LIBRARIES={DEPS_DIR}/install/gmp-{GMP_VERSION}/lib/libgmp.a",
|
||||||
@@ -729,6 +712,7 @@ if "occ" in targets and USE_OCCT:
|
|||||||
"-DOCC_INCLUDE_DIR=" +occ_include_dir,
|
"-DOCC_INCLUDE_DIR=" +occ_include_dir,
|
||||||
"-DOCC_LIBRARY_DIR=" +occ_library_dir
|
"-DOCC_LIBRARY_DIR=" +occ_library_dir
|
||||||
])
|
])
|
||||||
|
|
||||||
elif "occ" in targets:
|
elif "occ" in targets:
|
||||||
occ_include_dir = f"{DEPS_DIR}/install/oce-{OCE_VERSION}/include/oce"
|
occ_include_dir = f"{DEPS_DIR}/install/oce-{OCE_VERSION}/include/oce"
|
||||||
occ_library_dir = f"{DEPS_DIR}/install/oce-{OCE_VERSION}/lib"
|
occ_library_dir = f"{DEPS_DIR}/install/oce-{OCE_VERSION}/lib"
|
||||||
@@ -742,6 +726,10 @@ if "OpenCOLLADA" in targets:
|
|||||||
"-DOPENCOLLADA_INCLUDE_DIR=" f"{DEPS_DIR}/install/OpenCOLLADA/include/opencollada",
|
"-DOPENCOLLADA_INCLUDE_DIR=" f"{DEPS_DIR}/install/OpenCOLLADA/include/opencollada",
|
||||||
"-DOPENCOLLADA_LIBRARY_DIR=" f"{DEPS_DIR}/install/OpenCOLLADA/lib/opencollada"
|
"-DOPENCOLLADA_LIBRARY_DIR=" f"{DEPS_DIR}/install/OpenCOLLADA/lib/opencollada"
|
||||||
])
|
])
|
||||||
|
else:
|
||||||
|
cmake_args.extend([
|
||||||
|
"-DCOLLADA_SUPPORT=" "Off",
|
||||||
|
])
|
||||||
|
|
||||||
if "pcre" in targets:
|
if "pcre" in targets:
|
||||||
cmake_args.append(
|
cmake_args.append(
|
||||||
@@ -778,10 +766,9 @@ if "IfcOpenShell-Python" in targets:
|
|||||||
os.environ["CFLAGS"] = f"{CFLAGS_MINIMAL} {ADDITIONAL_ARGS}"
|
os.environ["CFLAGS"] = f"{CFLAGS_MINIMAL} {ADDITIONAL_ARGS}"
|
||||||
os.environ["LDFLAGS"] = f"{LDFLAGS} {ADDITIONAL_ARGS}"
|
os.environ["LDFLAGS"] = f"{LDFLAGS} {ADDITIONAL_ARGS}"
|
||||||
|
|
||||||
for PYTHON_VERSION, _, TAG in PYTHON_VERSION_CONFS():
|
for PYTHON_VERSION in PYTHON_VERSIONS:
|
||||||
logger.info(f"\rConfiguring python {PYTHON_VERSION}{TAG} wrapper...")
|
logger.info(f"\rConfiguring python {PYTHON_VERSION}{TAG} wrapper...")
|
||||||
|
|
||||||
# python_dir = os.path.join(IFCOS_DIR, f"python-{PYTHON_VERSION}{TAG}")
|
|
||||||
python_dir = os.path.join(IFCOS_DIR, "pythonwrapper")
|
python_dir = os.path.join(IFCOS_DIR, "pythonwrapper")
|
||||||
if not os.path.exists(python_dir):
|
if not os.path.exists(python_dir):
|
||||||
os.makedirs(python_dir)
|
os.makedirs(python_dir)
|
||||||
@@ -790,9 +777,9 @@ if "IfcOpenShell-Python" in targets:
|
|||||||
if os.path.exists(cache_path):
|
if os.path.exists(cache_path):
|
||||||
os.unlink(cache_path)
|
os.unlink(cache_path)
|
||||||
|
|
||||||
PYTHON_LIBRARY=run([bash, "-c", f"ls {DEPS_DIR}/install/python-{PYTHON_VERSION}{TAG}/lib/libpython*.*"])
|
PYTHON_LIBRARY = run([bash, "-c", f"ls {DEPS_DIR}/install/python-{PYTHON_VERSION}/lib/libpython*.*"])
|
||||||
PYTHON_INCLUDE=run([bash, "-c", f"ls -d {DEPS_DIR}/install/python-{PYTHON_VERSION}{TAG}/include/python*"])
|
PYTHON_INCLUDE = run([bash, "-c", f"ls -d {DEPS_DIR}/install/python-{PYTHON_VERSION}/include/python*"])
|
||||||
PYTHON_EXECUTABLE=os.path.join(DEPS_DIR, "install", f"python-{PYTHON_VERSION}{TAG}", "bin", f"python{PYTHON_VERSION[0]}")
|
PYTHON_EXECUTABLE = os.path.join(DEPS_DIR, "install", f"python-{PYTHON_VERSION}", "bin", f"python{PYTHON_VERSION[0]}")
|
||||||
os.environ["PYTHON_LIBRARY_BASENAME"] = os.path.basename(PYTHON_LIBRARY)
|
os.environ["PYTHON_LIBRARY_BASENAME"] = os.path.basename(PYTHON_LIBRARY)
|
||||||
|
|
||||||
run_cmake("",
|
run_cmake("",
|
||||||
@@ -804,7 +791,7 @@ if "IfcOpenShell-Python" in targets:
|
|||||||
"-DCMAKE_INSTALL_PREFIX=" f"{DEPS_DIR}/install/ifcopenshell/tmp",
|
"-DCMAKE_INSTALL_PREFIX=" f"{DEPS_DIR}/install/ifcopenshell/tmp",
|
||||||
], cmake_dir=CMAKE_DIR, cwd=python_dir)
|
], cmake_dir=CMAKE_DIR, cwd=python_dir)
|
||||||
|
|
||||||
logger.info(f"\rBuilding python {PYTHON_VERSION}{TAG} wrapper... ")
|
logger.info(f"\rBuilding python {PYTHON_VERSION} wrapper... ")
|
||||||
|
|
||||||
run([make, f"-j{IFCOS_NUM_BUILD_PROCS}", "_ifcopenshell_wrapper"], cwd=python_dir)
|
run([make, f"-j{IFCOS_NUM_BUILD_PROCS}", "_ifcopenshell_wrapper"], cwd=python_dir)
|
||||||
run([make, "install/local"], cwd=os.path.join(python_dir, "ifcwrap"))
|
run([make, "install/local"], cwd=os.path.join(python_dir, "ifcwrap"))
|
||||||
@@ -815,6 +802,6 @@ if "IfcOpenShell-Python" in targets:
|
|||||||
# TODO: This symbol name depends on the Python version?
|
# TODO: This symbol name depends on the Python version?
|
||||||
run([strip, "-s", "-K", "PyInit__ifcopenshell_wrapper", "_ifcopenshell_wrapper.so"], cwd=module_dir)
|
run([strip, "-s", "-K", "PyInit__ifcopenshell_wrapper", "_ifcopenshell_wrapper.so"], cwd=module_dir)
|
||||||
|
|
||||||
run([cp, "-R", module_dir, os.path.join(DEPS_DIR, "install", "ifcopenshell", f"python-{PYTHON_VERSION}{TAG}")])
|
run([cp, "-R", module_dir, os.path.join(DEPS_DIR, "install", "ifcopenshell", f"python-{PYTHON_VERSION}")])
|
||||||
|
|
||||||
logger.info("\rBuilt IfcOpenShell...\n\n")
|
logger.info("\rBuilt IfcOpenShell...\n\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user