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()
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)

View File

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

View File

@ -2,7 +2,7 @@
<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
- Export RAGE Photos to jpeg with ragephoto-extract
- High Efficient and Simple C++ API

View File

@ -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 <unordered_map>
#include <functional>
#include <iostream>
@ -184,6 +182,7 @@ extern "C" {
#include <stdint.h>
#include <stdio.h>
#endif
/** \file RagePhoto.h */
/** RagePhoto C++ class typedef for C API. */
typedef void* ragephoto_t;

View File

@ -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 <iostream>
#include <cstdint>
@ -44,5 +45,6 @@ struct LIBRAGEPHOTO_EXPORT RagePhotoData
uint32_t titlBuffer;
uint32_t titlOffset;
};
#endif // __cplusplus
#endif // LIBRAGEPHOTO_DATA_H
#endif // RAGEPHOTODATA_H

View File

@ -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

View File

@ -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