diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d826a12d..2d4e825d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -246,7 +246,7 @@ build_mac: -DUSE_NATIVE_ARCH=OFF -DUSE_CCACHE=ON -DENABLE_UNIT_TESTS=ON - -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -DUSE_CGNS=ON -DUSE_OCC=ON diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index 9b41813b..6b00a288 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -8,20 +8,27 @@ set (NETGEN_DEPENDENCIES) set (LAPACK_DEPENDENCIES) set (NETGEN_CMAKE_ARGS "" CACHE INTERNAL "") set (SUBPROJECT_CMAKE_ARGS "" CACHE INTERNAL "") + set (SUBPROJECT_ARGS - LOG_DOWNLOAD ON - LOG_BUILD ON - LOG_INSTALL ON - LOG_CONFIGURE ON LIST_SEPARATOR | PREFIX ${CMAKE_CURRENT_BINARY_DIR}/dependencies ) -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0") + +# only show output on failure in ci-builds +if(DEFINED ENV{CI} AND WIN32) set (SUBPROJECT_ARGS - ${SUBPROJECT_ARGS} - LOG_OUTPUT_ON_FAILURE 1 - LOG_MERGED_STDOUTERR 1 + LOG_DOWNLOAD ON + LOG_BUILD ON + LOG_INSTALL ON + LOG_CONFIGURE ON ) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0") + set (SUBPROJECT_ARGS + ${SUBPROJECT_ARGS} + LOG_OUTPUT_ON_FAILURE ON + LOG_MERGED_STDOUTERR ON + ) + endif() endif() diff --git a/libsrc/core/utils.cpp b/libsrc/core/utils.cpp index 107d131c..b0ad1e98 100644 --- a/libsrc/core/utils.cpp +++ b/libsrc/core/utils.cpp @@ -7,6 +7,7 @@ #include #endif #include +#include #include #include @@ -111,5 +112,14 @@ namespace ngcore #endif } + NGCORE_API std::string GetTempFilename() + { + static int counter = 0; + auto path = std::filesystem::temp_directory_path(); + std::string filename = ".temp_netgen_file_"+ToString(counter++)+"_"+ToString(GetTimeCounter()); + path.append(filename); + return path.string(); + } + } // namespace ngcore diff --git a/libsrc/core/utils.hpp b/libsrc/core/utils.hpp index f9783c7b..e48b7162 100644 --- a/libsrc/core/utils.hpp +++ b/libsrc/core/utils.hpp @@ -201,6 +201,8 @@ namespace ngcore NGCORE_API int GetCompiledSIMDSize(); NGCORE_API bool IsRangeCheckEnabled(); + NGCORE_API std::string GetTempFilename(); + } // namespace ngcore #endif // NETGEN_CORE_UTILS_HPP diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index f75c9a67..4769288e 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -58,11 +58,11 @@ namespace netgen OCCGeometry::OCCGeometry(const TopoDS_Shape& _shape, int aoccdim) { - auto filename = ".tmpfile_out.step"; - step_utils::WriteSTEP(_shape, filename); - LoadOCCInto(this, filename); + auto filename = GetTempFilename(); + step_utils::WriteSTEP(_shape, filename.c_str()); + LoadOCCInto(this, filename.c_str()); occdim = aoccdim; - std::remove(filename); + std::remove(filename.c_str()); } string STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * aReader) @@ -1650,24 +1650,24 @@ namespace netgen std::stringstream ss; STEPControl_Writer writer; writer.Transfer(shape, STEPControl_AsIs); - auto filename = ".tmpfile_out.step"; - writer.Write(filename); - std::ifstream is(filename); + auto filename = GetTempFilename(); + writer.Write(filename.c_str()); + std::ifstream is(filename.c_str()); ss << is.rdbuf(); ar << ss.str(); - std::remove(filename); + std::remove(filename.c_str()); } else { std::string str; ar & str; - auto filename = ".tmpfile.step"; - auto tmpfile = std::fopen(filename, "w"); + auto filename = GetTempFilename(); + auto tmpfile = std::fopen(filename.c_str(), "w"); std::fputs(str.c_str(), tmpfile); std::fclose(tmpfile); - LoadOCCInto(this, filename); - std::remove(filename); + LoadOCCInto(this, filename.c_str()); + std::remove(filename.c_str()); } } diff --git a/tests/build_pip_mac.sh b/tests/build_pip_mac.sh index 58bdb424..738a09aa 100755 --- a/tests/build_pip_mac.sh +++ b/tests/build_pip_mac.sh @@ -9,5 +9,5 @@ $PYDIR/python3 --version $PYDIR/pip3 install --user numpy twine scikit-build wheel export CMAKE_OSX_ARCHITECTURES='arm64;x86_64' -$PYDIR/python3 setup.py bdist_wheel --plat-name macosx-10.14-universal2 -j10 +$PYDIR/python3 setup.py bdist_wheel --plat-name macosx-10.15-universal2 -j10 $PYDIR/python3 -m twine upload --repository testpypi dist/*.whl