improve library structure, update documentation

This commit is contained in:
Syping 2021-11-03 10:19:32 +01:00
parent 9d9e0c8b05
commit 1be4ae5e4a
7 changed files with 27 additions and 21 deletions

View File

@ -47,9 +47,8 @@ else()
endif() endif()
set(RAGEPHOTO_HEADERS set(RAGEPHOTO_HEADERS
src/libragephoto_data.h
src/libragephoto_global.h
src/RagePhoto.h src/RagePhoto.h
src/RagePhotoData.h
) )
set(RAGEPHOTO_SOURCES set(RAGEPHOTO_SOURCES
src/RagePhoto.cpp src/RagePhoto.cpp
@ -79,21 +78,21 @@ if (WITH_C_API)
else() else()
set(LIBRAGEPHOTO_API LIBRAGEPHOTO_C_NOAPI) set(LIBRAGEPHOTO_API LIBRAGEPHOTO_C_NOAPI)
endif() 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) configure_file(src/ragephoto.pc.in pkgconfig/ragephoto.pc @ONLY)
target_compile_definitions(ragephoto PRIVATE target_compile_definitions(ragephoto PRIVATE
LIBRAGEPHOTO_LIBRARY LIBRAGEPHOTO_LIBRARY
${LIBRAGEPHOTO_DEFINES} ${LIBRAGEPHOTO_DEFINES}
) )
target_compile_definitions(ragephoto PUBLIC target_include_directories(ragephoto PUBLIC
${LIBRAGEPHOTO_API} ${CMAKE_CURRENT_BINARY_DIR}/include
${LIBRAGEPHOTO_LIBTYPE}
) )
install(TARGETS ragephoto DESTINATION ${CMAKE_INSTALL_LIBDIR}) 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) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/ragephoto.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
option(WITH_DOCUMENTATION "Build libragephoto with documentation" OFF) option(WITH_DOCUMENTATION "Build libragephoto with documentation" OFF)

View File

@ -9,5 +9,4 @@ MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES EXPAND_ONLY_PREDEF = YES
PREDEFINED = "protected=private" \ PREDEFINED = "protected=private" \
"__cplusplus" \ "__cplusplus" \
"LIBRAGEPHOTO_DOXYGEN" \
"@LIBRAGEPHOTO_API@" "@LIBRAGEPHOTO_API@"

View File

@ -2,7 +2,7 @@
<h4>Open Source RAGE Photo Parser for GTA V and RDR 2</h4> <h4>Open Source RAGE Photo Parser for GTA V and RDR 2</h4>
- Read RAGE Photos error free and correct - Read/Write RAGE Photos error free and correct
- Support for metadata stored in RAGE Photos - Support for metadata stored in RAGE Photos
- Export RAGE Photos to jpeg with ragephoto-extract - Export RAGE Photos to jpeg with ragephoto-extract
- High Efficient and Simple C++ API - High Efficient and Simple C++ API

View File

@ -16,14 +16,12 @@
* responsible for anything with use of the software, you are self responsible. * responsible for anything with use of the software, you are self responsible.
*****************************************************************************/ *****************************************************************************/
/** \file RagePhoto.h */
#ifndef RAGEPHOTO_H #ifndef RAGEPHOTO_H
#define RAGEPHOTO_H #define RAGEPHOTO_H
#ifdef __cplusplus #ifdef __cplusplus
#include "libragephoto_data.h"
#include "libragephoto_global.h" #include "libragephoto_global.h"
#include "RagePhotoData.h"
#include <unordered_map> #include <unordered_map>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
@ -184,6 +182,7 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#endif #endif
/** \file RagePhoto.h */
/** RagePhoto C++ class typedef for C API. */ /** RagePhoto C++ class typedef for C API. */
typedef void* ragephoto_t; typedef void* ragephoto_t;

View File

@ -16,9 +16,10 @@
* responsible for anything with use of the software, you are self responsible. * responsible for anything with use of the software, you are self responsible.
*****************************************************************************/ *****************************************************************************/
#ifndef LIBRAGEPHOTO_DATA_H #ifndef RAGEPHOTODATA_H
#define LIBRAGEPHOTO_DATA_H #define RAGEPHOTODATA_H
#ifdef __cplusplus
#include "libragephoto_global.h" #include "libragephoto_global.h"
#include <iostream> #include <iostream>
#include <cstdint> #include <cstdint>
@ -44,5 +45,6 @@ struct LIBRAGEPHOTO_EXPORT RagePhotoData
uint32_t titlBuffer; uint32_t titlBuffer;
uint32_t titlOffset; uint32_t titlOffset;
}; };
#endif // __cplusplus
#endif // LIBRAGEPHOTO_DATA_H #endif // RAGEPHOTODATA_H

View File

@ -19,18 +19,25 @@
#ifndef LIBRAGEPHOTO_GLOBAL_H #ifndef LIBRAGEPHOTO_GLOBAL_H
#define 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 #ifdef _WIN32
#ifndef LIBRAGEPHOTO_STATIC #ifndef LIBRAGEPHOTO_STATIC
#ifdef LIBRAGEPHOTO_LIBRARY #ifdef LIBRAGEPHOTO_LIBRARY
#define LIBRAGEPHOTO_EXPORT __declspec(dllexport) #define LIBRAGEPHOTO_EXPORT __declspec(dllexport)
#else #else
#define LIBRAGEPHOTO_EXPORT __declspec(dllimport) #define LIBRAGEPHOTO_EXPORT __declspec(dllimport)
#endif #endif // LIBRAGEPHOTO_LIBRARY
#else #else
#define LIBRAGEPHOTO_EXPORT #define LIBRAGEPHOTO_EXPORT
#endif #endif // LIBRAGEPHOTO_STATIC
#else #else
#define LIBRAGEPHOTO_EXPORT #define LIBRAGEPHOTO_EXPORT
#endif #endif // _WIN32
/* RAGEPHOTO LIBRARY EXPORT END */
#endif // LIBRAGEPHOTO_GLOBAL_H #endif // LIBRAGEPHOTO_GLOBAL_H

View File

@ -6,4 +6,4 @@ Name: libragephoto
Description: Open Source RAGE Photo Parser for GTA V Description: Open Source RAGE Photo Parser for GTA V
Version: @PROJECT_VERSION@ Version: @PROJECT_VERSION@
Libs: -L${libdir} -lragephoto Libs: -L${libdir} -lragephoto
Cflags: -I${includedir} -D@LIBRAGEPHOTO_API@ -D@LIBRAGEPHOTO_LIBTYPE@ Cflags: -I${includedir}/RagePhoto