mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:19:01 +08:00
[netgen] Optional features to reduce dependencies (#37950)
<!-- If your PR fixes issues, please note that here by adding "Fixes #NNNNNN." for each fixed issue on separate lines. --> <!-- If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/. --> - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - ~~[ ] SHA512s are updated for each updated download.~~ - ~~[ ] The "supports" clause reflects platforms that may be fixed by this new version.~~ - ~~[ ] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file.~~ - ~~[ ] Any patches that are no longer applied are deleted from the port's directory.~~ - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. Also: - fixes Android compilation which wasn't tested the last time this port was modified - Exclude `uwp` which was indirectly excluded by another optional dependency --------- Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
parent
605af532b9
commit
ea0ae162c3
64
ports/netgen/cross-build.patch
Normal file
64
ports/netgen/cross-build.patch
Normal file
@ -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
|
@ -14,8 +14,10 @@ vcpkg_from_github(
|
||||
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"
|
||||
@ -26,9 +28,17 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
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(
|
||||
@ -36,10 +46,6 @@ vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS ${OPTIONS}
|
||||
${FEATURE_OPTIONS}
|
||||
-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
|
||||
@ -62,31 +68,38 @@ 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/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}")
|
||||
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 [[/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()
|
||||
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")
|
||||
|
||||
if("python" IN_LIST FEATURES)
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/netgen/config.py" "CMAKE_INSTALL_PREFIX[^\n]+" "")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/netgen/config.py" "CMAKE_INSTALL_PREFIX = \"${CURRENT_PACKAGES_DIR}" "CMAKE_INSTALL_PREFIX_NOT_USABLE = \"")
|
||||
endif()
|
||||
|
@ -1,25 +1,15 @@
|
||||
{
|
||||
"name": "netgen",
|
||||
"version": "6.2.2401",
|
||||
"port-version": 1,
|
||||
"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",
|
||||
"name": "netgen",
|
||||
"host": true,
|
||||
"default-features": false
|
||||
},
|
||||
{
|
||||
@ -33,6 +23,42 @@
|
||||
"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": [
|
||||
|
1
scripts/test_ports/vcpkg-ci-netgen/portfile.cmake
Normal file
1
scripts/test_ports/vcpkg-ci-netgen/portfile.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
17
scripts/test_ports/vcpkg-ci-netgen/vcpkg.json
Normal file
17
scripts/test_ports/vcpkg-ci-netgen/vcpkg.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "vcpkg-ci-netgen",
|
||||
"version-string": "ci",
|
||||
"description": "Force non-default features of netgen within vcpkg CI",
|
||||
"homepage": "https://github.com/microsoft/vcpkg",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "netgen",
|
||||
"features": [
|
||||
"cgns",
|
||||
"jpeg",
|
||||
"mpeg",
|
||||
"occ"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -6094,7 +6094,7 @@
|
||||
},
|
||||
"netgen": {
|
||||
"baseline": "6.2.2401",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"nethost": {
|
||||
"baseline": "8.0.3",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "5f32bd93d58e5c5057f30d3564fa0a9b808498d6",
|
||||
"version": "6.2.2401",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "289792b9ef5239988ae4c6a418fadfb59fadda5f",
|
||||
"version": "6.2.2401",
|
||||
|
Loading…
Reference in New Issue
Block a user