Now the build output directory is generated completely

The data folder is now stored in the new assets folder, and copied
across as part of the build process.
This commit is contained in:
Clownacy 2019-06-17 19:13:29 +00:00
parent 3039e3b846
commit 49defcc3fb
871 changed files with 35 additions and 39 deletions

29
.gitignore vendored
View file

@ -4,35 +4,14 @@
# Exclude converted resource files
src/Resource
# Exclude .dat and .rec files in build directories (avoid Config.dat, 290.rec and others)
build_en/*.dat
build_en/*.rec
build_jp/*.dat
build_jp/*.rec
# Exclude build output directory
/game
# Exclude devilution-comparer assembly output
Exclude devilution-comparer assembly output
msvc2003/devilution/orig.asm
msvc2003/devilution/compare.asm
# Exclude build output on Linux (exclude normally produced executable files and out files)
build_en/CSE2
build_en/CSE2_debug
build_en/DoConfig
build_en/DoConfig_debug
build_jp/CSE2
build_jp/CSE2_debug
build_jp/DoConfig
build_jp/DoConfig_debug
build_en/*.out
build_jp/*.out
# Exclude PE executables in the build folder (and .exe.manifest files)
build_en/*.exe
build_en/*.exe.manifest
build_jp/*.exe
build_jp/*.exe.manifest
# Exclude the (recommended) CMake build directory
Exclude the (recommended) CMake build directory
build/*
# Exclude MSVC IntelliSense database

View file

@ -4,6 +4,9 @@ if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9
cmake_policy(SET CMP0069 NEW)
endif()
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/game")
set(ASSETS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/assets")
option(JAPANESE "Enable the Japanese-language build" OFF)
option(FIX_BUGS "Fix certain bugs (see src/Bug Fixes.txt)" OFF)
option(NONPORTABLE "Enable bits of code that aren't portable, but are what the original game used" OFF)
@ -221,11 +224,11 @@ set(RESOURCES
# Handle options
if(JAPANESE)
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build_jp")
set(DATA_DIRECTORY "${ASSETS_DIRECTORY}/data_jp")
list(APPEND RESOURCES "BITMAP/pixel_jp.bmp")
target_compile_definitions(CSE2 PRIVATE JAPANESE)
else()
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build_en")
set(DATA_DIRECTORY "${ASSETS_DIRECTORY}/data_en")
list(APPEND RESOURCES "BITMAP/pixel.bmp")
endif()
@ -283,7 +286,7 @@ set_target_properties(bin2h_tool PROPERTIES IMPORTED_LOCATION "${INSTALL_DIR}/bi
# Convert resources to header files
foreach(FILENAME IN LISTS RESOURCES)
set(IN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res")
set(IN_DIR "${ASSETS_DIRECTORY}/resources")
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Resource")
get_filename_component(DIRECTORY "${FILENAME}" DIRECTORY)
add_custom_command(
@ -321,6 +324,12 @@ set_target_properties(CSE2 PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${BUILD_DIRECTORY}
)
# Copy data folder to build directory
add_custom_command(TARGET CSE2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory "${BUILD_DIRECTORY}/data"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${DATA_DIRECTORY}" "${BUILD_DIRECTORY}/data"
)
# Enable link-time optimisation if available
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
@ -379,6 +388,7 @@ else()
target_link_libraries(CSE2 freetype)
endif()
##
# DoConfig
##

View file

@ -1,6 +1,9 @@
NATIVECC = cc
NATIVECXX = c++
BUILD_DIRECTORY = game
ASSETS_DIRECTORY = assets
ifeq ($(RELEASE), 1)
CXXFLAGS = -O3 -flto
LDFLAGS = -s
@ -11,11 +14,11 @@ else
endif
ifeq ($(JAPANESE), 1)
BUILD_DIR = build_jp
DATA_DIRECTORY = $(ASSETS_DIRECTORY)/data_jp
CXXFLAGS += -DJAPANESE
else
BUILD_DIR = build_en
DATA_DIRECTORY = $(ASSETS_DIRECTORY)/data_en
endif
FILENAME ?= $(FILENAME_DEF)
@ -199,32 +202,36 @@ ifneq ($(WINDOWS), 1)
RESOURCES += ICON/ICON_MINI.bmp
endif
OBJECTS = $(addprefix obj/$(BUILD_DIR)/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
DEPENDENCIES = $(addprefix obj/$(BUILD_DIR)/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
ifeq ($(WINDOWS), 1)
OBJECTS += obj/$(BUILD_DIR)/$(FILENAME)/win_icon.o
OBJECTS += obj/$(FILENAME)/win_icon.o
endif
all: $(BUILD_DIR)/$(FILENAME)
all: $(BUILD_DIRECTORY)/$(FILENAME) $(BUILD_DIRECTORY)/data
@echo Finished
$(BUILD_DIR)/$(FILENAME): $(OBJECTS)
$(BUILD_DIRECTORY)/data: $(DATA_DIRECTORY)
@rm -rf $(BUILD_DIRECTORY)/data
@cp -r $(DATA_DIRECTORY) $(BUILD_DIRECTORY)/data
$(BUILD_DIRECTORY)/$(FILENAME): $(OBJECTS)
@mkdir -p $(@D)
@echo Linking $@
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
obj/$(BUILD_DIR)/$(FILENAME)/%.o: src/%.cpp
obj/$(FILENAME)/%.o: src/%.cpp
@mkdir -p $(@D)
@echo Compiling $<
@$(CXX) $(CXXFLAGS) $< -o $@ -c
obj/$(BUILD_DIR)/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuffix .h, $(RESOURCES)))
@mkdir -p $(@D)
@echo Compiling $<
@$(CXX) $(CXXFLAGS) $< -o $@ -c
src/Resource/%.h: res/% obj/bin2h
src/Resource/%.h: $(ASSETS_DIRECTORY)/resources/% obj/bin2h
@mkdir -p $(@D)
@echo Converting $<
@obj/bin2h $< $@
@ -236,7 +243,7 @@ obj/bin2h: bin2h/bin2h.c
include $(wildcard $(DEPENDENCIES))
obj/$(BUILD_DIR)/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
@mkdir -p $(@D)
@windres $< $@

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 638 B

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Some files were not shown because too many files have changed in this diff Show more