From 5794e55e59229f02928e4d71f3f241cb98098a02 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Thu, 11 Aug 2022 22:24:13 +0200 Subject: [PATCH] Minor settings update --- CMakeLists.txt | 75 +++++++++++++++++++++++++------------------ Jenkinsfile | 3 +- README.md | 7 ++-- conanfile.txt | 3 +- src/Model-Extractor.c | 3 ++ 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aabf86..7be0b65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,57 +1,69 @@ # CMakeLists.txt -# Written by JackCarterSmith, 2021 +#################################################### +# Written by JackCarterSmith, 2022 # This code is released under the RSE license. +#################################################### -cmake_minimum_required(VERSION 3.1) -cmake_policy(VERSION 3.1) + +# CMake requirement and general configuration +cmake_minimum_required(VERSION 3.12) +cmake_policy(VERSION 3.12) set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) - -# define project -add_definitions(-DCONF_NO_GL) -if(DEFINED ENV{CI}) - project(rse-model VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C) - set(RSE_MOD_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION}) -else() - project(rse-model VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C) - set(RSE_MOD_NAME RSE_Model-${PROJECT_VERSION}) +if(DEFINED ENV{MS_COMPATIBLE}) + set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY) include(CheckIncludeFile) include(CheckCSourceCompiles) -# needed packages +add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part -#find_package(GLEW REQUIRED) + +# Project definition +if(DEFINED ENV{CI}) # Jenkins CI integration mode + project(rse-model VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C) + set(RSE_MOD_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION}) +else() # Standalone project mode, should not be used for release. + project(rse-model VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C) + set(RSE_MOD_NAME RSE_Model-${PROJECT_VERSION}) +endif() +# Push compile infos to source +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY) + + +# Import needed packages and references their include path +#find_package(GLEW REQUIRED) # Enable when GL rendering is ready #include_directories(${GLEW_INCLUDE_DIR}) -# define src/headers files -FILE(GLOB_RECURSE RSE_MOD_SRCS src/*.c) -FILE(GLOB_RECURSE RSE_MOD_HRDS src/*.h) -SOURCE_GROUP("Source Files" FILES ${RSE_MOD_SRCS}) -SOURCE_GROUP("Header Files" FILES ${RSE_MOD_HRDS}) +# Define src/headers files +FILE(GLOB_RECURSE RSE_MOD_SOURCES src/*.c) +FILE(GLOB_RECURSE RSE_MOD_HEADERS src/*.h) +SOURCE_GROUP("Source Files" FILES ${RSE_MOD_SOURCES}) +SOURCE_GROUP("Header Files" FILES ${RSE_MOD_HEADERS}) -# begin building RSE-Model -#set(CMAKE_BUILD_TYPE Debug) +# Building instructions for RSE-Model +if(DEFINED ENV{RSE-WS}) + set(CMAKE_BUILD_TYPE DEBUG) +endif() #include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_executable(rse-model ${RSE_MOD_SRCS} ${RSE_MOD_HRDS}) -#set_property(TARGET rse-model PROPERTY C_STANDARD 99) -set_target_properties(rse-model PROPERTIES OUTPUT_NAME ${RSE_MOD_NAME}) +add_executable(rse-model ${RSE_MOD_SOURCES} ${RSE_MOD_HEADERS}) # Set the inputs for the compiler (srcs&hrds) +set_property(TARGET rse-model PROPERTY C_STANDARD 90) +set_target_properties(rse-model PROPERTIES OUTPUT_NAME ${RSE_MOD_NAME}) # Define the executable file name +# Link externals libraries to the linker if(MSVC) # msvc does not append 'lib' - do it here to have consistent name #set_target_properties(rse-model PROPERTIES PREFIX "lib") set_target_properties(rse-model PROPERTIES IMPORT_PREFIX "lib") -endif() -if(MSVC) - target_link_libraries(rse-model) + target_link_libraries(rse-model ${GLEW_LIBRARIES}) else() - target_link_libraries(rse-model m) + target_link_libraries(rse-model ${GLEW_LIBRARIES} m) endif() -# add GPG signature command + +# GPG signature custom command #add_custom_command( # OUTPUT "" # COMMAND gpg --batch --detach-sign @@ -61,7 +73,8 @@ endif() # VERBATIM #) -# install executable + +# Install project executable install(TARGETS rse-model RUNTIME DESTINATION bin ) \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index c5a2d07..55c6b33 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,8 +47,7 @@ pipeline { sh 'cp ../linux/build/${CI_OUTPUT_NAME}-${CI_VERSION}.${BUILD_NUMBER}* .' } dir("zip_win") { - // sh 'cp ../windows/build/${CI_OUTPUT_NAME}-${CI_VERSION}.${BUILD_NUMBER}* ../windows/build/*.dll .' - sh 'cp ../windows/build/${CI_OUTPUT_NAME}-${CI_VERSION}.${BUILD_NUMBER}* .' + sh 'cp ../windows/build/${CI_OUTPUT_NAME}-${CI_VERSION}.${BUILD_NUMBER}* ../windows/build/*.dll .' } zip archive: false, dir: 'zip_linux', exclude: '', glob: '', zipFile: 'x64.zip' sh 'mv x64.zip ${CI_OUTPUT_NAME}-${CI_VERSION}.${BUILD_NUMBER}_x64.zip' diff --git a/README.md b/README.md index 6a1b814..275bdee 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ All modules are independants. This is the **'MODEL'** module. ## MODEL MODULE -It's extract texture datas from Rogue Squadron 3D (PC) game models files (HOB). +It's extract 3D rendering datas from Rogue Squadron 3D (PC) game models files (HOB). This module can do: - Extract objects inside HOB files to Wavefront OBJ format, @@ -21,7 +21,7 @@ This module can do: ## TODO - Add textures to models. -- Discover all unknow fields, animation, bones mesh, etc. +- Discover all unknowns fields, animations, bones mesh, etc. ### Using @@ -35,8 +35,9 @@ Due to issue with copyrights, I can't provide samples... You need to extract HOB ### Options - -h Print this message -- -v Activate verbose output +- -v,-vv Activate verbose/debug output mode respectively - -no-subdir Extract textures directly inside current folder +- -no-mtl Disable materials datas export with OBJ model ### Dependencies diff --git a/conanfile.txt b/conanfile.txt index d0e7072..6c8fd0c 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -8,4 +8,5 @@ cmake_find_package [options] glew:shared=True -[imports] \ No newline at end of file +[imports] +bin, *.dll -> . \ No newline at end of file diff --git a/src/Model-Extractor.c b/src/Model-Extractor.c index e4b8c0f..1ddf391 100644 --- a/src/Model-Extractor.c +++ b/src/Model-Extractor.c @@ -118,9 +118,12 @@ static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char opt_ptr->verbose_mode = 1; printf("[OPTN] Verbose enabled.\n"); } else if (strcmp(p_args[i], "-vv") == 0) { + opt_ptr->verbose_mode = 1; opt_ptr->debug_mode = 1; printf("[OPTN] Debug enabled.\n"); } else if (strcmp(p_args[i], "-vvv") == 0) { + opt_ptr->verbose_mode = 1; + opt_ptr->debug_mode = 1; opt_ptr->god_mode = 1; printf("[OPTN] God damn it!\n"); } else if (strcmp(p_args[i], "-no-subdir") == 0) {