From 93c3bb1bafa3f44a76cc800cc5ced51a88d1ac60 Mon Sep 17 00:00:00 2001 From: Chao Jia Date: Tue, 19 Nov 2019 12:03:20 +0100 Subject: [rply]new port --- ports/rply/CMakeLists.txt | 63 ++++++++ ports/rply/CONTROL | 3 + ports/rply/export_functions.patch | 305 ++++++++++++++++++++++++++++++++++++++ ports/rply/portfile.cmake | 33 +++++ ports/rply/rply-config.cmake.in | 8 + 5 files changed, 412 insertions(+) create mode 100644 ports/rply/CMakeLists.txt create mode 100644 ports/rply/CONTROL create mode 100644 ports/rply/export_functions.patch create mode 100644 ports/rply/portfile.cmake create mode 100644 ports/rply/rply-config.cmake.in diff --git a/ports/rply/CMakeLists.txt b/ports/rply/CMakeLists.txt new file mode 100644 index 000000000..1ba75b857 --- /dev/null +++ b/ports/rply/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required (VERSION 3.14) +project ("rply") +set (target_name ${CMAKE_PROJECT_NAME}) +set (target_include_prefix "rply") + +option (BUILD_SHARED_LIBS "Create ${target_name} as a shared library" ON) + +set (CMAKE_DEBUG_POSTFIX "d" CACHE STRING "postfix for debug lib") + +include (GNUInstallDirs) + +file (GLOB target_headers "*.h") +file (GLOB target_srcs "*.c" ) +add_library (${target_name} ${target_srcs} ${target_headers}) + +target_include_directories (${target_name} + PUBLIC $ +) + +if (MSVC) + target_compile_definitions (${target_name} PRIVATE RPLY_BUILD_LIB) +endif () + +if (BUILD_SHARED_LIBS) + target_compile_definitions (${target_name} PUBLIC RPLY_SHARED_LIB) +endif () + +set_target_properties(${target_name} PROPERTIES + C_STANDARD 11 +) + +if (MSVC) + set_target_properties(${target_name} PROPERTIES + VS_DEBUGGER_WORKING_DIRECTORY $ + ) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${target_name}) +endif() + +message (STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") + +install (TARGETS ${target_name} EXPORT ${target_name}-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +install (FILES ${target_headers} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${target_name}" + CONFIGURATIONS Release +) + +install (EXPORT ${target_name}-targets + FILE ${target_name}-targets.cmake + NAMESPACE ${target_name}:: + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${target_name}" +) + +configure_file(${target_name}-config.cmake.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target_name}-config.cmake" @ONLY) + +install(FILES + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target_name}-config.cmake" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${target_name}" +) diff --git a/ports/rply/CONTROL b/ports/rply/CONTROL new file mode 100644 index 000000000..fad3d589f --- /dev/null +++ b/ports/rply/CONTROL @@ -0,0 +1,3 @@ +Source: rply +Version: 1.1.4 +Description: ANSI C Library for PLY file format input and output diff --git a/ports/rply/export_functions.patch b/ports/rply/export_functions.patch new file mode 100644 index 000000000..e86522167 --- /dev/null +++ b/ports/rply/export_functions.patch @@ -0,0 +1,305 @@ +diff --git a/rply.h b/rply.h +index 9fa6da9..2e2a0c5 100644 +--- a/rply.h ++++ b/rply.h +@@ -1,5 +1,5 @@ +-#ifndef RPLY_H +-#define RPLY_H ++#pragma once ++ + /* ---------------------------------------------------------------------- + * RPly library, read/write PLY files + * Diego Nehab, IMPA +@@ -9,6 +9,19 @@ + * at the end of this file. + * ---------------------------------------------------------------------- */ + ++#ifdef RPLY_SHARED_LIB ++ ++#ifdef RPLY_BUILD_LIB ++#define RPLY_DLL_DEF __declspec(dllexport) ++#else ++#define RPLY_DLL_DEF __declspec(dllimport) ++#endif // RPLY_BUILD_LIB ++ ++#else ++#define RPLY_DLL_DEF ++#endif // RPLY_SHARED_LIB ++ ++ + #ifdef __cplusplus + extern "C" { + #endif +@@ -57,6 +70,8 @@ typedef void (*p_ply_error_cb)(p_ply ply, const char *message); + * ply: handle returned by ply_open or ply_create + * idata,pdata: contextual information set in ply_open or ply_create + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata); + + /* ---------------------------------------------------------------------- +@@ -68,6 +83,8 @@ int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata); + * + * Returns 1 if successful, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, + void *pdata); + +@@ -78,6 +95,8 @@ p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_read_header(p_ply ply); + + /* ---------------------------------------------------------------------- +@@ -101,6 +120,8 @@ typedef int (*p_ply_read_cb)(p_ply_argument argument); + * Returns 0 if no element or no property in element, returns the + * number of element instances otherwise. + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + long ply_set_read_cb(p_ply ply, const char *element_name, + const char *property_name, p_ply_read_cb read_cb, + void *pdata, long idata); +@@ -115,6 +136,8 @@ long ply_set_read_cb(p_ply ply, const char *element_name, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_get_argument_element(p_ply_argument argument, + p_ply_element *element, long *instance_index); + +@@ -128,6 +151,8 @@ int ply_get_argument_element(p_ply_argument argument, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_get_argument_property(p_ply_argument argument, + p_ply_property *property, long *length, long *value_index); + +@@ -139,6 +164,8 @@ int ply_get_argument_property(p_ply_argument argument, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_get_argument_user_data(p_ply_argument argument, void **pdata, + long *idata); + +@@ -149,6 +176,8 @@ int ply_get_argument_user_data(p_ply_argument argument, void **pdata, + * + * Returns the current data item + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + double ply_get_argument_value(p_ply_argument argument); + + /* ---------------------------------------------------------------------- +@@ -159,6 +188,8 @@ double ply_get_argument_value(p_ply_argument argument); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_read(p_ply ply); + + /* ---------------------------------------------------------------------- +@@ -170,6 +201,8 @@ int ply_read(p_ply ply); + * + * Returns element if successfull or NULL if no more elements + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + p_ply_element ply_get_next_element(p_ply ply, p_ply_element last); + + /* ---------------------------------------------------------------------- +@@ -181,6 +214,8 @@ p_ply_element ply_get_next_element(p_ply ply, p_ply_element last); + * + * Returns comment if successfull or NULL if no more comments + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + const char *ply_get_next_comment(p_ply ply, const char *last); + + /* ---------------------------------------------------------------------- +@@ -192,6 +227,8 @@ const char *ply_get_next_comment(p_ply ply, const char *last); + * + * Returns obj_info if successfull or NULL if no more obj_infos + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + const char *ply_get_next_obj_info(p_ply ply, const char *last); + + /* ---------------------------------------------------------------------- +@@ -203,6 +240,8 @@ const char *ply_get_next_obj_info(p_ply ply, const char *last); + * + * Returns 1 if successfull or 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_get_element_info(p_ply_element element, const char** name, + long *ninstances); + +@@ -215,6 +254,8 @@ int ply_get_element_info(p_ply_element element, const char** name, + * + * Returns element if successfull or NULL if no more properties + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + p_ply_property ply_get_next_property(p_ply_element element, + p_ply_property last); + +@@ -231,6 +272,8 @@ p_ply_property ply_get_next_property(p_ply_element element, + * + * Returns 1 if successfull or 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_get_property_info(p_ply_property property, const char** name, + e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type); + +@@ -244,6 +287,8 @@ int ply_get_property_info(p_ply_property property, const char** name, + * + * Returns handle to PLY file if successfull, NULL otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, + p_ply_error_cb error_cb, long idata, void *pdata); + +@@ -256,6 +301,8 @@ p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_add_element(p_ply ply, const char *name, long ninstances); + + /* ---------------------------------------------------------------------- +@@ -269,6 +316,8 @@ int ply_add_element(p_ply ply, const char *name, long ninstances); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_add_property(p_ply ply, const char *name, e_ply_type type, + e_ply_type length_type, e_ply_type value_type); + +@@ -282,6 +331,8 @@ int ply_add_property(p_ply ply, const char *name, e_ply_type type, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_add_list_property(p_ply ply, const char *name, + e_ply_type length_type, e_ply_type value_type); + +@@ -294,6 +345,8 @@ int ply_add_list_property(p_ply ply, const char *name, + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type); + + /* ---------------------------------------------------------------------- +@@ -304,6 +357,8 @@ int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_add_comment(p_ply ply, const char *comment); + + /* ---------------------------------------------------------------------- +@@ -314,6 +369,8 @@ int ply_add_comment(p_ply ply, const char *comment); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_add_obj_info(p_ply ply, const char *obj_info); + + /* ---------------------------------------------------------------------- +@@ -324,6 +381,8 @@ int ply_add_obj_info(p_ply ply, const char *obj_info); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_write_header(p_ply ply); + + /* ---------------------------------------------------------------------- +@@ -337,6 +396,8 @@ int ply_write_header(p_ply ply); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_write(p_ply ply, double value); + + /* ---------------------------------------------------------------------- +@@ -346,13 +407,14 @@ int ply_write(p_ply ply, double value); + * + * Returns 1 if successfull, 0 otherwise + * ---------------------------------------------------------------------- */ ++ ++RPLY_DLL_DEF + int ply_close(p_ply ply); + + #ifdef __cplusplus +-} ++} // extern 'C' + #endif + +-#endif /* RPLY_H */ + + /* ---------------------------------------------------------------------- + * Copyright (C) 2003-2015 Diego Nehab. All rights reserved. +diff --git a/rplyfile.h b/rplyfile.h +index 206e716..1b5a40e 100644 +--- a/rplyfile.h ++++ b/rplyfile.h +@@ -9,6 +9,19 @@ + * at the end of this file. + * ---------------------------------------------------------------------- */ + ++#ifdef RPLY_SHARED_LIB ++ ++#ifdef RPLY_BUILD_LIB ++#define RPLY_DLL_DEF __declspec(dllexport) ++#else ++#define RPLY_DLL_DEF __declspec(dllimport) ++#endif // RPLY_BUILD_LIB ++ ++#else ++#define RPLY_DLL_DEF ++#endif // RPLY_SHARED_LIB ++ ++ + #ifdef __cplusplus + extern "C" { + #endif +@@ -22,6 +35,7 @@ extern "C" { + * + * Returns 1 if successful, 0 otherwise + * ---------------------------------------------------------------------- */ ++RPLY_DLL_DEF + p_ply ply_open_from_file(FILE *file_pointer, p_ply_error_cb error_cb, + long idata, void *pdata); + +@@ -35,6 +49,7 @@ p_ply ply_open_from_file(FILE *file_pointer, p_ply_error_cb error_cb, + * + * Returns handle to PLY file if successfull, NULL otherwise + * ---------------------------------------------------------------------- */ ++RPLY_DLL_DEF + p_ply ply_create_to_file(FILE *file_pointer, e_ply_storage_mode storage_mode, + p_ply_error_cb error_cb, long idata, void *pdata); + diff --git a/ports/rply/portfile.cmake b/ports/rply/portfile.cmake new file mode 100644 index 000000000..d6b86abfe --- /dev/null +++ b/ports/rply/portfile.cmake @@ -0,0 +1,33 @@ +include(vcpkg_common_functions) + +set(VERSION 1.1.4) + +vcpkg_download_distfile(ARCHIVE + URLS "http://w3.impa.br/~diego/software/rply/rply-${VERSION}.tar.gz" + FILENAME "rply-${VERSION}.tar.gz" + SHA512 be389780b8ca74658433f271682d91e89709ced588c4012c152ccf4014557692a1afd37b1bd5e567cedf9c412d42721eb0412ff3331f38717e527bd5d29c27a7 +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + REF ${VERSION} + PATCHES + export_functions.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/rply-config.cmake.in DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/rply RENAME copyright) + diff --git a/ports/rply/rply-config.cmake.in b/ports/rply/rply-config.cmake.in new file mode 100644 index 000000000..303034207 --- /dev/null +++ b/ports/rply/rply-config.cmake.in @@ -0,0 +1,8 @@ +get_filename_component(_RPLY_PREFIX_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) +set (_TARGET_NAME "rply") + +# IMPORTED targets +include("${_RPLY_PREFIX_DIR}/${_TARGET_NAME}-targets.cmake") + +set(_RPLY_PREFIX_DIR) +set(_TARGET_NAME) -- cgit v1.2.3 From e8ea8082322abcdda5d2213fece604ec354bbac9 Mon Sep 17 00:00:00 2001 From: Chao Jia Date: Mon, 25 Nov 2019 22:44:24 +0100 Subject: use _CRT_SECURE_NO_WARNINGS --- ports/rply/CMakeLists.txt | 18 +-- ports/rply/export_functions.patch | 305 -------------------------------------- ports/rply/portfile.cmake | 3 +- ports/rply/rply.def | 28 ++++ 4 files changed, 36 insertions(+), 318 deletions(-) delete mode 100644 ports/rply/export_functions.patch create mode 100644 ports/rply/rply.def diff --git a/ports/rply/CMakeLists.txt b/ports/rply/CMakeLists.txt index 1ba75b857..8885a79c4 100644 --- a/ports/rply/CMakeLists.txt +++ b/ports/rply/CMakeLists.txt @@ -11,33 +11,29 @@ include (GNUInstallDirs) file (GLOB target_headers "*.h") file (GLOB target_srcs "*.c" ) -add_library (${target_name} ${target_srcs} ${target_headers}) + +if (MSVC) + set(sources_msvc "rply.def") +endif() + +add_library (${target_name} ${target_srcs} ${target_headers} ${sources_msvc}) target_include_directories (${target_name} PUBLIC $ ) -if (MSVC) - target_compile_definitions (${target_name} PRIVATE RPLY_BUILD_LIB) -endif () - -if (BUILD_SHARED_LIBS) - target_compile_definitions (${target_name} PUBLIC RPLY_SHARED_LIB) -endif () - set_target_properties(${target_name} PROPERTIES C_STANDARD 11 ) if (MSVC) + target_compile_definitions(${target_name} PRIVATE _CRT_SECURE_NO_WARNINGS) set_target_properties(${target_name} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY $ ) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${target_name}) endif() -message (STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") - install (TARGETS ${target_name} EXPORT ${target_name}-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/ports/rply/export_functions.patch b/ports/rply/export_functions.patch deleted file mode 100644 index e86522167..000000000 --- a/ports/rply/export_functions.patch +++ /dev/null @@ -1,305 +0,0 @@ -diff --git a/rply.h b/rply.h -index 9fa6da9..2e2a0c5 100644 ---- a/rply.h -+++ b/rply.h -@@ -1,5 +1,5 @@ --#ifndef RPLY_H --#define RPLY_H -+#pragma once -+ - /* ---------------------------------------------------------------------- - * RPly library, read/write PLY files - * Diego Nehab, IMPA -@@ -9,6 +9,19 @@ - * at the end of this file. - * ---------------------------------------------------------------------- */ - -+#ifdef RPLY_SHARED_LIB -+ -+#ifdef RPLY_BUILD_LIB -+#define RPLY_DLL_DEF __declspec(dllexport) -+#else -+#define RPLY_DLL_DEF __declspec(dllimport) -+#endif // RPLY_BUILD_LIB -+ -+#else -+#define RPLY_DLL_DEF -+#endif // RPLY_SHARED_LIB -+ -+ - #ifdef __cplusplus - extern "C" { - #endif -@@ -57,6 +70,8 @@ typedef void (*p_ply_error_cb)(p_ply ply, const char *message); - * ply: handle returned by ply_open or ply_create - * idata,pdata: contextual information set in ply_open or ply_create - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata); - - /* ---------------------------------------------------------------------- -@@ -68,6 +83,8 @@ int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata); - * - * Returns 1 if successful, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, - void *pdata); - -@@ -78,6 +95,8 @@ p_ply ply_open(const char *name, p_ply_error_cb error_cb, long idata, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_read_header(p_ply ply); - - /* ---------------------------------------------------------------------- -@@ -101,6 +120,8 @@ typedef int (*p_ply_read_cb)(p_ply_argument argument); - * Returns 0 if no element or no property in element, returns the - * number of element instances otherwise. - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - long ply_set_read_cb(p_ply ply, const char *element_name, - const char *property_name, p_ply_read_cb read_cb, - void *pdata, long idata); -@@ -115,6 +136,8 @@ long ply_set_read_cb(p_ply ply, const char *element_name, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_get_argument_element(p_ply_argument argument, - p_ply_element *element, long *instance_index); - -@@ -128,6 +151,8 @@ int ply_get_argument_element(p_ply_argument argument, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_get_argument_property(p_ply_argument argument, - p_ply_property *property, long *length, long *value_index); - -@@ -139,6 +164,8 @@ int ply_get_argument_property(p_ply_argument argument, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_get_argument_user_data(p_ply_argument argument, void **pdata, - long *idata); - -@@ -149,6 +176,8 @@ int ply_get_argument_user_data(p_ply_argument argument, void **pdata, - * - * Returns the current data item - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - double ply_get_argument_value(p_ply_argument argument); - - /* ---------------------------------------------------------------------- -@@ -159,6 +188,8 @@ double ply_get_argument_value(p_ply_argument argument); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_read(p_ply ply); - - /* ---------------------------------------------------------------------- -@@ -170,6 +201,8 @@ int ply_read(p_ply ply); - * - * Returns element if successfull or NULL if no more elements - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - p_ply_element ply_get_next_element(p_ply ply, p_ply_element last); - - /* ---------------------------------------------------------------------- -@@ -181,6 +214,8 @@ p_ply_element ply_get_next_element(p_ply ply, p_ply_element last); - * - * Returns comment if successfull or NULL if no more comments - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - const char *ply_get_next_comment(p_ply ply, const char *last); - - /* ---------------------------------------------------------------------- -@@ -192,6 +227,8 @@ const char *ply_get_next_comment(p_ply ply, const char *last); - * - * Returns obj_info if successfull or NULL if no more obj_infos - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - const char *ply_get_next_obj_info(p_ply ply, const char *last); - - /* ---------------------------------------------------------------------- -@@ -203,6 +240,8 @@ const char *ply_get_next_obj_info(p_ply ply, const char *last); - * - * Returns 1 if successfull or 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_get_element_info(p_ply_element element, const char** name, - long *ninstances); - -@@ -215,6 +254,8 @@ int ply_get_element_info(p_ply_element element, const char** name, - * - * Returns element if successfull or NULL if no more properties - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - p_ply_property ply_get_next_property(p_ply_element element, - p_ply_property last); - -@@ -231,6 +272,8 @@ p_ply_property ply_get_next_property(p_ply_element element, - * - * Returns 1 if successfull or 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_get_property_info(p_ply_property property, const char** name, - e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type); - -@@ -244,6 +287,8 @@ int ply_get_property_info(p_ply_property property, const char** name, - * - * Returns handle to PLY file if successfull, NULL otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, - p_ply_error_cb error_cb, long idata, void *pdata); - -@@ -256,6 +301,8 @@ p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_add_element(p_ply ply, const char *name, long ninstances); - - /* ---------------------------------------------------------------------- -@@ -269,6 +316,8 @@ int ply_add_element(p_ply ply, const char *name, long ninstances); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_add_property(p_ply ply, const char *name, e_ply_type type, - e_ply_type length_type, e_ply_type value_type); - -@@ -282,6 +331,8 @@ int ply_add_property(p_ply ply, const char *name, e_ply_type type, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_add_list_property(p_ply ply, const char *name, - e_ply_type length_type, e_ply_type value_type); - -@@ -294,6 +345,8 @@ int ply_add_list_property(p_ply ply, const char *name, - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type); - - /* ---------------------------------------------------------------------- -@@ -304,6 +357,8 @@ int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_add_comment(p_ply ply, const char *comment); - - /* ---------------------------------------------------------------------- -@@ -314,6 +369,8 @@ int ply_add_comment(p_ply ply, const char *comment); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_add_obj_info(p_ply ply, const char *obj_info); - - /* ---------------------------------------------------------------------- -@@ -324,6 +381,8 @@ int ply_add_obj_info(p_ply ply, const char *obj_info); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_write_header(p_ply ply); - - /* ---------------------------------------------------------------------- -@@ -337,6 +396,8 @@ int ply_write_header(p_ply ply); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_write(p_ply ply, double value); - - /* ---------------------------------------------------------------------- -@@ -346,13 +407,14 @@ int ply_write(p_ply ply, double value); - * - * Returns 1 if successfull, 0 otherwise - * ---------------------------------------------------------------------- */ -+ -+RPLY_DLL_DEF - int ply_close(p_ply ply); - - #ifdef __cplusplus --} -+} // extern 'C' - #endif - --#endif /* RPLY_H */ - - /* ---------------------------------------------------------------------- - * Copyright (C) 2003-2015 Diego Nehab. All rights reserved. -diff --git a/rplyfile.h b/rplyfile.h -index 206e716..1b5a40e 100644 ---- a/rplyfile.h -+++ b/rplyfile.h -@@ -9,6 +9,19 @@ - * at the end of this file. - * ---------------------------------------------------------------------- */ - -+#ifdef RPLY_SHARED_LIB -+ -+#ifdef RPLY_BUILD_LIB -+#define RPLY_DLL_DEF __declspec(dllexport) -+#else -+#define RPLY_DLL_DEF __declspec(dllimport) -+#endif // RPLY_BUILD_LIB -+ -+#else -+#define RPLY_DLL_DEF -+#endif // RPLY_SHARED_LIB -+ -+ - #ifdef __cplusplus - extern "C" { - #endif -@@ -22,6 +35,7 @@ extern "C" { - * - * Returns 1 if successful, 0 otherwise - * ---------------------------------------------------------------------- */ -+RPLY_DLL_DEF - p_ply ply_open_from_file(FILE *file_pointer, p_ply_error_cb error_cb, - long idata, void *pdata); - -@@ -35,6 +49,7 @@ p_ply ply_open_from_file(FILE *file_pointer, p_ply_error_cb error_cb, - * - * Returns handle to PLY file if successfull, NULL otherwise - * ---------------------------------------------------------------------- */ -+RPLY_DLL_DEF - p_ply ply_create_to_file(FILE *file_pointer, e_ply_storage_mode storage_mode, - p_ply_error_cb error_cb, long idata, void *pdata); - diff --git a/ports/rply/portfile.cmake b/ports/rply/portfile.cmake index d6b86abfe..135dc0fda 100644 --- a/ports/rply/portfile.cmake +++ b/ports/rply/portfile.cmake @@ -12,11 +12,10 @@ vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ARCHIVE ${ARCHIVE} REF ${VERSION} - PATCHES - export_functions.patch ) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/rply.def DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/rply-config.cmake.in DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( diff --git a/ports/rply/rply.def b/ports/rply/rply.def new file mode 100644 index 000000000..8662c2421 --- /dev/null +++ b/ports/rply/rply.def @@ -0,0 +1,28 @@ +EXPORTS + ply_get_ply_user_data + ply_open + ply_read_header + ply_set_read_cb + ply_get_argument_element + ply_get_argument_property + ply_get_argument_user_data + ply_get_argument_value + ply_read + ply_get_next_element + ply_get_next_comment + ply_get_next_obj_info + ply_get_element_info + ply_get_next_property + ply_get_property_info + ply_create + ply_add_element + ply_add_property + ply_add_list_property + ply_add_scalar_property + ply_add_comment + ply_add_obj_info + ply_write_header + ply_write + ply_close + ply_open_from_file + ply_create_to_file -- cgit v1.2.3 From 384defd0a472a1c06fc7f1f92cfb3d373e586b0e Mon Sep 17 00:00:00 2001 From: Chao Jia Date: Mon, 25 Nov 2019 23:04:35 +0100 Subject: fix uninitialized local variable --- ports/rply/fix-uninitialized-local-variable.patch | 22 ++++++++++++++++++++++ ports/rply/portfile.cmake | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 ports/rply/fix-uninitialized-local-variable.patch diff --git a/ports/rply/fix-uninitialized-local-variable.patch b/ports/rply/fix-uninitialized-local-variable.patch new file mode 100644 index 000000000..f23ad8450 --- /dev/null +++ b/ports/rply/fix-uninitialized-local-variable.patch @@ -0,0 +1,22 @@ +diff --git a/rply.c b/rply.c +index c4105ef..7c7e72a 100644 +--- a/rply.c ++++ b/rply.c +@@ -372,7 +372,7 @@ p_ply ply_open(const char *name, p_ply_error_cb error_cb, + + p_ply ply_open_from_file(FILE *fp, p_ply_error_cb error_cb, + long idata, void *pdata) { +- p_ply ply; ++ p_ply ply = NULL; + if (error_cb == NULL) error_cb = ply_error_cb; + assert(fp); + if (!ply_type_check()) { +@@ -475,7 +475,7 @@ p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, + + p_ply ply_create_to_file(FILE *fp, e_ply_storage_mode storage_mode, + p_ply_error_cb error_cb, long idata, void *pdata) { +- p_ply ply; ++ p_ply ply = NULL; + assert(fp && storage_mode <= PLY_DEFAULT); + if (!ply_type_check()) { + error_cb(ply, "Incompatible type system"); diff --git a/ports/rply/portfile.cmake b/ports/rply/portfile.cmake index 135dc0fda..6c3c5e711 100644 --- a/ports/rply/portfile.cmake +++ b/ports/rply/portfile.cmake @@ -10,8 +10,10 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} + ARCHIVE ${ARCHIVE} REF ${VERSION} + PATCHES + fix-uninitialized-local-variable.patch ) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) -- cgit v1.2.3 From 3c84e1a8724daa7d3360a10e02994f269292d00a Mon Sep 17 00:00:00 2001 From: Chao Jia Date: Fri, 6 Dec 2019 17:05:36 +0100 Subject: [rply]requested changes --- ports/rply/CONTROL | 1 + ports/rply/portfile.cmake | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/rply/CONTROL b/ports/rply/CONTROL index fad3d589f..0caedadfb 100644 --- a/ports/rply/CONTROL +++ b/ports/rply/CONTROL @@ -1,3 +1,4 @@ Source: rply Version: 1.1.4 +Homepage: http://w3.impa.br/~diego/software/rply Description: ANSI C Library for PLY file format input and output diff --git a/ports/rply/portfile.cmake b/ports/rply/portfile.cmake index 6c3c5e711..665b9e300 100644 --- a/ports/rply/portfile.cmake +++ b/ports/rply/portfile.cmake @@ -1,4 +1,3 @@ -include(vcpkg_common_functions) set(VERSION 1.1.4) -- cgit v1.2.3