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