Patched library garbage
All checks were successful
JCS-Prod/RSE-Texture/pipeline/pr-master This commit looks good
JCS-Prod/RSE-Texture/pipeline/head This commit looks good

This commit is contained in:
JackCarterSmith 2022-09-18 16:01:18 +02:00
parent 49fa1278ad
commit d6b94f8c79
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
3 changed files with 43 additions and 35 deletions

View File

@ -33,6 +33,7 @@ set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation d
# Compilation option # Compilation option
option(RSPTEXTURE_SHARED "Build shared lib" ON) option(RSPTEXTURE_SHARED "Build shared lib" ON)
option(RSPTEXTURE_STATIC "Build static lib" ON) option(RSPTEXTURE_STATIC "Build static lib" ON)
option(BUILD_TOOLS "Build lib tools" ON)
# Push compile infos to source # Push compile infos to source
@ -51,9 +52,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
unset(RSE_TEXTURE_TARGETS_LIST) unset(RSE_TEXTURE_TARGETS_LIST)
add_subdirectory(RSPTextureLib) add_subdirectory(RSPTextureLib)
add_subdirectory(RSETexture) add_subdirectory(RSETexture)
if(BUILD_TOOLS)
set(RSE_TEXTURE_TARGETS_LIST rse-texture)
endif()
if(RSPTEXTURE_SHARED) if(RSPTEXTURE_SHARED)
list(APPEND RSE_TEXTURE_TARGETS_LIST rsp-texture-lib) list(APPEND RSE_TEXTURE_TARGETS_LIST rsp-texture-lib)
endif() endif()
@ -66,6 +64,9 @@ if(NOT RSE_TEXTURE_TARGETS_LIST)
"Please enable at least one of the following options: " "Please enable at least one of the following options: "
"RSPTEXTURE_STATIC, RSPTEXTURE_SHARED") "RSPTEXTURE_STATIC, RSPTEXTURE_SHARED")
endif() endif()
if(BUILD_TOOLS)
list(APPEND RSE_TEXTURE_TARGETS_LIST rse-texture)
endif()
# GPG signature custom command # GPG signature custom command

View File

@ -10,37 +10,39 @@
include(CheckIncludeFile) include(CheckIncludeFile)
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
# Import needed packages and references their include path if(BUILD_TOOLS)
find_package(PNG 1.6.37 REQUIRED) # Import needed packages and references their include path
include_directories(${PNG_INCLUDE_DIR}) find_package(PNG 1.6.37 REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
# Define src/headers files # Define src/headers files
file(GLOB_RECURSE RSE_TEXTURE_SOURCES ./src/*.c) file(GLOB_RECURSE RSE_TEXTURE_SOURCES ./src/*.c)
source_group("Source Files" FILES ${RSE_TEXTURE_SOURCES}) source_group("Source Files" FILES ${RSE_TEXTURE_SOURCES})
# Building instructions for RSE-Texture # Building instructions for RSE-Texture
if(DEFINED ENV{CI}) if(DEFINED ENV{CI})
set(CMAKE_BUILD_TYPE RELEASE) set(CMAKE_BUILD_TYPE RELEASE)
endif() endif()
# Declare standalone application # Declare standalone application
add_executable(rse-texture ${RSE_TEXTURE_SOURCES}) add_executable(rse-texture ${RSE_TEXTURE_SOURCES})
set_property(TARGET rse-texture PROPERTY C_STANDARD 90) set_property(TARGET rse-texture PROPERTY C_STANDARD 90)
#target_include_directories(rse-texture PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) #target_include_directories(rse-texture PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
set_target_properties(rse-texture PROPERTIES OUTPUT_NAME ${RSE_TEXTURE_NAME}) set_target_properties(rse-texture PROPERTIES OUTPUT_NAME ${RSE_TEXTURE_NAME})
if(MSVC) if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name # msvc does not append 'lib' - do it here to have consistent name
set_target_properties(rse-texture PROPERTIES IMPORT_PREFIX "lib") set_target_properties(rse-texture PROPERTIES IMPORT_PREFIX "lib")
endif() endif()
# Link externals libraries to the linker # Link externals libraries to the linker
if(RSPTEXTURE_SHARED) if(RSPTEXTURE_SHARED)
target_link_libraries(rse-texture PRIVATE rsp-texture-lib ${PNG_LIBRARIES}) target_link_libraries(rse-texture PRIVATE rsp-texture-lib ${PNG_LIBRARIES})
elseif(RSPTEXTURE_STATIC) elseif(RSPTEXTURE_STATIC)
target_link_libraries(rse-texture PRIVATE rsp-texture-libstatic ${PNG_LIBRARIES}) target_link_libraries(rse-texture PRIVATE rsp-texture-libstatic ${PNG_LIBRARIES})
endif()
endif() endif()

View File

@ -34,14 +34,19 @@ typedef union u_rsptexture_parameters {
// Lib's structure definitions // Lib's structure definitions
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef MEMFILE #ifndef MEMFILE_DEF
typedef char* MEMFILE; typedef char* MEMFILE;
#define MEMFILE_DEF
#endif #endif
#ifndef T_R8G8B8
#ifndef T_R8G8B8_DEF
typedef struct r8g8b8 { unsigned char r,g,b; } T_R8G8B8; typedef struct r8g8b8 { unsigned char r,g,b; } T_R8G8B8;
#define T_R8G8B8_DEF
#endif #endif
#ifndef T_R8G8B8A8
#ifndef T_R8G8B8A8_DEF
typedef struct r8g8b8a8 { unsigned char r,g,b,a; } T_R8G8B8A8; typedef struct r8g8b8a8 { unsigned char r,g,b,a; } T_R8G8B8A8;
#define T_R8G8B8A8_DEF
#endif #endif
typedef enum e_mat_type { typedef enum e_mat_type {