CMake, Doc and README updates
CMake: add EM_ON EM_OFF and rename BUILD_* and WITH_* options to RAGEPHOTO_* Doc: change C++ API to C/C++ API README: change build libragephoto section and add the reworked CMake options
This commit is contained in:
parent
81675355b0
commit
aa9ac44f3e
3 changed files with 43 additions and 54 deletions
|
@ -27,6 +27,15 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
# RagePhoto CMake includes
|
# RagePhoto CMake includes
|
||||||
include(cmake/unicode.cmake)
|
include(cmake/unicode.cmake)
|
||||||
|
|
||||||
|
# RagePhoto WebAssembly ON/OFF
|
||||||
|
if (EMSCRIPTEN)
|
||||||
|
set(EM_ON ON)
|
||||||
|
set(EM_OFF OFF)
|
||||||
|
else()
|
||||||
|
set(EM_ON OFF)
|
||||||
|
set(EM_OFF ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# RagePhoto Source files
|
# RagePhoto Source files
|
||||||
set(RAGEPHOTO_HEADERS
|
set(RAGEPHOTO_HEADERS
|
||||||
src/RagePhoto.h
|
src/RagePhoto.h
|
||||||
|
@ -37,33 +46,25 @@ set(RAGEPHOTO_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
# RagePhoto Library Type
|
# RagePhoto Library Type
|
||||||
if (EMSCRIPTEN)
|
option(RAGEPHOTO_STATIC "Build libragephoto as static library" ${EM_ON})
|
||||||
option(BUILD_SHARED "Build libragephoto as shared library" OFF)
|
if (RAGEPHOTO_STATIC)
|
||||||
else()
|
option(RAGEPHOTO_C_API "Build libragephoto with C API support" ${EM_ON})
|
||||||
option(BUILD_SHARED "Build libragephoto as shared library" ON)
|
|
||||||
endif()
|
|
||||||
if (BUILD_SHARED)
|
|
||||||
option(WITH_C_API "Build libragephoto with C API support" ON)
|
|
||||||
set(LIBRAGEPHOTO_LIBTYPE LIBRAGEPHOTO_SHARED)
|
|
||||||
else()
|
|
||||||
if (EMSCRIPTEN)
|
|
||||||
option(WITH_C_API "Build libragephoto with C API support" ON)
|
|
||||||
else()
|
|
||||||
option(WITH_C_API "Build libragephoto with C API support" OFF)
|
|
||||||
endif()
|
|
||||||
set(LIBRAGEPHOTO_LIBTYPE LIBRAGEPHOTO_STATIC)
|
set(LIBRAGEPHOTO_LIBTYPE LIBRAGEPHOTO_STATIC)
|
||||||
|
else()
|
||||||
|
option(RAGEPHOTO_C_API "Build libragephoto with C API support" ON)
|
||||||
|
set(LIBRAGEPHOTO_LIBTYPE LIBRAGEPHOTO_SHARED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# RagePhoto Benchmark
|
# RagePhoto Benchmark
|
||||||
option(WITH_BENCHMARK "Build with libragephoto benchmark" OFF)
|
option(RAGEPHOTO_BENCHMARK "Build with libragephoto benchmark" OFF)
|
||||||
if (WITH_BENCHMARK)
|
if (RAGEPHOTO_BENCHMARK)
|
||||||
list(APPEND LIBRAGEPHOTO_DEFINES
|
list(APPEND LIBRAGEPHOTO_DEFINES
|
||||||
RAGEPHOTO_BENCHMARK
|
RAGEPHOTO_BENCHMARK
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# RagePhoto C API
|
# RagePhoto C API
|
||||||
if (WITH_C_API)
|
if (RAGEPHOTO_C_API)
|
||||||
set(LIBRAGEPHOTO_API LIBRAGEPHOTO_C_API)
|
set(LIBRAGEPHOTO_API LIBRAGEPHOTO_C_API)
|
||||||
list(APPEND RAGEPHOTO_HEADERS
|
list(APPEND RAGEPHOTO_HEADERS
|
||||||
src/RagePhotoA.h
|
src/RagePhotoA.h
|
||||||
|
@ -88,13 +89,13 @@ configure_file(src/libragephoto_global.h.in include/libragephoto_global.h @ONLY)
|
||||||
list(APPEND RAGEPHOTO_HEADERS
|
list(APPEND RAGEPHOTO_HEADERS
|
||||||
${PROJECT_BINARY_DIR}/include/libragephoto_global.h
|
${PROJECT_BINARY_DIR}/include/libragephoto_global.h
|
||||||
)
|
)
|
||||||
if (BUILD_SHARED)
|
if (RAGEPHOTO_STATIC)
|
||||||
|
add_library(ragephoto STATIC ${RAGEPHOTO_HEADERS} ${RAGEPHOTO_SOURCES} ${RAGEPHOTO_STATIC_RESOURCES})
|
||||||
|
else()
|
||||||
add_library(ragephoto SHARED ${RAGEPHOTO_HEADERS} ${RAGEPHOTO_SOURCES} ${RAGEPHOTO_SHARED_RESOURCES})
|
add_library(ragephoto SHARED ${RAGEPHOTO_HEADERS} ${RAGEPHOTO_SOURCES} ${RAGEPHOTO_SHARED_RESOURCES})
|
||||||
set_target_properties(ragephoto PROPERTIES
|
set_target_properties(ragephoto PROPERTIES
|
||||||
PREFIX "lib"
|
PREFIX "lib"
|
||||||
)
|
)
|
||||||
else()
|
|
||||||
add_library(ragephoto STATIC ${RAGEPHOTO_HEADERS} ${RAGEPHOTO_SOURCES} ${RAGEPHOTO_STATIC_RESOURCES})
|
|
||||||
endif()
|
endif()
|
||||||
target_compile_definitions(ragephoto PRIVATE
|
target_compile_definitions(ragephoto PRIVATE
|
||||||
LIBRAGEPHOTO_LIBRARY
|
LIBRAGEPHOTO_LIBRARY
|
||||||
|
@ -137,31 +138,31 @@ if (EMSCRIPTEN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# RagePhoto Documentation
|
# RagePhoto Documentation
|
||||||
option(WITH_DOCUMENTATION "Build libragephoto with documentation" OFF)
|
option(RAGEPHOTO_DOC "Build libragephoto with documentation" OFF)
|
||||||
if (WITH_DOCUMENTATION)
|
if (RAGEPHOTO_DOC)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# RagePhoto Examples
|
# RagePhoto Examples
|
||||||
option(WITH_GTK_EXAMPLE "Build libragephoto with GTK Photo Viewer" OFF)
|
option(RAGEPHOTO_EXAMPLE_GTKVIEWER "Build libragephoto with GTK Photo Viewer" OFF)
|
||||||
if (WITH_GTK_EXAMPLE)
|
if (RAGEPHOTO_EXAMPLE_GTKVIEWER)
|
||||||
add_subdirectory(examples/ragephoto-gtkviewer)
|
add_subdirectory(examples/ragephoto-gtkviewer)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(WITH_QT_EXAMPLE "Build libragephoto with Qt Photo Viewer" OFF)
|
option(RAGEPHOTO_EXAMPLE_QTVIEWER "Build libragephoto with Qt Photo Viewer" OFF)
|
||||||
if (WITH_QT_EXAMPLE)
|
if (RAGEPHOTO_EXAMPLE_QTVIEWER)
|
||||||
add_subdirectory(examples/ragephoto-qtviewer)
|
add_subdirectory(examples/ragephoto-qtviewer)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# RagePhoto Extract Tool
|
# RagePhoto Extract Tool
|
||||||
if (${CMAKE_PROJECT_NAME} STREQUAL "ragephoto")
|
if (${CMAKE_PROJECT_NAME} STREQUAL "ragephoto")
|
||||||
option(WITH_EXTRACT "Build libragephoto with ragephoto-extract" ON)
|
option(RAGEPHOTO_EXTRACT "Build libragephoto with ragephoto-extract" ON)
|
||||||
else()
|
else()
|
||||||
option(WITH_EXTRACT "Build libragephoto with ragephoto-extract" OFF)
|
option(RAGEPHOTO_EXTRACT "Build libragephoto with ragephoto-extract" OFF)
|
||||||
endif()
|
endif()
|
||||||
if (WITH_EXTRACT)
|
if (RAGEPHOTO_EXTRACT)
|
||||||
# RagePhoto-Extract Source files
|
# RagePhoto-Extract Source files
|
||||||
if (WITH_C_API)
|
if (RAGEPHOTO_C_API)
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
set(EXTRACT_SOURCES src/RagePhoto-Extract.c)
|
set(EXTRACT_SOURCES src/RagePhoto-Extract.c)
|
||||||
else()
|
else()
|
||||||
|
|
34
README.md
34
README.md
|
@ -9,33 +9,21 @@ Open Source RAGE Photo Parser for GTA V and RDR 2
|
||||||
#### Build libragephoto
|
#### Build libragephoto
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/Syping/libragephoto && cd libragephoto
|
git clone https://github.com/Syping/libragephoto
|
||||||
mkdir -p build && cd build
|
cmake -B libragephoto-build libragephoto
|
||||||
cmake ../
|
cmake --build libragephoto-build
|
||||||
make -j $(nproc --all)
|
sudo cmake --install libragephoto-build
|
||||||
sudo make install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Optional CMake flags
|
##### Optional CMake flags
|
||||||
`-DWITH_DOCUMENTATION=ON`
|
`-DRAGEPHOTO_C_API=OFF`
|
||||||
`-DWITH_EXTRACT=OFF`
|
`-DRAGEPHOTO_DOC=ON`
|
||||||
`-DWITH_GTK_EXAMPLE=ON`
|
`-DRAGEPHOTO_EXAMPLE_GTKVIEWER=ON`
|
||||||
`-DWITH_QT_EXAMPLE=ON`
|
`-DRAGEPHOTO_EXAMPLE_QTVIEWER=ON`
|
||||||
`-DBUILD_SHARED=OFF`
|
`-DRAGEPHOTO_EXTRACT=OFF`
|
||||||
|
`-DRAGEPHOTO_STATIC=ON`
|
||||||
|
|
||||||
#### How to Use libragephoto
|
#### RagePhoto API
|
||||||
|
|
||||||
```cpp
|
|
||||||
RagePhoto ragePhoto;
|
|
||||||
bool loaded = ragePhoto.load(data, size);
|
|
||||||
std::string photo = ragePhoto.photo();
|
|
||||||
const char* photoData = ragePhoto.photoData();
|
|
||||||
uint32_t photoSize = ragePhoto.photoSize();
|
|
||||||
std::string json = ragePhoto.json();
|
|
||||||
std::string title = ragePhoto.title();
|
|
||||||
RagePhoto::Error error = ragePhoto.error();
|
|
||||||
uint32_t format = ragePhoto.format(); // RagePhoto::GTA5 or RagePhoto::RDR2
|
|
||||||
```
|
|
||||||
|
|
||||||
[RagePhoto C API](https://libragephoto.syping.de/doc/RagePhotoC_8h.html)
|
[RagePhoto C API](https://libragephoto.syping.de/doc/RagePhotoC_8h.html)
|
||||||
[RagePhoto C++ API](https://libragephoto.syping.de/doc/classRagePhoto.html)
|
[RagePhoto C++ API](https://libragephoto.syping.de/doc/classRagePhoto.html)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
- Read/Write 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/C++ API
|
||||||
|
|
||||||
<b>Main Class:</b>
|
<b>Main Class:</b>
|
||||||
- RagePhoto
|
- RagePhoto
|
||||||
|
|
Loading…
Reference in a new issue