[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
This commit is contained in:
Jack·Boos·Yu 2020-04-27 23:01:31 +08:00 committed by GitHub
parent ce08802d88
commit 981daa4e98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 225 additions and 7 deletions

View File

@ -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

View File

@ -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 <math.h>
#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 <math.h>
#include "gts.h"

View File

@ -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()

View File

@ -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 <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
+#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@
/* Define to 1 if you have the <floatingpoint.h> header file. */
-#undef HAVE_FLOATINGPOINT_H
+#cmakedefine HAVE_FLOATINGPOINT_H @HAVE_FLOATINGPOINT_H@
/* Define to 1 if you have the <fpu_control.h> header file. */
-#undef HAVE_FPU_CONTROL_H
+#cmakedefine HAVE_FPU_CONTROL_H @HAVE_FPU_CONTROL_H@
/* Define to 1 if you have the <getopt.h> 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 <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
+#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@
/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
+#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@
/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
+#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@
/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
+#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@
/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
+#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@
/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
+#cmakedefine HAVE_STRING_H @HAVE_STRING_H@
/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
+#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@
/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
+#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@
/* Define to 1 if you have the <unistd.h> 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@

View File

@ -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