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.
29
.gitignore
vendored
|
@ -4,35 +4,14 @@
|
||||||
# Exclude converted resource files
|
# Exclude converted resource files
|
||||||
src/Resource
|
src/Resource
|
||||||
|
|
||||||
# Exclude .dat and .rec files in build directories (avoid Config.dat, 290.rec and others)
|
# Exclude build output directory
|
||||||
build_en/*.dat
|
/game
|
||||||
build_en/*.rec
|
|
||||||
build_jp/*.dat
|
|
||||||
build_jp/*.rec
|
|
||||||
|
|
||||||
# Exclude devilution-comparer assembly output
|
Exclude devilution-comparer assembly output
|
||||||
msvc2003/devilution/orig.asm
|
msvc2003/devilution/orig.asm
|
||||||
msvc2003/devilution/compare.asm
|
msvc2003/devilution/compare.asm
|
||||||
|
|
||||||
# Exclude build output on Linux (exclude normally produced executable files and out files)
|
Exclude the (recommended) CMake build directory
|
||||||
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
|
|
||||||
build/*
|
build/*
|
||||||
|
|
||||||
# Exclude MSVC IntelliSense database
|
# Exclude MSVC IntelliSense database
|
||||||
|
|
|
@ -4,6 +4,9 @@ if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9
|
||||||
cmake_policy(SET CMP0069 NEW)
|
cmake_policy(SET CMP0069 NEW)
|
||||||
endif()
|
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(JAPANESE "Enable the Japanese-language build" OFF)
|
||||||
option(FIX_BUGS "Fix certain bugs (see src/Bug Fixes.txt)" 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)
|
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
|
# Handle options
|
||||||
if(JAPANESE)
|
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")
|
list(APPEND RESOURCES "BITMAP/pixel_jp.bmp")
|
||||||
target_compile_definitions(CSE2 PRIVATE JAPANESE)
|
target_compile_definitions(CSE2 PRIVATE JAPANESE)
|
||||||
else()
|
else()
|
||||||
set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build_en")
|
set(DATA_DIRECTORY "${ASSETS_DIRECTORY}/data_en")
|
||||||
list(APPEND RESOURCES "BITMAP/pixel.bmp")
|
list(APPEND RESOURCES "BITMAP/pixel.bmp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -283,7 +286,7 @@ set_target_properties(bin2h_tool PROPERTIES IMPORTED_LOCATION "${INSTALL_DIR}/bi
|
||||||
|
|
||||||
# Convert resources to header files
|
# Convert resources to header files
|
||||||
foreach(FILENAME IN LISTS RESOURCES)
|
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")
|
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Resource")
|
||||||
get_filename_component(DIRECTORY "${FILENAME}" DIRECTORY)
|
get_filename_component(DIRECTORY "${FILENAME}" DIRECTORY)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
@ -321,6 +324,12 @@ set_target_properties(CSE2 PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${BUILD_DIRECTORY}
|
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
|
# Enable link-time optimisation if available
|
||||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
|
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
|
||||||
|
@ -379,6 +388,7 @@ else()
|
||||||
target_link_libraries(CSE2 freetype)
|
target_link_libraries(CSE2 freetype)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# DoConfig
|
# DoConfig
|
||||||
##
|
##
|
||||||
|
|
29
Makefile
|
@ -1,6 +1,9 @@
|
||||||
NATIVECC = cc
|
NATIVECC = cc
|
||||||
NATIVECXX = c++
|
NATIVECXX = c++
|
||||||
|
|
||||||
|
BUILD_DIRECTORY = game
|
||||||
|
ASSETS_DIRECTORY = assets
|
||||||
|
|
||||||
ifeq ($(RELEASE), 1)
|
ifeq ($(RELEASE), 1)
|
||||||
CXXFLAGS = -O3 -flto
|
CXXFLAGS = -O3 -flto
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
|
@ -11,11 +14,11 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(JAPANESE), 1)
|
ifeq ($(JAPANESE), 1)
|
||||||
BUILD_DIR = build_jp
|
DATA_DIRECTORY = $(ASSETS_DIRECTORY)/data_jp
|
||||||
|
|
||||||
CXXFLAGS += -DJAPANESE
|
CXXFLAGS += -DJAPANESE
|
||||||
else
|
else
|
||||||
BUILD_DIR = build_en
|
DATA_DIRECTORY = $(ASSETS_DIRECTORY)/data_en
|
||||||
endif
|
endif
|
||||||
|
|
||||||
FILENAME ?= $(FILENAME_DEF)
|
FILENAME ?= $(FILENAME_DEF)
|
||||||
|
@ -199,32 +202,36 @@ ifneq ($(WINDOWS), 1)
|
||||||
RESOURCES += ICON/ICON_MINI.bmp
|
RESOURCES += ICON/ICON_MINI.bmp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJECTS = $(addprefix obj/$(BUILD_DIR)/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
OBJECTS = $(addprefix obj/$(FILENAME)/, $(addsuffix .o, $(SOURCES)))
|
||||||
DEPENDENCIES = $(addprefix obj/$(BUILD_DIR)/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
|
DEPENDENCIES = $(addprefix obj/$(FILENAME)/, $(addsuffix .o.d, $(SOURCES)))
|
||||||
|
|
||||||
ifeq ($(WINDOWS), 1)
|
ifeq ($(WINDOWS), 1)
|
||||||
OBJECTS += obj/$(BUILD_DIR)/$(FILENAME)/win_icon.o
|
OBJECTS += obj/$(FILENAME)/win_icon.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(BUILD_DIR)/$(FILENAME)
|
all: $(BUILD_DIRECTORY)/$(FILENAME) $(BUILD_DIRECTORY)/data
|
||||||
@echo Finished
|
@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)
|
@mkdir -p $(@D)
|
||||||
@echo Linking $@
|
@echo Linking $@
|
||||||
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
|
|
||||||
obj/$(BUILD_DIR)/$(FILENAME)/%.o: src/%.cpp
|
obj/$(FILENAME)/%.o: src/%.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $<
|
@echo Compiling $<
|
||||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
@$(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)
|
@mkdir -p $(@D)
|
||||||
@echo Compiling $<
|
@echo Compiling $<
|
||||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||||
|
|
||||||
src/Resource/%.h: res/% obj/bin2h
|
src/Resource/%.h: $(ASSETS_DIRECTORY)/resources/% obj/bin2h
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@echo Converting $<
|
@echo Converting $<
|
||||||
@obj/bin2h $< $@
|
@obj/bin2h $< $@
|
||||||
|
@ -236,7 +243,7 @@ obj/bin2h: bin2h/bin2h.c
|
||||||
|
|
||||||
include $(wildcard $(DEPENDENCIES))
|
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)
|
@mkdir -p $(@D)
|
||||||
@windres $< $@
|
@windres $< $@
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 638 B |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |