From 981daa4e98f0fbb5267ae80cd9e2cdaca985dc44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Mon, 27 Apr 2020 23:01:31 +0800 Subject: [PATCH] [gts] Support for build with cmake in unix (#10055) * [gts] Support for build with cmake in unix * update baseline * [gts] Apply patch * [gts] Fix undefined M_PI in windows * update baseline --- ports/gts/CONTROL | 2 +- ports/gts/fix-M_PI-in-windows.patch | 28 ++++ ports/gts/portfile.cmake | 9 +- ports/gts/support-unix.patch | 190 ++++++++++++++++++++++++++++ scripts/ci.baseline.txt | 3 +- 5 files changed, 225 insertions(+), 7 deletions(-) create mode 100644 ports/gts/fix-M_PI-in-windows.patch create mode 100644 ports/gts/support-unix.patch diff --git a/ports/gts/CONTROL b/ports/gts/CONTROL index 917d66bf86..3685a47b3a 100644 --- a/ports/gts/CONTROL +++ b/ports/gts/CONTROL @@ -1,5 +1,5 @@ Source: gts -Version: 0.7.6-1 +Version: 0.7.6-2 Homepage: https://github.com/finetjul/gts Description: A Library intended to provide a set of useful functions to deal with 3D surfaces meshed with interconnected triangles Build-Depends: glib diff --git a/ports/gts/fix-M_PI-in-windows.patch b/ports/gts/fix-M_PI-in-windows.patch new file mode 100644 index 0000000000..d573ef080f --- /dev/null +++ b/ports/gts/fix-M_PI-in-windows.patch @@ -0,0 +1,28 @@ +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/portfile.cmake b/ports/gts/portfile.cmake index 71a62e756a..46f3b40b5b 100644 --- a/ports/gts/portfile.cmake +++ b/ports/gts/portfile.cmake @@ -1,13 +1,14 @@ -include(vcpkg_common_functions) - vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO finetjul/gts - REF c4da61ae075f355d9ecc9f2d4767acf777f54c2b + REF c4da61ae075f355d9ecc9f2d4767acf777f54c2b #0.7.6 SHA512 e53d11213c26cbda08ae62e6388aee0a14d2884de72268ad25d10a23e77baa53a2b1151c5cc7643b059ded82b8edf0da79144c3108949fdc515168cac13ffca9 HEAD_REF master + PATCHES + fix-M_PI-in-windows.patch + support-unix.patch ) vcpkg_configure_cmake( @@ -20,6 +21,6 @@ vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # Handle copyright -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gts RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_copy_pdbs() diff --git a/ports/gts/support-unix.patch b/ports/gts/support-unix.patch new file mode 100644 index 0000000000..597b4f5452 --- /dev/null +++ b/ports/gts/support-unix.patch @@ -0,0 +1,190 @@ +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/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 25ed3d64b6..c3cab2c050 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -572,8 +572,6 @@ gsoap:x64-osx=fail gsoap:x86-windows=ignore gtk:x64-linux=fail gtk:x86-windows=ignore -gts:x64-linux=fail -gts:x64-osx=fail guetzli:x64-osx=fail h3:arm64-windows=fail h3:arm-uwp=fail @@ -608,6 +606,7 @@ hypre:x64-osx=fail icu:arm64-windows=fail icu:arm-uwp=fail icu:x64-uwp=fail +ignition-common1:x64-linux=fail ignition-msgs1:arm64-windows=fail ignition-msgs1:arm-uwp=fail ignition-msgs1:x64-uwp=fail