diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 47a53706f9..3f3acbbf4c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -18,7 +18,7 @@ ################################################################################ cmake_minimum_required(VERSION 3.1.3) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # not necessary, but encouraged project (IfcOpenShell) diff --git a/nix/build-all.py b/nix/build-all.py index 5fd1b6922c..433787130f 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -97,7 +97,7 @@ SWIG_VERSION="3.0.12" OPENCOLLADA_VERSION="v1.6.68" GMP_VERSION="6.1.2" MPFR_VERSION="3.1.5" -CGAL_VERSION="4.14.3" +CGAL_VERSION="5.2" # binaries cp="cp" @@ -253,7 +253,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", "m4"]: +for cmd in [git, bunzip2, tar, cc, cplusplus, autoconf, automake, yacc, make, "patch", "m4", "cmake"]: if which(cmd) is None: raise ValueError("Required tool '%s' not installed or not added to PATH" % (cmd,)) @@ -320,7 +320,8 @@ 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") + # @todo this is already in v0.6 + cmake_path = "cmake" run([cmake_path, P]+cmake_args+["-DCMAKE_BUILD_TYPE=%s" % (BUILD_CFG,)], cwd=cwd) def git_clone_or_pull_repository(clone_url, target_dir, revision=None): @@ -481,27 +482,6 @@ os.environ["CXXFLAGS"] = CXXFLAGS 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) - if "json" in targets: json_url = "https://github.com/nlohmann/json/releases/download/{JSON_VERSION}/json.hpp".format(**locals()) json_install_path = "{DEPS_DIR}/install/json/nlohmann/json.hpp".format(**locals()) @@ -676,7 +656,8 @@ if "cgal" in targets: build_dependency( name="cgal-{CGAL_VERSION}".format(**locals()), mode="cmake", - patch="./patches/cgal/cgal_4768.patch", + # applied upstream + # patch="./patches/cgal/cgal_4768.patch", build_tool_args=[ "-DGMP_LIBRARIES=%s/install/gmp-%s/lib/libgmp.a" % (DEPS_DIR, GMP_VERSION), "-DGMP_INCLUDE_DIR=%s/install/gmp-%s/include" % (DEPS_DIR, GMP_VERSION), @@ -684,11 +665,13 @@ if "cgal" in targets: "-DMPFR_INCLUDE_DIR=%s/install/mpfr-%s/include" % (DEPS_DIR, MPFR_VERSION), "-DBoost_INCLUDE_DIR=%s/install/boost-%s" % (DEPS_DIR, BOOST_VERSION), "-DCMAKE_INSTALL_PREFIX=%s/install/cgal-%s/" % (DEPS_DIR, CGAL_VERSION), + # for now as the IfOpSh CMakeL expects libraries, we can probably safely turn this off though + "-DCGAL_HEADER_ONLY=OFF", "-DBUILD_SHARED_LIBS=Off"], download_url="https://github.com/CGAL/cgal.git", download_name="cgal", download_tool=download_tool_git, - revision="releases/CGAL-{CGAL_VERSION}".format(**locals()) + revision="v{CGAL_VERSION}".format(**locals()) ) BUILD_CFG = OLD_BUILD_CFG