diff --git a/CMakeLists.txt b/CMakeLists.txt index 4706d44..c23bb63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,12 +169,14 @@ if (RAGEPHOTO_EXTRACT) endif() # CPack Package Generation -include(InstallRequiredSystemLibraries) -set(CPACK_PACKAGE_DESCRIPTION "Open Source RAGE Photo Parser for GTA V and RDR 2") -set(CPACK_PACKAGE_NAME "libragephoto") -set(CPACK_PACKAGE_VENDOR "Syping") -set(CPACK_PACKAGE_VERSION_MAJOR "${ragephoto_VERSION_MAJOR}") -set(CPACK_PACKAGE_VERSION_MINOR "${ragephoto_VERSION_MINOR}") -set(CPACK_PACKAGE_VERSION_PATCH "${ragephoto_VERSION_PATCH}") -set(CPACK_STRIP_FILES ON) -include(CPack) +if (RPTL_ON) + include(InstallRequiredSystemLibraries) + set(CPACK_PACKAGE_DESCRIPTION "Open Source RAGE Photo Parser for GTA V and RDR 2") + set(CPACK_PACKAGE_NAME "libragephoto") + set(CPACK_PACKAGE_VENDOR "Syping") + set(CPACK_PACKAGE_VERSION_MAJOR "${ragephoto_VERSION_MAJOR}") + set(CPACK_PACKAGE_VERSION_MINOR "${ragephoto_VERSION_MINOR}") + set(CPACK_PACKAGE_VERSION_PATCH "${ragephoto_VERSION_PATCH}") + set(CPACK_STRIP_FILES ON) + include(CPack) +endif() diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 45c9523..c846f9e 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -12,5 +12,5 @@ EXPAND_ONLY_PREDEF = YES PREDEFINED = "__cplusplus=201703L" \ "RAGEPHOTO_CXX_STD=17" \ "@LIBRAGEPHOTO_API@" \ - "LIBRAGEPHOTO_C_BINDING=" \ - "LIBRAGEPHOTO_CXX_BINDING=" + "LIBRAGEPHOTO_C_PUBLIC=" \ + "LIBRAGEPHOTO_CXX_PUBLIC=" diff --git a/doc/usage.doc b/doc/usage.doc index d607d3e..cfa78c2 100644 --- a/doc/usage.doc +++ b/doc/usage.doc @@ -96,7 +96,7 @@ bool saveJpeg(RagePhoto* ragePhoto, const std::string& filename) { } // Using the saveJpeg function -const char* filename = "PGTA5123456789"; +const char* filename = "PGTA5123456789.jpg"; const bool saved = saveJpeg(&ragePhoto, filename); \endcode diff --git a/src/RagePhoto.h b/src/RagePhoto.h index 6a5972c..af040f3 100644 --- a/src/RagePhoto.h +++ b/src/RagePhoto.h @@ -30,7 +30,7 @@ /** * \brief GTA V and RDR 2 Photo Parser. */ -class LIBRAGEPHOTO_CXX_BINDING RagePhoto +class LIBRAGEPHOTO_CXX_PUBLIC RagePhoto { public: /** Default sizes */ diff --git a/src/RagePhotoC.h b/src/RagePhotoC.h index f6b0efc..0727938 100644 --- a/src/RagePhotoC.h +++ b/src/RagePhotoC.h @@ -40,30 +40,30 @@ extern "C" { typedef void* ragephoto_t; /** Opens a \p ragephoto_t instance. */ -LIBRAGEPHOTO_C_BINDING ragephoto_t ragephoto_open(); +LIBRAGEPHOTO_C_PUBLIC ragephoto_t ragephoto_open(); /** Add a custom defined RagePhotoFormatParser. * \param instance \p ragephoto_t instance * \param rp_parser RagePhotoFormatParser parser to add */ -LIBRAGEPHOTO_C_BINDING void ragephoto_addparser(ragephoto_t instance, RagePhotoFormatParser *rp_parser); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_addparser(ragephoto_t instance, RagePhotoFormatParser *rp_parser); /** Resets the RagePhotoData object to default values. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING void ragephoto_clear(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_clear(ragephoto_t instance); /** Resets the RagePhotoData object to default values. * \param rp_data RagePhotoData object */ -LIBRAGEPHOTO_C_BINDING void ragephotodata_clear(RagePhotoData *rp_data); +LIBRAGEPHOTO_C_PUBLIC void ragephotodata_clear(RagePhotoData *rp_data); /** Loads a Photo from a const char*. * \param instance \p ragephoto_t instance * \param data Photo data * \param size Photo data size */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_load(ragephoto_t instance, const char *data, size_t size); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_load(ragephoto_t instance, const char *data, size_t size); /** Loads a Photo from a const char*. * \param rp_data RagePhotoData object @@ -71,136 +71,136 @@ LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_load(ragephoto_t instance, con * \param data Photo data * \param size Photo data size */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, const char *data, size_t size); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, const char *data, size_t size); /** Loads a Photo from a file. * \param instance \p ragephoto_t instance * \param filename File to load */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_loadfile(ragephoto_t instance, const char *filename); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_loadfile(ragephoto_t instance, const char *filename); /** Returns the last error occurred. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING int32_t ragephoto_error(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC int32_t ragephoto_error(ragephoto_t instance); /** Returns the GTA V default Photo Buffer Size. */ -LIBRAGEPHOTO_C_BINDING uint32_t ragephoto_defpbuf_gta5(); +LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_defpbuf_gta5(); /** Returns the RDR 2 default Photo Buffer Size. */ -LIBRAGEPHOTO_C_BINDING uint32_t ragephoto_defpbuf_rdr2(); +LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_defpbuf_rdr2(); /** Returns the GTA V Photo Format. */ -LIBRAGEPHOTO_C_BINDING uint32_t ragephoto_format_gta5(); +LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_format_gta5(); /** Returns the RDR 2 Photo Format. */ -LIBRAGEPHOTO_C_BINDING uint32_t ragephoto_format_rdr2(); +LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_format_rdr2(); /** Returns the internal RagePhotoData object. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING RagePhotoData* ragephoto_getphotodata(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC RagePhotoData* ragephoto_getphotodata(ragephoto_t instance); /** Returns the Photo description. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING const char* ragephoto_getphotodesc(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotodesc(ragephoto_t instance); /** Returns the Photo Format (GTA V or RDR 2). * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING uint32_t ragephoto_getphotoformat(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_getphotoformat(ragephoto_t instance); /** Returns the Photo JPEG data. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING const char* ragephoto_getphotojpeg(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotojpeg(ragephoto_t instance); /** Returns the Photo JSON data. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING const char* ragephoto_getphotojson(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotojson(ragephoto_t instance); /** Returns the Photo header. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING const char* ragephoto_getphotoheader(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotoheader(ragephoto_t instance); /** Returns the Photo JPEG sign. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING uint64_t ragephoto_getphotosign(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC uint64_t ragephoto_getphotosign(ragephoto_t instance); /** Returns the Photo JPEG sign. * \param instance \p ragephoto_t instance * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING uint64_t ragephoto_getphotosignf(ragephoto_t instance, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC uint64_t ragephoto_getphotosignf(ragephoto_t instance, uint32_t photoFormat); /** Returns the Photo JPEG sign. * \param rp_data RagePhotoData object */ -LIBRAGEPHOTO_C_BINDING uint64_t ragephotodata_getphotosign(RagePhotoData *rp_data); +LIBRAGEPHOTO_C_PUBLIC uint64_t ragephotodata_getphotosign(RagePhotoData *rp_data); /** Returns the Photo JPEG sign. * \param rp_data RagePhotoData object * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING uint64_t ragephotodata_getphotosignf(RagePhotoData *rp_data, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC uint64_t ragephotodata_getphotosignf(RagePhotoData *rp_data, uint32_t photoFormat); /** Returns the Photo JPEG data size. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING uint32_t ragephoto_getphotosize(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_getphotosize(ragephoto_t instance); /** Returns the Photo title. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING const char* ragephoto_getphototitle(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphototitle(ragephoto_t instance); /** Returns the Photo save file size. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING size_t ragephoto_getsavesize(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC size_t ragephoto_getsavesize(ragephoto_t instance); /** Returns the Photo save file size. * \param rp_data RagePhotoData object * \param rp_parser RagePhotoFormatParser parser array */ -LIBRAGEPHOTO_C_BINDING size_t ragephotodata_getsavesize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser); +LIBRAGEPHOTO_C_PUBLIC size_t ragephotodata_getsavesize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser); /** Returns the Photo save file size. * \param instance \p ragephoto_t instance * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING size_t ragephoto_getsavesizef(ragephoto_t instance, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC size_t ragephoto_getsavesizef(ragephoto_t instance, uint32_t photoFormat); /** Returns the Photo save file size. * \param rp_data RagePhotoData object * \param rp_parser RagePhotoFormatParser parser array * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING size_t ragephotodata_getsavesizef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC size_t ragephotodata_getsavesizef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, uint32_t photoFormat); /** Saves a Photo to a char*. * \param instance \p ragephoto_t instance * \param data Photo data */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_save(ragephoto_t instance, char *data); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_save(ragephoto_t instance, char *data); /** Saves a Photo to a char*. * \param rp_data RagePhotoData object * \param rp_parser RagePhotoFormatParser parser array * \param data Photo data */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephotodata_save(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, char *data); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephotodata_save(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, char *data); /** Saves a Photo to a char*. * \param instance \p ragephoto_t instance * \param data Photo data * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_savef(ragephoto_t instance, char *data, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_savef(ragephoto_t instance, char *data, uint32_t photoFormat); /** Saves a Photo to a char*. * \param rp_data RagePhotoData object @@ -208,52 +208,52 @@ LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_savef(ragephoto_t instance, ch * \param data Photo data * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephotodata_savef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, char *data, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephotodata_savef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, char *data, uint32_t photoFormat); /** Saves a Photo to a file. * \param instance \p ragephoto_t instance * \param filename File to save */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_savefile(ragephoto_t instance, const char *filename); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_savefile(ragephoto_t instance, const char *filename); /** Saves a Photo to a file. * \param instance \p ragephoto_t instance * \param filename File to save * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_savefilef(ragephoto_t instance, const char *filename, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_savefilef(ragephoto_t instance, const char *filename, uint32_t photoFormat); /** Sets all cross-format Buffer to default size. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setbufferdefault(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setbufferdefault(ragephoto_t instance); /** Sets all cross-format Buffer to default size. * \param rp_data RagePhotoData object */ -LIBRAGEPHOTO_C_BINDING void ragephotodata_setbufferdefault(RagePhotoData *rp_data); +LIBRAGEPHOTO_C_PUBLIC void ragephotodata_setbufferdefault(RagePhotoData *rp_data); /** Moves all Buffer offsets to correct position. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setbufferoffsets(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setbufferoffsets(ragephoto_t instance); /** Moves all Buffer offsets to correct position. * \param rp_data RagePhotoData object */ -LIBRAGEPHOTO_C_BINDING void ragephotodata_setbufferoffsets(RagePhotoData *rp_data); +LIBRAGEPHOTO_C_PUBLIC void ragephotodata_setbufferoffsets(RagePhotoData *rp_data); /** Sets the internal RagePhotoData object. * \param instance \p ragephoto_t instance * \param rp_data RagePhotoData object being set */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotodata(ragephoto_t instance, RagePhotoData *rp_data); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_setphotodata(ragephoto_t instance, RagePhotoData *rp_data); /** Copies RagePhotoData object to internal RagePhotoData object. * \param instance \p ragephoto_t instance * \param rp_data RagePhotoData object being copied */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotodatac(ragephoto_t instance, RagePhotoData *rp_data); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_setphotodatac(ragephoto_t instance, RagePhotoData *rp_data); /** Sets the Photo description. * \param instance \p ragephoto_t instance @@ -262,13 +262,13 @@ LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotodatac(ragephoto_t inst * * Default bufferSize: 256UL */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setphotodesc(ragephoto_t instance, const char *description, uint32_t bufferSize); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotodesc(ragephoto_t instance, const char *description, uint32_t bufferSize); /** Sets the Photo Format (GTA V or RDR 2). * \param instance \p ragephoto_t instance * \param photoFormat Photo Format (GTA V or RDR 2) */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setphotoformat(ragephoto_t instance, uint32_t photoFormat); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoformat(ragephoto_t instance, uint32_t photoFormat); /** Sets the Photo JPEG data. * \param instance \p ragephoto_t instance @@ -278,7 +278,7 @@ LIBRAGEPHOTO_C_BINDING void ragephoto_setphotoformat(ragephoto_t instance, uint3 * * Default bufferSize: ragephoto_defpbuf_gta5() or ragephoto_defpbuf_rdr2() */ -LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotojpeg(ragephoto_t instance, const char *data, uint32_t size, uint32_t bufferSize); +LIBRAGEPHOTO_C_PUBLIC ragephoto_bool_t ragephoto_setphotojpeg(ragephoto_t instance, const char *data, uint32_t size, uint32_t bufferSize); /** Sets the Photo JSON data. * \param instance \p ragephoto_t instance @@ -287,10 +287,10 @@ LIBRAGEPHOTO_C_BINDING ragephoto_bool_t ragephoto_setphotojpeg(ragephoto_t insta * * Default bufferSize: 3072UL */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setphotojson(ragephoto_t instance, const char *json, uint32_t bufferSize); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotojson(ragephoto_t instance, const char *json, uint32_t bufferSize); /** Sets the Photo header. (EXPERT ONLY) */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setphotoheader(ragephoto_t instance, const char *header, uint32_t headerSum); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoheader(ragephoto_t instance, const char *header, uint32_t headerSum); /** Sets the Photo title. * \param instance \p ragephoto_t instance @@ -299,15 +299,15 @@ LIBRAGEPHOTO_C_BINDING void ragephoto_setphotoheader(ragephoto_t instance, const * * Default bufferSize: 256UL */ -LIBRAGEPHOTO_C_BINDING void ragephoto_setphototitle(ragephoto_t instance, const char *title, uint32_t bufferSize); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphototitle(ragephoto_t instance, const char *title, uint32_t bufferSize); /** Closes a \p ragephoto_t instance. * \param instance \p ragephoto_t instance */ -LIBRAGEPHOTO_C_BINDING void ragephoto_close(ragephoto_t instance); +LIBRAGEPHOTO_C_PUBLIC void ragephoto_close(ragephoto_t instance); /** Returns the library version. */ -LIBRAGEPHOTO_C_BINDING const char* ragephoto_version(); +LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_version(); #ifdef __cplusplus } diff --git a/src/RagePhotoLibrary.h b/src/RagePhotoLibrary.h index adf3b9b..ffffba9 100644 --- a/src/RagePhotoLibrary.h +++ b/src/RagePhotoLibrary.h @@ -25,24 +25,34 @@ #ifdef _WIN32 #ifndef LIBRAGEPHOTO_STATIC #ifdef LIBRAGEPHOTO_LIBRARY -#define LIBRAGEPHOTO_C_BINDING __declspec(dllexport) -#define LIBRAGEPHOTO_CXX_BINDING __declspec(dllexport) +#define LIBRAGEPHOTO_C_PUBLIC __declspec(dllexport) +#define LIBRAGEPHOTO_CXX_PUBLIC __declspec(dllexport) #else -#define LIBRAGEPHOTO_C_BINDING __declspec(dllimport) -#define LIBRAGEPHOTO_CXX_BINDING __declspec(dllimport) +#define LIBRAGEPHOTO_C_PUBLIC __declspec(dllimport) +#define LIBRAGEPHOTO_CXX_PUBLIC __declspec(dllimport) #endif // LIBRAGEPHOTO_LIBRARY #else -#define LIBRAGEPHOTO_C_BINDING -#define LIBRAGEPHOTO_CXX_BINDING +#define LIBRAGEPHOTO_C_PUBLIC +#define LIBRAGEPHOTO_CXX_PUBLIC #endif // LIBRAGEPHOTO_STATIC #else #ifdef __EMSCRIPTEN__ #include -#define LIBRAGEPHOTO_C_BINDING EMSCRIPTEN_KEEPALIVE -#define LIBRAGEPHOTO_CXX_BINDING +#define LIBRAGEPHOTO_C_PUBLIC EMSCRIPTEN_KEEPALIVE +#define LIBRAGEPHOTO_CXX_PUBLIC #else -#define LIBRAGEPHOTO_C_BINDING -#define LIBRAGEPHOTO_CXX_BINDING +#ifdef __GNUC__ +#ifndef LIBRAGEPHOTO_STATIC +#define LIBRAGEPHOTO_C_PUBLIC __attribute__((visibility("default"))) +#define LIBRAGEPHOTO_CXX_PUBLIC __attribute__((visibility("default"))) +#else +#define LIBRAGEPHOTO_C_PUBLIC +#define LIBRAGEPHOTO_CXX_PUBLIC +#endif // LIBRAGEPHOTO_STATIC +#else +#define LIBRAGEPHOTO_C_PUBLIC +#define LIBRAGEPHOTO_CXX_PUBLIC +#endif // __GNUC__ #endif // __EMSCRIPTEN__ #endif // _WIN32 /* RAGEPHOTO LIBRARY BINDING END */