From 1be4ae5e4a8f5624195448aaa47edf1310ecaeb8 Mon Sep 17 00:00:00 2001 From: Syping Date: Wed, 3 Nov 2021 10:19:32 +0100 Subject: [PATCH] improve library structure, update documentation --- CMakeLists.txt | 17 ++++++++--------- doc/Doxyfile.in | 1 - doc/index.doc | 2 +- src/RagePhoto.h | 5 ++--- src/{libragephoto_data.h => RagePhotoData.h} | 8 +++++--- ...ephoto_global.h => libragephoto_global.h.in} | 13 ++++++++++--- src/ragephoto.pc.in | 2 +- 7 files changed, 27 insertions(+), 21 deletions(-) rename src/{libragephoto_data.h => RagePhotoData.h} (92%) rename src/{libragephoto_global.h => libragephoto_global.h.in} (82%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e79198a..b83782f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,8 @@ else() endif() set(RAGEPHOTO_HEADERS - src/libragephoto_data.h - src/libragephoto_global.h src/RagePhoto.h + src/RagePhotoData.h ) set(RAGEPHOTO_SOURCES src/RagePhoto.cpp @@ -79,21 +78,21 @@ if (WITH_C_API) else() set(LIBRAGEPHOTO_API LIBRAGEPHOTO_C_NOAPI) endif() -list(APPEND LIBRAGEPHOTO_DEFINES - ${LIBRAGEPHOTO_API} -) +configure_file(src/libragephoto_global.h.in include/libragephoto_global.h @ONLY) +list(APPEND RAGEPHOTO_HEADERS + ${CMAKE_CURRENT_BINARY_DIR}/include/libragephoto_global.h +) configure_file(src/ragephoto.pc.in pkgconfig/ragephoto.pc @ONLY) target_compile_definitions(ragephoto PRIVATE LIBRAGEPHOTO_LIBRARY ${LIBRAGEPHOTO_DEFINES} ) -target_compile_definitions(ragephoto PUBLIC - ${LIBRAGEPHOTO_API} - ${LIBRAGEPHOTO_LIBTYPE} +target_include_directories(ragephoto PUBLIC + ${CMAKE_CURRENT_BINARY_DIR}/include ) install(TARGETS ragephoto DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(FILES ${RAGEPHOTO_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES ${RAGEPHOTO_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/RagePhoto) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/ragephoto.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) option(WITH_DOCUMENTATION "Build libragephoto with documentation" OFF) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 9e1583c..920c622 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -9,5 +9,4 @@ MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES PREDEFINED = "protected=private" \ "__cplusplus" \ - "LIBRAGEPHOTO_DOXYGEN" \ "@LIBRAGEPHOTO_API@" diff --git a/doc/index.doc b/doc/index.doc index 700afc0..3a98f45 100644 --- a/doc/index.doc +++ b/doc/index.doc @@ -2,7 +2,7 @@

Open Source RAGE Photo Parser for GTA V and RDR 2

-- Read RAGE Photos error free and correct +- Read/Write RAGE Photos error free and correct - Support for metadata stored in RAGE Photos - Export RAGE Photos to jpeg with ragephoto-extract - High Efficient and Simple C++ API diff --git a/src/RagePhoto.h b/src/RagePhoto.h index cfafabc..a041c2c 100644 --- a/src/RagePhoto.h +++ b/src/RagePhoto.h @@ -16,14 +16,12 @@ * responsible for anything with use of the software, you are self responsible. *****************************************************************************/ -/** \file RagePhoto.h */ - #ifndef RAGEPHOTO_H #define RAGEPHOTO_H #ifdef __cplusplus -#include "libragephoto_data.h" #include "libragephoto_global.h" +#include "RagePhotoData.h" #include #include #include @@ -184,6 +182,7 @@ extern "C" { #include #include #endif +/** \file RagePhoto.h */ /** RagePhoto C++ class typedef for C API. */ typedef void* ragephoto_t; diff --git a/src/libragephoto_data.h b/src/RagePhotoData.h similarity index 92% rename from src/libragephoto_data.h rename to src/RagePhotoData.h index 090e600..e674164 100644 --- a/src/libragephoto_data.h +++ b/src/RagePhotoData.h @@ -16,9 +16,10 @@ * responsible for anything with use of the software, you are self responsible. *****************************************************************************/ -#ifndef LIBRAGEPHOTO_DATA_H -#define LIBRAGEPHOTO_DATA_H +#ifndef RAGEPHOTODATA_H +#define RAGEPHOTODATA_H +#ifdef __cplusplus #include "libragephoto_global.h" #include #include @@ -44,5 +45,6 @@ struct LIBRAGEPHOTO_EXPORT RagePhotoData uint32_t titlBuffer; uint32_t titlOffset; }; +#endif // __cplusplus -#endif // LIBRAGEPHOTO_DATA_H +#endif // RAGEPHOTODATA_H diff --git a/src/libragephoto_global.h b/src/libragephoto_global.h.in similarity index 82% rename from src/libragephoto_global.h rename to src/libragephoto_global.h.in index c22ff4d..15ca144 100644 --- a/src/libragephoto_global.h +++ b/src/libragephoto_global.h.in @@ -19,18 +19,25 @@ #ifndef LIBRAGEPHOTO_GLOBAL_H #define LIBRAGEPHOTO_GLOBAL_H +/* CMAKE CONFIG BEGIN */ +#define @LIBRAGEPHOTO_API@ +#define @LIBRAGEPHOTO_LIBTYPE@ +/* CMAKE CONFIG END */ + +/* RAGEPHOTO LIBRARY EXPORT BEGIN */ #ifdef _WIN32 #ifndef LIBRAGEPHOTO_STATIC #ifdef LIBRAGEPHOTO_LIBRARY #define LIBRAGEPHOTO_EXPORT __declspec(dllexport) #else #define LIBRAGEPHOTO_EXPORT __declspec(dllimport) -#endif +#endif // LIBRAGEPHOTO_LIBRARY #else #define LIBRAGEPHOTO_EXPORT -#endif +#endif // LIBRAGEPHOTO_STATIC #else #define LIBRAGEPHOTO_EXPORT -#endif +#endif // _WIN32 +/* RAGEPHOTO LIBRARY EXPORT END */ #endif // LIBRAGEPHOTO_GLOBAL_H diff --git a/src/ragephoto.pc.in b/src/ragephoto.pc.in index 5a76b7c..0ce462e 100644 --- a/src/ragephoto.pc.in +++ b/src/ragephoto.pc.in @@ -6,4 +6,4 @@ Name: libragephoto Description: Open Source RAGE Photo Parser for GTA V Version: @PROJECT_VERSION@ Libs: -L${libdir} -lragephoto -Cflags: -I${includedir} -D@LIBRAGEPHOTO_API@ -D@LIBRAGEPHOTO_LIBTYPE@ +Cflags: -I${includedir}/RagePhoto