aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/gts
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/gts
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/gts')
-rw-r--r--vcpkg/ports/gts/CMakeLists.txt47
-rw-r--r--vcpkg/ports/gts/fix-dllexport.patch13
-rw-r--r--vcpkg/ports/gts/portfile.cmake29
-rw-r--r--vcpkg/ports/gts/predicates_init.h26
-rw-r--r--vcpkg/ports/gts/usage5
-rw-r--r--vcpkg/ports/gts/vcpkg.json15
6 files changed, 135 insertions, 0 deletions
diff --git a/vcpkg/ports/gts/CMakeLists.txt b/vcpkg/ports/gts/CMakeLists.txt
new file mode 100644
index 0000000..625e354
--- /dev/null
+++ b/vcpkg/ports/gts/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 3.14)
+
+project(gts VERSION "${VERSION}" LANGUAGES C)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GLIB2 glib-2.0 IMPORTED_TARGET)
+
+if(WIN32)
+ add_definitions(-DNATIVE_WIN32 -D_USE_MATH_DEFINES)
+else()
+ include(CheckIncludeFile)
+ check_include_file("fpu_control.h" HAVE_FPU_CONTROL_H)
+ if(HAVE_FPU_CONTROL_H)
+ add_definitions(-DHAVE_FPU_CONTROL_H)
+ endif()
+endif()
+
+add_definitions(
+ -DGTS_COMPILATION
+ -DGTS_MAJOR_VERSION=${PROJECT_VERSION_MAJOR}
+ -DGTS_MINOR_VERSION=${PROJECT_VERSION_MINOR}
+ -DGTS_MICRO_VERSION=${PROJECT_VERSION_PATCH}
+ -DGTS_INTERFACE_AGE=1
+ -DGTS_BINARY_AGE=1
+ -DGTS_VERSION=${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
+)
+
+file(GLOB src src/*.c src/gts.def)
+list(FILTER src EXCLUDE REGEX ".*predicates_init\\.c$")
+add_library(gts ${src})
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "")
+target_include_directories(gts PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:include>
+)
+target_link_libraries(gts PUBLIC PkgConfig::GLIB2)
+
+set(prefix ?)
+set(exec_prefix \${prefix})
+set(libdir \${prefix}/lib)
+set(includedir \${prefix}/include)
+configure_file(gts.pc.in gts.pc @ONLY)
+
+install(FILES src/gts.h src/gtsconfig.h DESTINATION include)
+install(TARGETS gts)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gts.pc" DESTINATION lib/pkgconfig)
diff --git a/vcpkg/ports/gts/fix-dllexport.patch b/vcpkg/ports/gts/fix-dllexport.patch
new file mode 100644
index 0000000..dd9eb17
--- /dev/null
+++ b/vcpkg/ports/gts/fix-dllexport.patch
@@ -0,0 +1,13 @@
+diff --git a/src/gts.h b/src/gts.h
+index 1b76915..ae1d888 100644
+--- a/src/gts.h
++++ b/src/gts.h
+@@ -38,7 +38,7 @@ extern "C" {
+ * we prefix variable declarations so they can
+ * properly get exported in windows dlls.
+ */
+-#ifdef NATIVE_WIN32
++#if 0
+ # ifdef GTS_COMPILATION
+ # define GTS_C_VAR __declspec(dllexport)
+ # else /* not GTS_COMPILATION */
diff --git a/vcpkg/ports/gts/portfile.cmake b/vcpkg/ports/gts/portfile.cmake
new file mode 100644
index 0000000..4695d9e
--- /dev/null
+++ b/vcpkg/ports/gts/portfile.cmake
@@ -0,0 +1,29 @@
+vcpkg_from_sourceforge(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO gts/gts
+ REF 0.7.6
+ FILENAME gts-0.7.6.tar.gz
+ SHA512 645123b72dba3d04dad3c5d936d7e55947826be0fb25e84595368919b720deccddceb7c3b30865a5a40f2458254c2af793b7c014e6719cf07e7f8e6ff30890f8
+ PATCHES
+ fix-dllexport.patch
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/predicates_init.h" DESTINATION "${SOURCE_PATH}/src")
+
+vcpkg_find_acquire_program(PKGCONFIG)
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
+ "-DVERSION=${VERSION}"
+)
+
+vcpkg_cmake_install()
+vcpkg_fixup_pkgconfig()
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/gts/predicates_init.h b/vcpkg/ports/gts/predicates_init.h
new file mode 100644
index 0000000..059ecf6
--- /dev/null
+++ b/vcpkg/ports/gts/predicates_init.h
@@ -0,0 +1,26 @@
+/* This file was generated automatically by predicates_init
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+static double splitter = 134217729.000000;
+static double resulterrbound = 3.330669073875471e-16;
+static double ccwerrboundA = 3.330669073875472e-16;
+static double ccwerrboundB = 2.220446049250315e-16;
+static double ccwerrboundC = 1.109335647967049e-31;
+static double o3derrboundA = 7.771561172376103e-16;
+static double o3derrboundB = 3.330669073875473e-16;
+static double o3derrboundC = 3.204747427460364e-31;
+static double iccerrboundA = 1.110223024625158e-15;
+static double iccerrboundB = 4.440892098500632e-16;
+static double iccerrboundC = 5.423418723394464e-31;
+static double isperrboundA = 1.776356839400253e-15;
+static double isperrboundB = 5.551115123125792e-16;
+static double isperrboundC = 8.751425667295619e-31;
diff --git a/vcpkg/ports/gts/usage b/vcpkg/ports/gts/usage
new file mode 100644
index 0000000..f3acd86
--- /dev/null
+++ b/vcpkg/ports/gts/usage
@@ -0,0 +1,5 @@
+gts can be imported via CMake FindPkgConfig module:
+
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(GTS gts REQUIRED IMPORTED_TARGET)
+ target_link_libraries(main PRIVATE PkgConfig::GTS)
diff --git a/vcpkg/ports/gts/vcpkg.json b/vcpkg/ports/gts/vcpkg.json
new file mode 100644
index 0000000..9c0cc81
--- /dev/null
+++ b/vcpkg/ports/gts/vcpkg.json
@@ -0,0 +1,15 @@
+{
+ "name": "gts",
+ "version": "0.7.6",
+ "port-version": 9,
+ "description": "3D surfaces meshed with interconnected triangles",
+ "homepage": "https://gts.sourceforge.net/",
+ "license": "LGPL-2.0-or-later",
+ "dependencies": [
+ "glib",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}