diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/netgen | |
Diffstat (limited to 'vcpkg/ports/netgen')
| -rw-r--r-- | vcpkg/ports/netgen/142.diff | 13 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/add_filesystem.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/cgns-scoped-enum.patch | 69 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/cmake-adjustments.patch | 14 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/cross-build.patch | 64 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/downstream-fixes.patch | 25 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/git-ver.patch | 14 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/occ-78.patch | 160 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/portfile.cmake | 108 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/static-exports.patch | 38 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/vcpkg-fix-cgns-link.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/netgen/vcpkg.json | 70 |
12 files changed, 600 insertions, 0 deletions
diff --git a/vcpkg/ports/netgen/142.diff b/vcpkg/ports/netgen/142.diff new file mode 100644 index 0000000..6e8fe2d --- /dev/null +++ b/vcpkg/ports/netgen/142.diff @@ -0,0 +1,13 @@ +diff --git a/cmake/generate_version_file.cmake b/cmake/generate_version_file.cmake
+index c4a579d1..c47b6039 100644
+--- a/cmake/generate_version_file.cmake
++++ b/cmake/generate_version_file.cmake
+@@ -39,7 +39,7 @@ string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([0-9a-z]+).*" "\\1"
+ set(NETGEN_VERSION_SHORT ${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}.${NETGEN_VERSION_PATCH})
+ set(NETGEN_VERSION_LONG ${NETGEN_VERSION_SHORT}-${NETGEN_VERSION_TWEAK}-${NETGEN_VERSION_HASH})
+
+-if(NETGEN_VERSION_TWEAK)
++if(NETGEN_VERSION_TWEAK AND NOT NETGEN_VERSION_TWEAK STREQUAL git_version_string)
+ # no release version - nightly build
+ set(NETGEN_VERSION ${NETGEN_VERSION_LONG})
+ else()
diff --git a/vcpkg/ports/netgen/add_filesystem.patch b/vcpkg/ports/netgen/add_filesystem.patch new file mode 100644 index 0000000..47f9c2a --- /dev/null +++ b/vcpkg/ports/netgen/add_filesystem.patch @@ -0,0 +1,12 @@ +diff --git a/libsrc/core/logging.hpp b/libsrc/core/logging.hpp +index adfed7e..d34d3e9 100644 +--- a/libsrc/core/logging.hpp ++++ b/libsrc/core/logging.hpp +@@ -6,6 +6,7 @@ + #include <memory> + #include <string> + #include <vector> ++#include <filesystem> + + #include "exception.hpp" + #include "ngcore_api.hpp" diff --git a/vcpkg/ports/netgen/cgns-scoped-enum.patch b/vcpkg/ports/netgen/cgns-scoped-enum.patch new file mode 100644 index 0000000..3ea2db4 --- /dev/null +++ b/vcpkg/ports/netgen/cgns-scoped-enum.patch @@ -0,0 +1,69 @@ +diff --git a/libsrc/interface/rw_cgns.cpp b/libsrc/interface/rw_cgns.cpp +index 096fbfdca..edf199cfd 100644 +--- a/libsrc/interface/rw_cgns.cpp ++++ b/libsrc/interface/rw_cgns.cpp +@@ -6,6 +6,37 @@ + + #include <cgnslib.h> + ++//vcpkg builds cgns with scoped enumes. So the associcated types and values need to be correctly scoped. ++#define ElementType_t CGNS_ENUMT(ElementType_t) ++#define GridLocation_t CGNS_ENUMT(GridLocation_t) ++#define PointSetType_t CGNS_ENUMT(PointSetType_t) ++#define DataType_t CGNS_ENUMT(DataType_t) ++#define ZoneType_t CGNS_ENUMT(ZoneType_t) ++#define Unstructured CGNS_ENUMV(Unstructured) ++#define RealDouble CGNS_ENUMV(RealDouble) ++#define MIXED CGNS_ENUMV(MIXED) ++#define EdgeCenter CGNS_ENUMV(EdgeCenter) ++#define KFaceCenter CGNS_ENUMV(KFaceCenter) ++#define JFaceCenter CGNS_ENUMV(JFaceCenter) ++#define IFaceCenter CGNS_ENUMV(IFaceCenter) ++#define FaceCenter CGNS_ENUMV(FaceCenter) ++#define CellCenter CGNS_ENUMV(CellCenter) ++#define Vertex CGNS_ENUMV(Vertex) ++#define BAR_2 CGNS_ENUMV(BAR_2) ++#define BAR_3 CGNS_ENUMV(BAR_3) ++#define TRI_3 CGNS_ENUMV(TRI_3) ++#define TRI_6 CGNS_ENUMV(TRI_6) ++#define QUAD_4 CGNS_ENUMV(QUAD_4) ++#define QUAD_8 CGNS_ENUMV(QUAD_8) ++#define TETRA_4 CGNS_ENUMV(TETRA_4) ++#define TETRA_10 CGNS_ENUMV(TETRA_10) ++#define PYRA_5 CGNS_ENUMV(PYRA_5) ++#define PYRA_13 CGNS_ENUMV(PYRA_13) ++#define HEXA_8 CGNS_ENUMV(HEXA_8) ++#define HEXA_20 CGNS_ENUMV(HEXA_20) ++#define PENTA_6 CGNS_ENUMV(PENTA_6) ++#define PENTA_15 CGNS_ENUMV(PENTA_15) ++ + namespace netgen::cg + { + typedef ngcore::ClosedHashTable<ngcore::INT<3,size_t>, size_t> PointTable; +@@ -215,7 +246,7 @@ namespace netgen::cg + if(codim==2) name += mesh.GetCD2Name(index); + + int ne = 0; +- Array<int> data; ++ Array<cgsize_t> data; + + if(dim==3) + for(const auto el : mesh.VolumeElements()) +@@ -333,7 +364,7 @@ namespace netgen::cg + ZoneType_t zone_type; + int fn, base, zone; + int first_index_1d, first_index_2d, first_index_3d; +- int nv=0, ne_1d=0, ne_2d=0, ne_3d=0; ++ cgsize_t nv=0, ne_1d=0, ne_2d=0, ne_3d=0; + + Array<string> names_1d, names_2d, names_3d; + +@@ -643,7 +674,7 @@ namespace netgen + int n_vertices = 0; + for (auto zi : Range(1, nzones+1)) + { +- int size[3]; ++ cgsize_t size[3]; + char name[100]; + cg_zone_read(fn,base,zi, name, size); + n_vertices += size[0]; diff --git a/vcpkg/ports/netgen/cmake-adjustments.patch b/vcpkg/ports/netgen/cmake-adjustments.patch new file mode 100644 index 0000000..0683f56 --- /dev/null +++ b/vcpkg/ports/netgen/cmake-adjustments.patch @@ -0,0 +1,14 @@ +diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt +index c4f4795..cd5ad50 100644 +--- a/libsrc/core/CMakeLists.txt ++++ b/libsrc/core/CMakeLists.txt +@@ -28,8 +28,7 @@ endif(USE_PYTHON) + + if(WIN32) + target_compile_options(ngcore PUBLIC /bigobj /MP /W1 /wd4068) +- get_WIN32_WINNT(ver) +- target_compile_definitions(ngcore PUBLIC _WIN32_WINNT=${ver} WNT WNT_WINDOW NOMINMAX MSVC_EXPRESS _CRT_SECURE_NO_WARNINGS HAVE_STRUCT_TIMESPEC WIN32) ++ target_compile_definitions(ngcore PUBLIC WNT WNT_WINDOW NOMINMAX MSVC_EXPRESS _CRT_SECURE_NO_WARNINGS HAVE_STRUCT_TIMESPEC WIN32) + target_link_options(ngcore PUBLIC /ignore:4273 /ignore:4217 /ignore:4049) + endif(WIN32) + diff --git a/vcpkg/ports/netgen/cross-build.patch b/vcpkg/ports/netgen/cross-build.patch new file mode 100644 index 0000000..10c4aa9 --- /dev/null +++ b/vcpkg/ports/netgen/cross-build.patch @@ -0,0 +1,64 @@ +diff --git a/libsrc/core/exception.cpp b/libsrc/core/exception.cpp +index 9c99a138..2d5a1ede 100644 +--- a/libsrc/core/exception.cpp ++++ b/libsrc/core/exception.cpp +@@ -36,7 +36,7 @@ namespace ngcore + + + // ********* STUFF FOR GETBACKTRACE *************************** +-#if defined __GNUC__ && !defined __EMSCRIPTEN__ ++#if defined __GNUC__ && !defined __EMSCRIPTEN__ && !defined __ANDROID__ + + #include <execinfo.h> + #include <string.h> +diff --git a/libsrc/core/simd.hpp b/libsrc/core/simd.hpp +index d5a6341f..5f07a6d3 100644 +--- a/libsrc/core/simd.hpp ++++ b/libsrc/core/simd.hpp +@@ -28,7 +28,7 @@ + #include "simd_avx512.hpp" + #endif + +-#ifdef __aarch64__ ++#if defined __aarch64__ && !defined __ANDROID__ + #include "simd_arm64.hpp" + #endif + +diff --git a/libsrc/core/utils.hpp b/libsrc/core/utils.hpp +index 79d919c0..1318debf 100644 +--- a/libsrc/core/utils.hpp ++++ b/libsrc/core/utils.hpp +@@ -74,7 +74,7 @@ namespace ngcore + #elif defined(__EMSCRIPTEN__) + return std::chrono::high_resolution_clock::now().time_since_epoch().count(); + #else +-#warning "Unsupported CPU architecture" ++#pragma message ( "Unsupported CPU architecture" ) + return 0; + #endif + } +diff --git a/rules/CMakeLists.txt b/rules/CMakeLists.txt +index 2c281ca3..e2982f28 100644 +--- a/rules/CMakeLists.txt ++++ b/rules/CMakeLists.txt +@@ -1,14 +1,14 @@ + # this file is included from the parent directory (otherwise generated source files are not recognized properly by cmake) + + # generate .cpp files containing the string of the .rls meshing rule files +-if(EMSCRIPTEN) +- add_custom_command(OUTPUT makerls +- COMMAND g++ ${CMAKE_CURRENT_SOURCE_DIR}/rules/makerlsfile.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/makerls +- ) +- set(rules_command ${CMAKE_BINARY_DIR}/makerls) +-else(EMSCRIPTEN) ++if(MAKERLS_EXECUTABLE) ++ add_executable(makerls IMPORTED) ++ set_target_properties(makerls PROPERTIES IMPORTED_LOCATION "${MAKERLS_EXECUTABLE}") ++ set(rules_command makerls) ++else() + add_executable(makerls rules/makerlsfile.cpp) + set(rules_command makerls) ++ install(TARGETS makerls DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen) + endif() + + set(rules diff --git a/vcpkg/ports/netgen/downstream-fixes.patch b/vcpkg/ports/netgen/downstream-fixes.patch new file mode 100644 index 0000000..d570ec8 --- /dev/null +++ b/vcpkg/ports/netgen/downstream-fixes.patch @@ -0,0 +1,25 @@ +diff --git a/libsrc/stlgeom/stltopology.hpp b/libsrc/stlgeom/stltopology.hpp +index 2a3822f70..a14dc5bda 100644 +--- a/libsrc/stlgeom/stltopology.hpp ++++ b/libsrc/stlgeom/stltopology.hpp +@@ -350,7 +350,7 @@ public: + int GetNP() const { return points.Size(); } + int AddPoint(const Point<3> & p) { points.Append(p); return points.Size(); } + const Point<3> & GetPoint(STLPointId nr) const { return points[nr]; } // .Get(nr); } ++ DLL_HEADER int GetPointNum (const Point<3> & p); +- int GetPointNum (const Point<3> & p); + void SetPoint(STLPointId nr, const Point<3> & p) { points[nr] = p; } // { points.Elem(nr) = p; } + auto & GetPoints() const { return points; } + +diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp +index ee25f3814..c8fe35cb2 100644 +--- a/nglib/nglib.cpp ++++ b/nglib/nglib.cpp +@@ -619,6 +619,7 @@ namespace nglib + }
+ */
+ geo->AddEdges(readedges);
++ readedges.SetSize(0);
+ }
+
+ if (geo->GetStatus() == STLTopology::STL_GOOD || geo->GetStatus() == STLTopology::STL_WARNING) return NG_OK;
diff --git a/vcpkg/ports/netgen/git-ver.patch b/vcpkg/ports/netgen/git-ver.patch new file mode 100644 index 0000000..710b6d6 --- /dev/null +++ b/vcpkg/ports/netgen/git-ver.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6e9f4cc..bf92061 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -430,7 +430,8 @@ endif (USE_MPEG) + ####################################################################### + add_custom_target(ng_generate_version_file + ${CMAKE_COMMAND} +- -DBDIR=${CMAKE_CURRENT_BINARY_DIR} ++ -DBDIR=${CMAKE_CURRENT_BINARY_DIR} ++ -DNETGEN_VERSION_GIT=${NETGEN_VERSION_GIT} + -P ${CMAKE_CURRENT_LIST_DIR}/cmake/generate_version_file.cmake + ) + ####################################################################### diff --git a/vcpkg/ports/netgen/occ-78.patch b/vcpkg/ports/netgen/occ-78.patch new file mode 100644 index 0000000..ba67919 --- /dev/null +++ b/vcpkg/ports/netgen/occ-78.patch @@ -0,0 +1,160 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0846f39bd..f7516afa4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -372,25 +372,20 @@ if (USE_OCC) + TKGeomAlgo + TKGeomBase + TKHLR +- TKIGES + TKLCAF + TKMath + TKMesh + TKOffset + TKPrim +- TKSTEP +- TKSTEP209 +- TKSTEPAttr +- TKSTEPBase +- TKSTL ++ TKDESTL + TKService + TKShHealing + TKTopAlgo + TKV3d + TKVCAF + TKXCAF +- TKXDEIGES +- TKXDESTEP ++ TKDEIGES ++ TKDESTEP + TKXSBase + TKernel + ) +diff --git a/libsrc/occ/Partition_Loop3d.hxx b/libsrc/occ/Partition_Loop3d.hxx +index e1716691c..e8a434911 100644 +--- a/libsrc/occ/Partition_Loop3d.hxx ++++ b/libsrc/occ/Partition_Loop3d.hxx +@@ -10,27 +10,16 @@ + #ifndef _Partition_Loop3d_HeaderFile + #define _Partition_Loop3d_HeaderFile + +-#ifndef _TopTools_ListOfShape_HeaderFile +-#include <TopTools_ListOfShape.hxx> +-#endif +-#ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile +-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> +-#endif +-#ifndef _Standard_Boolean_HeaderFile ++#include <Standard_Version.hxx> + #include <Standard_Boolean.hxx> +-#endif +-#ifndef _Standard_Real_HeaderFile + #include <Standard_Real.hxx> +-#endif +-#ifndef _Standard_Version_HeaderFile +-#include <Standard_Version.hxx> +-#endif ++#include <TopTools_ListOfShape.hxx> ++#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> + +-#if OCC_VERSION_HEX < 0x070000 ++#if OCC_VERSION_HEX < 0x070000 || OCC_VERSION_HEX > 0x070799 + #else + #include <TopTools_ShapeMapHasher.hxx> + #include <TopTools_OrientedShapeMapHasher.hxx> +- #include <TopTools_MapOfOrientedShape.hxx> + #endif + + class TopoDS_Shape; +@@ -38,6 +27,8 @@ class TopoDS_Shape; + #if OCC_VERSION_HEX < 0x070000 + class TopTools_ListOfShape; + class TopTools_MapOfOrientedShape; ++#else ++#include <TopTools_MapOfOrientedShape.hxx> + #endif + + class TopoDS_Edge; +diff --git a/libsrc/occ/occ_edge.cpp b/libsrc/occ/occ_edge.cpp +index 0c907d78b..fd64c9a42 100644 +--- a/libsrc/occ/occ_edge.cpp ++++ b/libsrc/occ/occ_edge.cpp +@@ -55,7 +55,11 @@ namespace netgen + + size_t OCCEdge::GetHash() const + { ++#if OCC_VERSION_HEX < 0x070800 + return edge.HashCode(std::numeric_limits<Standard_Integer>::max()); ++#else ++ return std::hash<TopoDS_Shape>{}(edge); ++#endif + } + + void OCCEdge::ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const +diff --git a/libsrc/occ/occ_face.cpp b/libsrc/occ/occ_face.cpp +index 239982aa8..ea4dd15b4 100644 +--- a/libsrc/occ/occ_face.cpp ++++ b/libsrc/occ/occ_face.cpp +@@ -32,7 +32,11 @@ namespace netgen + + size_t OCCFace::GetHash() const + { ++#if OCC_VERSION_HEX < 0x070800 + return face.HashCode(std::numeric_limits<Standard_Integer>::max()); ++#else ++ return std::hash<TopoDS_Shape>{}(face); ++#endif + } + + Point<3> OCCFace::GetCenter() const +diff --git a/libsrc/occ/occ_solid.hpp b/libsrc/occ/occ_solid.hpp +index d598de4a2..66f28d73a 100644 +--- a/libsrc/occ/occ_solid.hpp ++++ b/libsrc/occ/occ_solid.hpp +@@ -16,8 +16,11 @@ namespace netgen + OCCSolid(TopoDS_Shape dshape) + : solid(TopoDS::Solid(dshape)) + { } +- ++#if OCC_VERSION_HEX < 0x070800 + size_t GetHash() const override { return solid.HashCode(std::numeric_limits<Standard_Integer>::max()); } ++#else ++ size_t GetHash() const override { return std::hash<TopoDS_Solid>{}(solid); } ++#endif + }; + } + +diff --git a/libsrc/occ/occ_vertex.cpp b/libsrc/occ/occ_vertex.cpp +index 6e83c8944..be8e38732 100644 +--- a/libsrc/occ/occ_vertex.cpp ++++ b/libsrc/occ/occ_vertex.cpp +@@ -19,6 +19,10 @@ namespace netgen + + size_t OCCVertex::GetHash() const + { ++#if OCC_VERSION_HEX < 0x070800 + return vertex.HashCode(std::numeric_limits<Standard_Integer>::max()); ++#else ++ return std::hash<TopoDS_Shape>{}(vertex); ++#endif + } + } +diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp +index bc0383f99..826134ba0 100644 +--- a/libsrc/occ/occgeom.cpp ++++ b/libsrc/occ/occgeom.cpp +@@ -1716,9 +1716,13 @@ namespace netgen + /*
+ // enumerate shapes and archive only integers
+ auto my_hash = [](const TopoDS_Shape & key) {
++#if OCC_VERSION_HEX < 0x070800
+ auto occ_hash = key.HashCode(1<<31UL);
+ return std::hash<decltype(occ_hash)>()(occ_hash);
++#else
++ return std::hash<TopoDS_Shape>{}(key);
++#endif
+ }; + */
+ TopTools_IndexedMapOfShape shape_map;
+ Array<TopoDS_Shape> shape_list;
diff --git a/vcpkg/ports/netgen/portfile.cmake b/vcpkg/ports/netgen/portfile.cmake new file mode 100644 index 0000000..da7b16f --- /dev/null +++ b/vcpkg/ports/netgen/portfile.cmake @@ -0,0 +1,108 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO NGSolve/netgen + REF v${VERSION} + SHA512 82095c51f2486d9f2a59d8fd696e305096ef63df5c40fef1fd95a8e8c3eb3735f7be29929105e588b8c1b6d6941d1e4c05f7f09e0d1c866c1105d5c1c064f932 + HEAD_REF master + PATCHES + git-ver.patch + static-exports.patch + cmake-adjustments.patch + vcpkg-fix-cgns-link.patch + cgns-scoped-enum.patch + downstream-fixes.patch + add_filesystem.patch + occ-78.patch + 142.diff + cross-build.patch +) + +set(OPTIONS "") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + list(APPEND OPTIONS + "-DNGLIB_LIBRARY_TYPE=STATIC" + "-DNGCORE_LIBRARY_TYPE=STATIC" + "-DNGGUI_LIBRARY_TYPE=STATIC" + ) + string(APPEND VCPKG_C_FLAGS " -DNGSTATIC_BUILD") + string(APPEND VCPKG_CXX_FLAGS " -DNGSTATIC_BUILD") +endif() + +if(VCPKG_CROSSCOMPILING) + list(APPEND OPTIONS "-DMAKERLS_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/makerls${VCPKG_HOST_EXECUTABLE_SUFFIX}") +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + python USE_PYTHON + cgns USE_CGNS + mpeg USE_MPEG + jpeg USE_JPEG + occ USE_OCC +) + +vcpkg_cmake_configure( + DISABLE_PARALLEL_CONFIGURE + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS ${OPTIONS} + ${FEATURE_OPTIONS} + -DUSE_SPDLOG=OFF # will be vendored otherwise + -DUSE_GUI=OFF + -DPREFER_SYSTEM_PYBIND11=ON + -DENABLE_UNIT_TESTS=OFF + -DUSE_NATIVE_ARCH=OFF + -DUSE_MPI=OFF + -DUSE_SUPERBUILD=OFF + -DNETGEN_VERSION_GIT=v${VERSION} # this variable is patched in via git-ver.patch + -DNG_INSTALL_DIR_CMAKE=lib/cmake/netgen + -DNG_INSTALL_DIR_BIN=bin + -DNG_INSTALL_DIR_LIB=lib + -DNG_INSTALL_DIR_RES=share + -DNG_INSTALL_DIR_INCLUDE=include + -DNG_INSTALL_DIR_PYTHON=${PYTHON3_SITE} + -DSKBUILD=ON +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/netgen) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") + +if(NOT VCPKG_CROSSCOMPILING) + vcpkg_copy_tools(TOOL_NAMES makerls AUTO_CLEAN) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +if(USE_OCC) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/nglib.h" "define NGLIB\n" "define NGLIB\n#define OCCGEOMETRY\n") +endif() +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/nglib.h" "defined(NGSTATIC_BUILD)" "1") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/core/ngcore_api.hpp" "!defined(NGSTATIC_BUILD)" "0") +endif() + +set(config_file "${CURRENT_PACKAGES_DIR}/share/netgen/NetgenConfig.cmake") +file(READ "${config_file}" contents) +string(REPLACE "${SOURCE_PATH}" "NOT-USABLE" contents "${contents}") +string(REPLACE [[${NETGEN_CMAKE_DIR}/../../..]] [[${NETGEN_CMAKE_DIR}/../..]] contents "${contents}") +string(REPLACE [[lib/cmake/netgen]] [[share/netgen]] contents "${contents}") +string(REPLACE [[$<CONFIG:Release>:]] [[$<$<NOT:$<CONFIG:DEBUG>>:]] contents "${contents}") +if(NOT VCPKG_BUILD_TYPE) + string(REPLACE [[/lib/]] [[$<$<CONFIG:DEBUG>:/debug>/lib/]] contents "${contents}") + string(REPLACE [[optimized;${VCPKG_IMPORT_PREFIX}$<$<CONFIG:DEBUG>:/debug>/lib/]] [[optimized;${VCPKG_IMPORT_PREFIX}/lib/]] contents "${contents}") + string(REPLACE [[debug;${VCPKG_IMPORT_PREFIX}/debug$<$<CONFIG:DEBUG>:/debug>/lib/]] [[debug;${VCPKG_IMPORT_PREFIX}/debug/lib/]] contents "${contents}") +endif() +file(WRITE "${config_file}" "${contents}") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +if("python" IN_LIST FEATURES) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/netgen/config.py" "CMAKE_INSTALL_PREFIX = \"${CURRENT_PACKAGES_DIR}" "CMAKE_INSTALL_PREFIX_NOT_USABLE = \"") + if(NOT VCPKG_BUILD_TYPE) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/netgen/config.py" "CMAKE_INSTALL_PREFIX = \"${CURRENT_PACKAGES_DIR}" "CMAKE_INSTALL_PREFIX_NOT_USABLE = \"") + endif() +endif() diff --git a/vcpkg/ports/netgen/static-exports.patch b/vcpkg/ports/netgen/static-exports.patch new file mode 100644 index 0000000..452f14c --- /dev/null +++ b/vcpkg/ports/netgen/static-exports.patch @@ -0,0 +1,38 @@ +diff --git a/libsrc/core/ngcore_api.hpp b/libsrc/core/ngcore_api.hpp +index e66e9b8..4ecaa05 100644 +--- a/libsrc/core/ngcore_api.hpp ++++ b/libsrc/core/ngcore_api.hpp +@@ -35,8 +35,13 @@ + + + #ifdef WIN32 ++#if !defined(NGSTATIC_BUILD) + #define NGCORE_API_EXPORT __declspec(dllexport) + #define NGCORE_API_IMPORT __declspec(dllimport) ++#else ++ #define NGCORE_API_EXPORT ++ #define NGCORE_API_IMPORT ++#endif + #else + #define NGCORE_API_EXPORT __attribute__((visibility("default"))) + #define NGCORE_API_IMPORT __attribute__((visibility("default"))) +diff --git a/nglib/nglib.h b/nglib/nglib.h +index f8c745a..e4587d2 100644 +--- a/nglib/nglib.h ++++ b/nglib/nglib.h +@@ -26,11 +26,15 @@ + // Philippose - 14.02.2009 + // Modifications for creating a DLL in Windows + #ifdef WIN32 ++ #if defined(NGSTATIC_BUILD) ++ #define NGLIB_API ++ #else + #ifdef nglib_EXPORTS + #define NGLIB_API __declspec(dllexport) + #else + #define NGLIB_API __declspec(dllimport) + #endif ++ #endif + #else + #define NGLIB_API __attribute__((visibility("default"))) + #endif diff --git a/vcpkg/ports/netgen/vcpkg-fix-cgns-link.patch b/vcpkg/ports/netgen/vcpkg-fix-cgns-link.patch new file mode 100644 index 0000000..e3fbc22 --- /dev/null +++ b/vcpkg/ports/netgen/vcpkg-fix-cgns-link.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bf92061..933505d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -500,7 +500,7 @@ endif(ENABLE_CPP_CORE_GUIDELINES_CHECK) + + add_library(netgen_cgns INTERFACE) + if(USE_CGNS) +- find_library( CGNS_LIBRARY NAMES cgns cgnsdll ) ++ find_library( CGNS_LIBRARY NAMES cgnsdll cgns) + find_path( CGNS_INCLUDE_DIR cgnslib.h ) + target_compile_definitions(netgen_cgns INTERFACE NG_CGNS) + target_include_directories(netgen_cgns INTERFACE ${CGNS_INCLUDE_DIR}) diff --git a/vcpkg/ports/netgen/vcpkg.json b/vcpkg/ports/netgen/vcpkg.json new file mode 100644 index 0000000..af02013 --- /dev/null +++ b/vcpkg/ports/netgen/vcpkg.json @@ -0,0 +1,70 @@ +{ + "name": "netgen", + "version": "6.2.2401", + "port-version": 2, + "description": "NETGEN is an automatic 3d tetrahedral mesh generator. It accepts input from constructive solid geometry (CSG) or boundary representation (BRep) from STL file format. The connection to a geometry kernel allows the handling of IGES and STEP files. NETGEN contains modules for mesh optimization and hierarchical mesh refinement.", + "homepage": "https://ngsolve.org/", + "license": "LGPL-2.1-or-later", + "supports": "arm64 | x64", + "dependencies": [ + { + "name": "netgen", + "host": true, + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ], + "features": { + "cgns": { + "description": "CGNS file read/write support", + "dependencies": [ + { + "name": "cgns", + "default-features": false + } + ] + }, + "jpeg": { + "description": "enable snapshots using library libjpeg", + "dependencies": [ + "libjpeg-turbo" + ] + }, + "mpeg": { + "description": "enable video recording with FFmpeg", + "dependencies": [ + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "avcodec" + ] + } + ] + }, + "occ": { + "description": "build with OpenCascade geometry kernel interface", + "dependencies": [ + { + "name": "opencascade", + "default-features": false + } + ] + }, + "python": { + "description": "Build python bindings", + "dependencies": [ + "pybind11", + "python3" + ] + } + } +} |