From 877bf3207a120672fe1af89f068ab2e983f590ce Mon Sep 17 00:00:00 2001 From: aothms Date: Thu, 24 Dec 2020 20:46:42 +0000 Subject: [PATCH 1/3] Nix build: no longer build cmake, some fixes for 32bit crosscompiling --- nix/build-all.py | 44 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/nix/build-all.py b/nix/build-all.py index b9a100f672..5033c2b2a4 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -23,7 +23,7 @@ # This script builds IfcOpenShell and its dependencies # # # # Prerequisites for this script to function correctly: # -# * git * bzip2 * tar * c(++) compilers * yacc * autoconf # +# * cmake * git * bzip2 * tar * c(++) compilers * yacc * autoconf # # # # if building with USE_OCCT additionally: # # * freetype * glx.h # @@ -38,15 +38,15 @@ # * libffi(-dev[el]) # # # # on debian 7.8 these can be obtained with: # -# $ apt-get install git gcc g++ autoconf bison bzip2 # +# $ apt-get install git gcc g++ autoconf bison bzip2 cmake # # libfreetype6-dev mesa-common-dev libffi-dev libfontconfig1-dev # # # # on ubuntu 14.04: # -# $ apt-get install git gcc g++ autoconf bison make # +# $ apt-get install git gcc g++ autoconf bison make cmake # # libfreetype6-dev mesa-common-dev libffi-dev libfontconfig1-dev # # # # on OS X El Capitan with homebrew: # -# $ brew install git bison autoconf automake freetype libffi # +# $ brew install git bison autoconf automake freetype libffi cmake # # # ############################################################################### @@ -92,8 +92,6 @@ BOOST_VERSION="1.59.0" PCRE_VERSION="8.41" #LIBXML2_VERSION="2.9.3" LIBXML2_VERSION="2.9.9" -CMAKE_VERSION="3.4.3" -#CMAKE_VERSION="3.14.5" SWIG_VERSION="3.0.12" #SWIG_VERSION="4.0.0" #OPENCOLLADA_VERSION="v1.6.63" @@ -303,7 +301,6 @@ def run(cmds, cwd=None): return stdout.strip() BOOST_VERSION_UNDERSCORE=BOOST_VERSION.replace(".", "_") -CMAKE_VERSION_2=CMAKE_VERSION[:CMAKE_VERSION.rindex('.')] OCE_LOCATION="https://github.com/tpaviot/oce/archive/OCE-%s.tar.gz" % (OCE_VERSION,) BOOST_LOCATION="http://downloads.sourceforge.net/project/boost/boost/%s/boost_%s.tar.bz2" % (BOOST_VERSION, BOOST_VERSION_UNDERSCORE) @@ -322,8 +319,7 @@ def run_cmake(arg1, cmake_args, cmake_dir=None, cwd=None): P=".." else: P=cmake_dir - cmake_path= os.path.join(DEPS_DIR, "install", "cmake-%s" % (CMAKE_VERSION,), "bin", "cmake") - run([cmake_path, P]+cmake_args+["-DCMAKE_BUILD_TYPE=%s" % (BUILD_CFG,)], cwd=cwd) + run(["cmake", P]+cmake_args+["-DCMAKE_BUILD_TYPE=%s" % (BUILD_CFG,)], cwd=cwd) def git_clone_or_pull_repository(clone_url, target_dir, revision=None): """Lazily clones the `git` repository denoted by `clone_url` into @@ -424,7 +420,7 @@ def build_dependency(name, mode, build_tool_args, download_url, download_name, d else: raise ValueError() logger.info("\rBuilding %s... " % (name,)) - run([make, "-j%s" % (IFCOS_NUM_BUILD_PROCS,)], cwd=extract_build_dir) + run([make, "-j%s" % (IFCOS_NUM_BUILD_PROCS,), "VERBOSE=1"], cwd=extract_build_dir) logger.info( "\rInstalling %s... " % (name,)) run([make, "install"], cwd=extract_build_dir) logger.info( "\rInstalled %s \n" % (name,)) @@ -445,7 +441,10 @@ cecho("Collecting dependencies:", GREEN) ADDITIONAL_ARGS=[] BOOST_ADDRESS_MODEL=[] if TARGET_ARCH == "i686" and run([uname, "-m"]).strip() == "x86_64": - ADDITIONAL_ARGS=["-m32", "-arch i386"] + if get_os() == "Darwin": + ADDITIONAL_ARGS=["-m32", "-arch i386"] + else: + ADDITIONAL_ARGS=["-m32"] BOOST_ADDRESS_MODEL=["architecture=x86", "address-model=32"] if get_os() == "Darwin": @@ -484,25 +483,8 @@ os.environ["CFLAGS"] = CFLAGS os.environ["LDFLAGS"] = LDFLAGS # Some dependencies need a more recent CMake version than most distros provide -build_dependency(name="cmake-%s" % (CMAKE_VERSION,), mode="autoconf", build_tool_args=[], download_url="https://cmake.org/files/v%s" % (CMAKE_VERSION_2,), download_name="cmake-%s.tar.gz" % (CMAKE_VERSION,)) - -# Extract compiler flags from CMake to harmonize settings with other autoconf dependencies -CMAKE_FLAG_EXTRACT_DIR="ifcopenshell_cmake_test_%s" % (time.time(),) -# was sp.check_output([bash, "-c", "cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32"]), in bash script, unclear what the exact required format is and whether it's needed -if os.path.exists(CMAKE_FLAG_EXTRACT_DIR): - shutil.rmtree(CMAKE_FLAG_EXTRACT_DIR) -os.makedirs(CMAKE_FLAG_EXTRACT_DIR) -BUILD_CFG_UPPER=BUILD_CFG.upper() -for FL in ["C", "CXX"]: - run([bash, "-c", """echo " - message(\"\${CMAKE_%s_FLAGS_%s}\") - " > CMakeLists.txt""" % (FL, BUILD_CFG_UPPER)], cwd=CMAKE_FLAG_EXTRACT_DIR) - FL="%sFLAGS" % (FL,) - FLM="%sFLAGS_MINIMAL" % (FL,) -# @TODO: bash code unclear -# exec("%sFLAGS=%s" % (FL, sp.check_output([os.path.join(DEPS_DIR, "install", "cmake-%s" % (CMAKE_VERSION,), "bin", "cmake"), "." -# declare ${FL}FLAGS_MINIMAL="`$DEPS_DIR/install/cmake-$CMAKE_VERSION/bin/cmake . 2>&1 >/dev/null` ${!FLM}" -shutil.rmtree(CMAKE_FLAG_EXTRACT_DIR) +# @tfk: this is no longer needed +# build_dependency(name="cmake-%s" % (CMAKE_VERSION,), mode="autoconf", build_tool_args=[], download_url="https://cmake.org/files/v%s" % (CMAKE_VERSION_2,), download_name="cmake-%s.tar.gz" % (CMAKE_VERSION,)) if "json" in targets: json_url = "https://github.com/nlohmann/json/releases/download/{JSON_VERSION}/json.hpp".format(**locals()) @@ -527,7 +509,7 @@ if "swig" in targets: build_dependency( name="swig", mode="autoconf", - build_tool_args=["--with-pcre-prefix={DEPS_DIR}/install/pcre-{PCRE_VERSION}".format(**locals())], + build_tool_args=["--disable-ccache", "--with-pcre-prefix={DEPS_DIR}/install/pcre-{PCRE_VERSION}".format(**locals())], download_url="https://github.com/swig/swig.git", download_name="swig", download_tool=download_tool_git, From f235f5765b89976d32aaad006352f8ece20d3565 Mon Sep 17 00:00:00 2001 From: htlcnn Date: Sat, 26 Dec 2020 11:08:07 +0700 Subject: [PATCH 2/3] fix IfcGetAttribute malfunction --- src/ifcsverchok/nodes/ifc/get_attribute.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ifcsverchok/nodes/ifc/get_attribute.py b/src/ifcsverchok/nodes/ifc/get_attribute.py index 8c7280fc8f..deb98421d2 100644 --- a/src/ifcsverchok/nodes/ifc/get_attribute.py +++ b/src/ifcsverchok/nodes/ifc/get_attribute.py @@ -19,9 +19,15 @@ class SvIfcGetAttribute(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper self.outputs.new("SvStringsSocket", "value") def process(self): - self.sv_input_names = ["entity", "attribute_name"] self.value_out = [] - super().process() + entity_nested_inputs = self.inputs["entity"].sv_get() + attribute_name = self.inputs["attribute_name"].sv_get()[0][0] + for entities in entity_nested_inputs: + if hasattr(entities, "__iter__"): + for entity in entities: + self.process_ifc(entity, attribute_name) + else: + self.process_ifc(entities, attribute_name) self.outputs["value"].sv_set(self.value_out) def process_ifc(self, entity, attribute_name): From 315b32dd38e036e455b2aa74109c46464fbe2026 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 26 Dec 2020 13:49:57 +0100 Subject: [PATCH 3/3] Nix build: assert cmake in path --- nix/build-all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/build-all.py b/nix/build-all.py index 5033c2b2a4..a943e25f94 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -257,7 +257,7 @@ print("Building:", *sorted(targets, key=lambda t: len(list(v(t))))) # Check that required tools are in PATH -for cmd in [git, bunzip2, tar, cc, cplusplus, autoconf, automake, yacc, make, "patch"]: +for cmd in [git, bunzip2, tar, cc, cplusplus, autoconf, automake, yacc, make, "patch", "cmake"]: if which(cmd) is None: raise ValueError("Required tool '%s' not installed or not added to PATH" % (cmd,))