From 62194ead528d1dbe6945b340f72087fc99accf1f Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Tue, 8 Sep 2020 16:18:12 +0200 Subject: [PATCH 1/4] Change files naming --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4387beb..069324d 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CC=gcc CFLAGS= -Wall -O3 LDFLAGS= -lz -lpng -TARGET=RogueDE-texture +TARGET=RSE-Texture VERSION=1.0a SRC_DIR=src SRC= $(wildcard $(SRC_DIR)/*.c) @@ -30,4 +30,4 @@ $(TARGET): $(OBJS) clean: @rm -rf $(BUILD_DIR) - @rm -f RogueDE-* + @rm -f RSE-* From 15032331ee82528ccd70253e2305ebd9673bb596 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 9 Sep 2020 00:17:10 +0200 Subject: [PATCH 2/4] New CMakeFile to cross-compiling --- CMakeLists.txt | 50 ++++++++++++++++++++++++++++++++++++++++ Makefile => Makefile.old | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt rename Makefile => Makefile.old (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..458ac95 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +# CMakeLists.txt + +# Written by JackCarterSmith, 2020 +# This code is released under the RSE license. + +cmake_minimum_required(VERSION 3.1) +cmake_policy(VERSION 3.1) + +# define project +project(rse-texture VERSION 1.0.1 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C) +set(CMAKE_BUILD_TYPE Release) +set(RSE_TEX_NAME RSE_Texture-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) + +include(GNUInstallDirs) +#include(CheckTypeSize) +#include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckCSourceCompiles) + +# needed packages + +find_package(ZLIB REQUIRED) +include_directories(${ZLIB_INCLUDE_DIR}) +find_package(PNG REQUIRED) +include_directories(${PNG_INCLUDE_DIR}) + +# define src/headers files + +FILE(GLOB RSE_TEX_SRCS src/*.c) +FILE(GLOB RSE_TEX_HRDS src/*.h) +SOURCE_GROUP("Source Files" FILES ${RSE_TEX_SRCS}) +SOURCE_GROUP("Header Files" FILES ${RSE_TEX_HRDS}) + +# begin building RSE-Texture + +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +add_executable(rse-texture ${RSE_TEX_SRCS} ${RSE_TEX_HRDS}) +set_target_properties(rse-texture PROPERTIES OUTPUT_NAME ${RSE_TEX_NAME}) +if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(rse-texture PROPERTIES PREFIX "lib") + set_target_properties(rse-texture PROPERTIES IMPORT_PREFIX "lib") +endif() +target_link_libraries(rse-texture ${ZLIB_LIBRARIES} ${PNG_LIBRARIES}) + +# install executable + +install(TARGETS rse-texture + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/Makefile b/Makefile.old similarity index 97% rename from Makefile rename to Makefile.old index 069324d..89a49b8 100644 --- a/Makefile +++ b/Makefile.old @@ -4,7 +4,7 @@ CFLAGS= -Wall -O3 LDFLAGS= -lz -lpng TARGET=RSE-Texture -VERSION=1.0a +VERSION=1.0b SRC_DIR=src SRC= $(wildcard $(SRC_DIR)/*.c) INCLUDES=-I$(SRC_DIR) From b716d2434a59b5fc88a192eea61f05779cecd96e Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 9 Sep 2020 00:48:21 +0200 Subject: [PATCH 3/4] Implement CMake version control --- .gitignore | 2 ++ CMakeLists.txt | 4 +--- src/Texture-Extractor.h | 1 + src/config.h.in | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 src/config.h.in diff --git a/.gitignore b/.gitignore index eca47f8..c16edcd 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,5 @@ Release/ .cproject .project *.launch + +src/config.h \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 458ac95..ace9e99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,10 +10,8 @@ cmake_policy(VERSION 3.1) project(rse-texture VERSION 1.0.1 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C) set(CMAKE_BUILD_TYPE Release) set(RSE_TEX_NAME RSE_Texture-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY) -include(GNUInstallDirs) -#include(CheckTypeSize) -#include(CheckFunctionExists) include(CheckIncludeFile) include(CheckCSourceCompiles) diff --git a/src/Texture-Extractor.h b/src/Texture-Extractor.h index 6db89d2..a92aa5f 100644 --- a/src/Texture-Extractor.h +++ b/src/Texture-Extractor.h @@ -10,6 +10,7 @@ #include #include #endif +#include "config.h" #include "options.h" #include "HMT_Parser.h" #include "RS_images.h" diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..32f49cf --- /dev/null +++ b/src/config.h.in @@ -0,0 +1 @@ +#define VERSION "@PROJECT_VERSION@" From 1ed03aa123e08412589a631a2f9411af81be8134 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 9 Sep 2020 01:09:38 +0200 Subject: [PATCH 4/4] Cleaned old makefile --- .gitignore | 5 ++--- Makefile.old | 33 --------------------------------- 2 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 Makefile.old diff --git a/.gitignore b/.gitignore index c16edcd..5bb645a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ # Precompiled Headers *.gch *.pch +src/config.h # Libraries *.lib @@ -41,7 +42,7 @@ *.su *.idb *.pdb -testfiles/ +samples/ # Kernel Module Compile Results *.mod* @@ -59,5 +60,3 @@ Release/ .cproject .project *.launch - -src/config.h \ No newline at end of file diff --git a/Makefile.old b/Makefile.old deleted file mode 100644 index 89a49b8..0000000 --- a/Makefile.old +++ /dev/null @@ -1,33 +0,0 @@ -CC=gcc -#CFLAGS= -Wextra -Wall -O0 -g -CFLAGS= -Wall -O3 -LDFLAGS= -lz -lpng - -TARGET=RSE-Texture -VERSION=1.0b -SRC_DIR=src -SRC= $(wildcard $(SRC_DIR)/*.c) -INCLUDES=-I$(SRC_DIR) -BUILD_DIR=obj -OBJS= $(subst src,$(BUILD_DIR),$(SRC:%.c=%.o)) - - -.PHONY: $(BUILD_DIR) all clean - - -all: clean $(BUILD_DIR) $(TARGET) - - -$(BUILD_DIR)/%.o: src/%.c - $(CC) $(INCLUDES) -DVERSION='"$(VERSION)"' -c -o $@ $< $(CFLAGS) - -$(BUILD_DIR): - @mkdir -p $(BUILD_DIR) - -$(TARGET): $(OBJS) - $(CC) -o $@_$(VERSION) $^ $(LDFLAGS) - - -clean: - @rm -rf $(BUILD_DIR) - @rm -f RSE-*