diff --git a/ports/gts/CMakeLists.txt b/ports/gts/CMakeLists.txt new file mode 100644 index 00000000000000..295c0c6f7e31d5 --- /dev/null +++ b/ports/gts/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.14) + +project(gts 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() + add_definitions(-DHAVE_FPU_CONTROL_H) +endif() + +add_definitions( + -DGTS_COMPILATION + -DGTS_MAJOR_VERSION=0 + -DGTS_MINOR_VERSION=7 + -DGTS_MICRO_VERSION=6 + -DGTS_INTERFACE_AGE=1 + -DGTS_BINARY_AGE=1 + -DGTS_VERSION=${GTS_MAJOR_VERSION}.${GTS_MINOR_VERSION}.${GTS_MICRO_VERSION} +) + +file(GLOB src src/*.c src/gts.def) +list(REMOVE_ITEM src src/predicate_init.c) +add_library(gts ${src}) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "") +target_include_directories(gts PUBLIC + $ + $ + $ +) +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/ports/gts/fix-M_PI-in-windows.patch b/ports/gts/fix-M_PI-in-windows.patch deleted file mode 100644 index d573ef080ff918..00000000000000 --- a/ports/gts/fix-M_PI-in-windows.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/curvature.c b/src/curvature.c -index 70f6af2..a5c0187 100644 ---- a/src/curvature.c -+++ b/src/curvature.c -@@ -17,6 +17,9 @@ - * Boston, MA 02111-1307, USA. - */ - -+#ifdef _WIN32 -+#define _USE_MATH_DEFINES -+#endif - #include - #include "gts.h" - -diff --git a/src/triangle.c b/src/triangle.c -index 1d82869..47170c6 100644 ---- a/src/triangle.c -+++ b/src/triangle.c -@@ -17,6 +17,9 @@ - * Boston, MA 02111-1307, USA. - */ - -+#ifdef _WIN32 -+#define _USE_MATH_DEFINES -+#endif - #include - #include "gts.h" - diff --git a/ports/gts/fix-dllexport.patch b/ports/gts/fix-dllexport.patch new file mode 100644 index 00000000000000..dd9eb175e7545f --- /dev/null +++ b/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/ports/gts/fix-pkgconfig.patch b/ports/gts/fix-pkgconfig.patch deleted file mode 100644 index 59deeca22fd57b..00000000000000 --- a/ports/gts/fix-pkgconfig.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f458c35..8035507 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -124,3 +124,11 @@ INSTALL(FILES - src/gtsconfig.h - DESTINATION include COMPONENT Development - ) -+ -+set(prefix ${CMAKE_INSTALL_PREFIX}) -+set(exec_prefix ${CMAKE_INSTALL_PREFIX}) -+set(libdir ${CMAKE_INSTALL_PREFIX}/lib) -+set(includedir ${CMAKE_INSTALL_PREFIX}/include) -+ -+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/gts.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/gts.pc" @ONLY) -+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gts.pc" DESTINATION lib/pkgconfig) -\ No newline at end of file -diff --git a/gts.pc.in b/gts.pc.in -index 39626d7..bcd4014 100644 ---- a/gts.pc.in -+++ b/gts.pc.in -@@ -7,5 +7,5 @@ Name: GTS - Description: GNU Triangulated Surface Library - Version: @VERSION@ - Requires: glib-2.0,gthread-2.0,gmodule-2.0 --Libs: -L${libdir} @LIBS@ -lgts -lm -+Libs: -L${libdir} @LIBS@ -lgts - Cflags: -I${includedir} diff --git a/ports/gts/glib2.patch b/ports/gts/glib2.patch deleted file mode 100644 index 60de77c70d9e16..00000000000000 --- a/ports/gts/glib2.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 941e9b96b..ea031828d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -85,30 +85,35 @@ include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/src - ) - --find_library(glib_LIBRARY NAMES glib libglib glib-2.0 libglib-2.0 -- HINTS ${glib_BINARY_DIR}) -+find_package(PkgConfig REQUIRED) -+pkg_check_modules(GLIB2 glib-2.0 IMPORTED_TARGET) - --get_filename_component(glib_LIBRARY_DIR ${glib_LIBRARY} DIRECTORY) --get_filename_component(glib_LIBRARY_NAME ${glib_LIBRARY} NAME) --string(REGEX REPLACE "\\.[^.]*$" "" glib_LIBRARY_NAME ${glib_LIBRARY_NAME}) -+# find_library(glib_LIBRARY NAMES glib libglib glib-2.0 libglib-2.0 -+ # HINTS ${glib_BINARY_DIR}) - --find_path(glib_H NAMES glib.h -- HINTS ${glib_LIBRARY_DIR}/../include) --get_filename_component(glib_INCLUDE_DIR ${glib_H} DIRECTORY) -+# get_filename_component(glib_LIBRARY_DIR ${glib_LIBRARY} DIRECTORY) -+# get_filename_component(glib_LIBRARY_NAME ${glib_LIBRARY} NAME) -+# string(REGEX REPLACE "\\.[^.]*$" "" glib_LIBRARY_NAME ${glib_LIBRARY_NAME}) - --set(glib_CONFIG_H) --find_path(glib_CONFIG_H NAMES glibconfig.h -- HINTS ${glib_LIBRARY_DIR}/${glib_LIBRARY_NAME}/include) -+# find_path(glib_H NAMES glib.h -+ # HINTS ${glib_LIBRARY_DIR}/../include) -+# get_filename_component(glib_INCLUDE_DIR ${glib_H} DIRECTORY) - --get_filename_component(glibconfig_INCLUDE_DIR ${glib_CONFIG_H} DIRECTORY) --include_directories(${glib_INCLUDE_DIR} ${glib_CONFIG_H}) -+# set(glib_CONFIG_H) -+# find_path(glib_CONFIG_H NAMES glibconfig.h -+ # HINTS ${glib_LIBRARY_DIR}/${glib_LIBRARY_NAME}/include) -+ -+# get_filename_component(glibconfig_INCLUDE_DIR ${glib_CONFIG_H} DIRECTORY) -+# include_directories(${glib_INCLUDE_DIR} ${glib_CONFIG_H}) -+include_directories(${GLIB2_INCLUDE_DIRS}) - - if (NOT WIN32 AND BUILD_SHARED_LIBS) - add_definitions(/DGTS_COMPILATION) - endif() - - add_library(${kit} SHARED ${srcs}) --target_link_libraries(${kit} ${glib_LIBRARY}) -+target_include_directories(${kit} PUBLIC ${GLIB2_INCLUDE_DIRS}) -+target_link_libraries(${kit} PkgConfig::GLIB2) - - if(MSVC) - SET_TARGET_PROPERTIES(${kit} PROPERTIES LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_SOURCE_DIR}/src/gts.def\"") diff --git a/ports/gts/portfile.cmake b/ports/gts/portfile.cmake index 98ea07a8fab5ae..62613257e719b7 100644 --- a/ports/gts/portfile.cmake +++ b/ports/gts/portfile.cmake @@ -1,29 +1,34 @@ -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(patches fix-dllexport.patch) +else() + set(patches "") +endif() -vcpkg_from_github( +vcpkg_from_sourceforge( OUT_SOURCE_PATH SOURCE_PATH - REPO finetjul/gts - REF c4da61ae075f355d9ecc9f2d4767acf777f54c2b #0.7.6 - SHA512 e53d11213c26cbda08ae62e6388aee0a14d2884de72268ad25d10a23e77baa53a2b1151c5cc7643b059ded82b8edf0da79144c3108949fdc515168cac13ffca9 - HEAD_REF master - PATCHES - fix-M_PI-in-windows.patch - support-unix.patch - fix-pkgconfig.patch - glib2.patch + REPO gts/gts + REF 0.7.6 + FILENAME gts-0.7.6.tar.gz + SHA512 645123b72dba3d04dad3c5d936d7e55947826be0fb25e84595368919b720deccddceb7c3b30865a5a40f2458254c2af793b7c014e6719cf07e7f8e6ff30890f8 + PATCHES ${patches} ) + +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_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DPKG_CONFIG_EXECUTABLE=${PKGCONFIG} + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" ) -vcpkg_install_cmake() +vcpkg_cmake_install() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") vcpkg_fixup_pkgconfig() vcpkg_copy_pdbs() -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/gts/predicates_init.h b/ports/gts/predicates_init.h new file mode 100644 index 00000000000000..059ecf6ffb3989 --- /dev/null +++ b/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/ports/gts/support-unix.patch b/ports/gts/support-unix.patch deleted file mode 100644 index 597b4f54520004..00000000000000 --- a/ports/gts/support-unix.patch +++ /dev/null @@ -1,190 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c35100c..f458c35 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1) - add_executable(predicates_init src/predicates_init.c) - - execute_process( -- COMMAND predicates_init.exe -+ COMMAND predicates_init - OUTPUT_FILE predicates_init.h - OUTPUT_VARIABLE OUTVAR) - -@@ -12,6 +12,31 @@ MESSAGE("${OUTVAR}") - set(kit gts) - project(${kit}) - -+if (NOT WIN32) -+ set(CPP_HAS_WARNING 1) -+ set(HAVE_DLFCN_H 1) -+ set(HAVE_FLOATINGPOINT_H 1) -+ set(HAVE_FPU_CONTROL_H 1) -+ set(HAVE_GETOPT_H 1) -+ set(HAVE_GETOPT_LONG 1) -+ set(HAVE_INTTYPES_H 1) -+ set(HAVE_MEMORY_H 1) -+ set(HAVE_STDINT_H 1) -+ set(HAVE_STDLIB_H 1) -+ set(HAVE_STRINGS_H 1) -+ set(HAVE_STRING_H 1) -+ set(HAVE_SYS_STAT_H 1) -+ set(HAVE_SYS_TYPES_H 1) -+ set(HAVE_UNISTD_H 1) -+ set(PACKAGE_BUGREPORT 0) -+ set(PACKAGE_NAME "gts") -+ set(PACKAGE_STRING "0.7.6") -+ set(PACKAGE_TARNAME "gts") -+ set(PACKAGE_URL "") -+ set(PACKAGE_VERSION "0.7.6") -+ set(STDC_HEADERS) -+endif() -+ - set(srcs - src/bbtree.c - src/boolean.c -@@ -49,7 +74,11 @@ set(srcs - src/vopt.c - ) - -+if (WIN32) - configure_file(src/config.h.win32 config.h) -+else() -+configure_file(config.h.in config.h @ONLY) -+endif() - - SET(CMAKE_INCLUDE_CURRENT_DIR ON) - include_directories( -@@ -74,7 +103,9 @@ find_path(glib_CONFIG_H NAMES glibconfig.h - get_filename_component(glibconfig_INCLUDE_DIR ${glib_CONFIG_H} DIRECTORY) - include_directories(${glib_INCLUDE_DIR} ${glib_CONFIG_H}) - -+if (NOT WIN32 AND BUILD_SHARED_LIBS) - add_definitions(/DGTS_COMPILATION) -+endif() - - add_library(${kit} SHARED ${srcs}) - target_link_libraries(${kit} ${glib_LIBRARY}) -diff --git a/config.h.in b/config.h.in -index ad95945..fe6c945 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -1,89 +1,89 @@ - /* config.h.in. Generated from configure.ac by autoheader. */ - - /* Define if C preprocessor supports warning directive. */ --#undef CPP_HAS_WARNING -+#cmakedefine CPP_HAS_WARNING @CPP_HAS_WARNING@ - - /* Binary age */ --#undef GTS_BINARY_AGE -+#define GTS_BINARY_AGE 0 - - /* Interface age */ --#undef GTS_INTERFACE_AGE -+#define GTS_INTERFACE_AGE 0 - - /* Major version */ --#undef GTS_MAJOR_VERSION -+#define GTS_MAJOR_VERSION 0 - - /* Micro version */ --#undef GTS_MICRO_VERSION -+#define GTS_MICRO_VERSION 0 - - /* Minor version */ --#undef GTS_MINOR_VERSION -+#define GTS_MINOR_VERSION 6 - - /* Define to 1 if you have the header file. */ --#undef HAVE_DLFCN_H -+#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_FLOATINGPOINT_H -+#cmakedefine HAVE_FLOATINGPOINT_H @HAVE_FLOATINGPOINT_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_FPU_CONTROL_H -+#cmakedefine HAVE_FPU_CONTROL_H @HAVE_FPU_CONTROL_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_GETOPT_H -+#cmakedefine HAVE_GETOPT_H @HAVE_GETOPT_H@ - - /* Define to 1 if you have the `getopt_long' function. */ --#undef HAVE_GETOPT_LONG -+#cmakedefine HAVE_GETOPT_LONG @HAVE_GETOPT_LONG@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_INTTYPES_H -+#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_MEMORY_H -+#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_STDINT_H -+#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_STDLIB_H -+#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_STRINGS_H -+#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_STRING_H -+#cmakedefine HAVE_STRING_H @HAVE_STRING_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_SYS_STAT_H -+#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_SYS_TYPES_H -+#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ - - /* Define to 1 if you have the header file. */ --#undef HAVE_UNISTD_H -+#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ - - /* Define to the sub-directory in which libtool stores uninstalled libraries. - */ --#undef LT_OBJDIR -+#cmakedefine LT_OBJDIR @LT_OBJDIR@ - - /* Define if netpbm include files are in netpbm/. */ --#undef NETPBM_INCLUDE -+#cmakedefine NETPBM_INCLUDE @NETPBM_INCLUDE@ - - /* Define to the address where bug reports for this package should be sent. */ --#undef PACKAGE_BUGREPORT -+#cmakedefine PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@ - - /* Define to the full name of this package. */ --#undef PACKAGE_NAME -+#cmakedefine PACKAGE_NAME @PACKAGE_NAME@ - - /* Define to the full name and version of this package. */ --#undef PACKAGE_STRING -+#cmakedefine PACKAGE_STRING @PACKAGE_STRING@ - - /* Define to the one symbol short name of this package. */ --#undef PACKAGE_TARNAME -+#cmakedefine PACKAGE_TARNAME @PACKAGE_TARNAME@ - - /* Define to the home page for this package. */ --#undef PACKAGE_URL -+#cmakedefine PACKAGE_URL @PACKAGE_URL@ - - /* Define to the version of this package. */ --#undef PACKAGE_VERSION -+#cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@ - - /* Define to 1 if you have the ANSI C header files. */ --#undef STDC_HEADERS -+#cmakedefine STDC_HEADERS @STDC_HEADERS@ diff --git a/ports/gts/usage b/ports/gts/usage new file mode 100644 index 00000000000000..ccd803ef83d9b9 --- /dev/null +++ b/ports/gts/usage @@ -0,0 +1,6 @@ +The port gts supports consumption from CMake: + + find_package(PkgConfig REQUIRED) + pkg_check_modules(GTS gts REQUIRED) + target_compile_options(main PRIVATE ${GTS_CFLAGS}) + target_link_libraries(main PRIVATE ${GTS_LDFLAGS}) diff --git a/ports/gts/vcpkg.json b/ports/gts/vcpkg.json index 45de1e6a448c62..a8189837222cc9 100644 --- a/ports/gts/vcpkg.json +++ b/ports/gts/vcpkg.json @@ -1,10 +1,14 @@ { "name": "gts", "version": "0.7.6", - "port-version": 4, - "description": "A Library intended to provide a set of useful functions to deal with 3D surfaces meshed with interconnected triangles", - "homepage": "https://github.com/finetjul/gts", + "port-version": 5, + "description": "3D surfaces meshed with interconnected triangles", + "homepage": "http://gts.sourceforge.net/", "dependencies": [ - "glib" + "glib", + { + "name": "vcpkg-cmake", + "host": true + } ] } diff --git a/versions/baseline.json b/versions/baseline.json index 17f604404b049f..db4f886cfdbc64 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2702,7 +2702,7 @@ }, "gts": { "baseline": "0.7.6", - "port-version": 4 + "port-version": 5 }, "guetzli": { "baseline": "2020-09-14", diff --git a/versions/g-/gts.json b/versions/g-/gts.json index 3ac6eb676ddb94..d75db7104492b3 100644 --- a/versions/g-/gts.json +++ b/versions/g-/gts.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "90471122b5c6aa2ce7566b25b06d9f0b858c482e", + "version": "0.7.6", + "port-version": 5 + }, { "git-tree": "e2e045b3685112306e5fcbd493ea6f97fb35a501", "version": "0.7.6",