Added debug tool

This commit is contained in:
JackCarterSmith 2022-09-17 12:26:51 +02:00
parent 494bb6246e
commit 4b88be8299
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
5 changed files with 55 additions and 5 deletions

View File

@ -35,6 +35,7 @@ set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation d
# Compilation option
option(RDI_SHARED "Build shared lib" ON)
option(RDI_STATIC "Build static lib" ON)
option(BUILD_TOOLS "Build lib tools" ON)
# Push compile infos to source
@ -60,10 +61,6 @@ if(DEFINED ENV{CI})
set(CMAKE_BUILD_TYPE RELEASE)
endif()
#if(BUILD_TOOLS)
# set(RDI_TARGETS_LIST rdi-tools)
#endif()
# Declare the shared library instance
if(RDI_SHARED)
add_library(rdi-lib SHARED ${RDI_LIB_SOURCES})
@ -124,6 +121,29 @@ if(NOT RDI_TARGETS_LIST)
"RDI_STATIC, RDI_SHARED")
endif()
if(BUILD_TOOLS)
# Add lib debug tool to buildchain
file(GLOB_RECURSE RDI_TOOLS_SOURCES ./tools/*.cpp ./tools/*.c)
source_group("Tools src files" FILES ${RDI_TOOLS_SOURCES})
add_executable(rdi-debug-tools ${RDI_TOOLS_SOURCES})
set_property(TARGET rdi-debug-tools PROPERTY C_STANDARD 90)
set_target_properties(rdi-debug-tools PROPERTIES OUTPUT_NAME "RDI-debug")
set(RDI_TARGETS_LIST rdi-debug-tools)
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(rdi-debug-tools PROPERTIES IMPORT_PREFIX "lib")
endif()
if(RDI_SHARED)
target_link_libraries(rdi-debug-tools PRIVATE rdi-lib)
elseif(RDI_STATIC)
target_link_libraries(rdi-debug-tools PRIVATE rdi-libstatic)
endif()
endif()
# GPG signature custom command
#add_custom_command(

View File

@ -49,7 +49,7 @@ namespace RDI
public:
RDI();
~RDI();
virtual ~RDI();
/**
* @brief Get the current library version.

View File

@ -28,6 +28,8 @@ namespace RDI {
this->libVersion = PRG_VERSION;
}
RDI::~RDI() {}
}

View File

@ -5,6 +5,8 @@
* @copyright GPL-v3.0
* @brief Bundle (000/001) file mapping definition.
*
* @todo Should not be used for now, bundle files contains game menu elements. May be for graph assets?
*
*/
#ifndef BUNDLE_STRUCT_H_

26
tools/RDIdebug.cpp Normal file
View File

@ -0,0 +1,26 @@
/**
* @file RDIdebug.cpp
* @date 17/09/2022
* @author JackCarterSmith
* @copyright GPL-v3.0
* @brief Debug app to test functions of RDI library.
*
*/
#include <iostream>
#include <RDI.h>
using namespace std;
using namespace RDI;
int main( int argc, char *argv[] ) {
RDI::RDI *hRDI = nullptr;
hRDI = new RDI::RDI();
printf("Using RDI lib v%s\n", hRDI->getLibVersion().c_str());
delete hRDI;
}