diff --git a/CMakeLists.txt b/CMakeLists.txt index 5305da9..cb01d0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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( diff --git a/include/RDI.h b/include/RDI.h index 7eb34e9..5d68b09 100644 --- a/include/RDI.h +++ b/include/RDI.h @@ -49,7 +49,7 @@ namespace RDI public: RDI(); - ~RDI(); + virtual ~RDI(); /** * @brief Get the current library version. diff --git a/src/RDI.cpp b/src/RDI.cpp index 10fdc63..fdc7a00 100644 --- a/src/RDI.cpp +++ b/src/RDI.cpp @@ -28,6 +28,8 @@ namespace RDI { this->libVersion = PRG_VERSION; } + RDI::~RDI() {} + } diff --git a/src/bundle_struct.h b/src/bundle_struct.h index 22b52bb..636786d 100644 --- a/src/bundle_struct.h +++ b/src/bundle_struct.h @@ -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_ diff --git a/tools/RDIdebug.cpp b/tools/RDIdebug.cpp new file mode 100644 index 0000000..4bd7146 --- /dev/null +++ b/tools/RDIdebug.cpp @@ -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 +#include + + +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; +}