mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
[netgen] add new port (#31288)
* [netgen] add new port * v db * fix config path for linux * v db * add supports * figure out CI error * fix the path correctly * v db * fix install layout * v db * more cleanup * v db * fix cmake usage and missing filesystem include * v db * disable parallel configure * v db * update to latest tag * v db * control cmake install loc * v db * more install control for mac * v db * more mac fixes * v db * remove old version * replace cgns patch * v db --------- Co-authored-by: vzhli17 <v-zhli17@microsoft.com>
This commit is contained in:
parent
67e366d850
commit
763a397e30
12
ports/netgen/add_filesystem.patch
Normal file
12
ports/netgen/add_filesystem.patch
Normal file
@ -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"
|
69
ports/netgen/cgns-scoped-enum.patch
Normal file
69
ports/netgen/cgns-scoped-enum.patch
Normal file
@ -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];
|
14
ports/netgen/cmake-adjustments.patch
Normal file
14
ports/netgen/cmake-adjustments.patch
Normal file
@ -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)
|
||||
|
25
ports/netgen/downstream-fixes.patch
Normal file
25
ports/netgen/downstream-fixes.patch
Normal file
@ -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;
|
14
ports/netgen/git-ver.patch
Normal file
14
ports/netgen/git-ver.patch
Normal file
@ -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
|
||||
)
|
||||
#######################################################################
|
80
ports/netgen/portfile.cmake
Normal file
80
ports/netgen/portfile.cmake
Normal file
@ -0,0 +1,80 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO NGSolve/netgen
|
||||
REF v${VERSION}
|
||||
SHA512 647ccc0f1990918330457c2d014f243791e7dae8f9ec91880dbab714fa9b2e9b030387958fe74e94a9b4988c3d185c251c5c47764d587826d6d56277658b57d9
|
||||
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
|
||||
)
|
||||
|
||||
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()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
DISABLE_PARALLEL_CONFIGURE
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS ${OPTIONS}
|
||||
-DUSE_PYTHON=OFF
|
||||
-DUSE_JPEG=ON
|
||||
-DUSE_CGNS=ON
|
||||
-DUSE_OCC=ON
|
||||
-DUSE_MPEG=ON
|
||||
-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
|
||||
-DSKBUILD=ON
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/netgen)
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
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/nglib.h" "define NGLIB" "define NGLIB\n#define OCCGEOMETRY\n#define JPEGLIB\n#define FFMPEG\n")
|
||||
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(REGEX REPLACE "\\\$<\\\$<CONFIG:Release>:([^>]+)>" "\\1" contents "${contents}")
|
||||
string(REPLACE "\${NETGEN_CMAKE_DIR}/../" "\${NETGEN_CMAKE_DIR}/../../" contents "${contents}")
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
string(REPLACE "/lib" "$<$<CONFIG:DEBUG>:/debug>/lib" contents "${contents}")
|
||||
endif()
|
||||
string(REGEX REPLACE "$<CONFIG:Release>:([^>]+)>" "\\1" contents "${contents}")
|
||||
file(WRITE "${config_file}" "${contents}")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/netgen/NetgenConfig.cmake" "${SOURCE_PATH}" "NOT-USABLE")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
38
ports/netgen/static-exports.patch
Normal file
38
ports/netgen/static-exports.patch
Normal file
@ -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
|
13
ports/netgen/vcpkg-fix-cgns-link.patch
Normal file
13
ports/netgen/vcpkg-fix-cgns-link.patch
Normal file
@ -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})
|
35
ports/netgen/vcpkg.json
Normal file
35
ports/netgen/vcpkg.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "netgen",
|
||||
"version": "6.2.2307",
|
||||
"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": "cgns",
|
||||
"default-features": false
|
||||
},
|
||||
{
|
||||
"name": "ffmpeg",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"avcodec"
|
||||
]
|
||||
},
|
||||
"libjpeg-turbo",
|
||||
{
|
||||
"name": "opencascade",
|
||||
"default-features": false
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
"zlib"
|
||||
]
|
||||
}
|
@ -5948,6 +5948,10 @@
|
||||
"baseline": "4.3.1",
|
||||
"port-version": 5
|
||||
},
|
||||
"netgen": {
|
||||
"baseline": "6.2.2307",
|
||||
"port-version": 0
|
||||
},
|
||||
"nethost": {
|
||||
"baseline": "8.0.0",
|
||||
"port-version": 0
|
||||
|
9
versions/n-/netgen.json
Normal file
9
versions/n-/netgen.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "9326bf9f2364487f83d80a4b594e469db805a511",
|
||||
"version": "6.2.2307",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user