The build folder is now automatically generated
This way, we don't need to tell everyone who uses the enhanced branch that they need to copy res/data_en. It also gives the CMake project a way to bundle everything into a neat little folder.
14
.gitignore
vendored
|
@ -3,7 +3,7 @@
|
|||
|
||||
# Misc
|
||||
/obj
|
||||
/build/data*
|
||||
/build
|
||||
*.dat
|
||||
*.rec
|
||||
build.7z
|
||||
|
@ -13,10 +13,10 @@ build.zip
|
|||
*.exe
|
||||
|
||||
# MSVC trash
|
||||
msvc2003/CSE2.ncb
|
||||
msvc2003/CSE2.suo
|
||||
msvc2003/Debug
|
||||
msvc2003/Release
|
||||
msvc2003/Debug (Japanese)
|
||||
msvc2003/Release (Japanese)
|
||||
msvc/msvc2003/CSE2.ncb
|
||||
msvc/msvc2003/CSE2.suo
|
||||
msvc/msvc2003/Debug
|
||||
msvc/msvc2003/Release
|
||||
msvc/msvc2003/Debug (Japanese)
|
||||
msvc/msvc2003/Release (Japanese)
|
||||
*.aps
|
||||
|
|
|
@ -220,9 +220,11 @@ set(RESOURCES
|
|||
|
||||
# Handle options
|
||||
if (JAPANESE)
|
||||
set(FILES_DIR "res/files_jp")
|
||||
list(APPEND RESOURCES "BITMAP/PIXEL_JP.bmp")
|
||||
target_compile_definitions(CSE2 PRIVATE JAPANESE)
|
||||
else()
|
||||
set(FILES_DIR "res/files_en")
|
||||
list(APPEND RESOURCES "BITMAP/PIXEL.bmp")
|
||||
endif()
|
||||
|
||||
|
@ -240,7 +242,7 @@ endif()
|
|||
|
||||
# Make some tweaks if we're targetting Windows
|
||||
if (WIN32)
|
||||
target_sources(CSE2 PRIVATE "res/ICON/ICON.rc")
|
||||
target_sources(CSE2 PRIVATE "res/resources/ICON/ICON.rc")
|
||||
target_compile_definitions(CSE2 PRIVATE WINDOWS)
|
||||
set_target_properties(CSE2 PROPERTIES WIN32_EXECUTABLE YES) # Disable the console window
|
||||
else()
|
||||
|
@ -248,9 +250,9 @@ else()
|
|||
endif()
|
||||
|
||||
# Magic to convert resources to header files
|
||||
add_executable(bin2h res/bin2h.c)
|
||||
add_executable(bin2h src/misc/bin2h.c)
|
||||
foreach(FILENAME IN LISTS RESOURCES)
|
||||
set(IN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res")
|
||||
set(IN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res/resources")
|
||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Resource")
|
||||
get_filename_component(DIRECTORY "${FILENAME}" DIRECTORY)
|
||||
add_custom_command(
|
||||
|
@ -335,3 +337,12 @@ endif()
|
|||
target_include_directories(CSE2 PRIVATE ${SDL2_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS})
|
||||
target_compile_options(CSE2 PRIVATE ${SDL2_CFLAGS_OTHER} ${FREETYPE_CFLAGS_OTHER})
|
||||
target_link_libraries(CSE2 ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})
|
||||
|
||||
# Set up the output directory
|
||||
add_custom_command(TARGET CSE2 PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
|
||||
|
||||
set_target_properties(CSE2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
|
||||
|
||||
add_custom_command(TARGET CSE2 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${FILES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/cavestory")
|
||||
|
|
20
Makefile
|
@ -200,9 +200,19 @@ ifeq ($(WINDOWS), 1)
|
|||
OBJECTS += obj/$(FILENAME)/win_icon.o
|
||||
endif
|
||||
|
||||
all: build/$(FILENAME)
|
||||
all: build
|
||||
|
||||
build/$(FILENAME): $(OBJECTS)
|
||||
ifeq ($(JAPANESE), 1)
|
||||
build: res/files_jp obj/$(FILENAME)/$(FILENAME)
|
||||
else
|
||||
build: res/files_en obj/$(FILENAME)/$(FILENAME)
|
||||
endif
|
||||
@mkdir -p $(@D)
|
||||
@echo "Copying files to 'build'"
|
||||
@cp -r $< $@
|
||||
@cp obj/$(FILENAME)/$(FILENAME) $@
|
||||
|
||||
obj/$(FILENAME)/$(FILENAME): $(OBJECTS)
|
||||
@mkdir -p $(@D)
|
||||
@echo Linking
|
||||
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||
|
@ -218,19 +228,19 @@ obj/$(FILENAME)/Resource.o: src/Resource.cpp $(addprefix src/Resource/, $(addsuf
|
|||
@echo Compiling $<
|
||||
@$(CXX) $(CXXFLAGS) $< -o $@ -c
|
||||
|
||||
src/Resource/%.h: res/% obj/bin2h
|
||||
src/Resource/%.h: res/resources/% obj/bin2h
|
||||
@mkdir -p $(@D)
|
||||
@echo Converting $<
|
||||
@obj/bin2h $< $@
|
||||
|
||||
obj/bin2h: res/bin2h.c
|
||||
obj/bin2h: src/misc/bin2h.c
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $^
|
||||
@$(CC) -O3 -s -std=c90 $^ -o $@
|
||||
|
||||
include $(wildcard $(DEPENDENCIES))
|
||||
|
||||
obj/$(FILENAME)/win_icon.o: res/ICON/ICON.rc res/ICON/0.ico res/ICON/ICON_MINI.ico
|
||||
obj/$(FILENAME)/win_icon.o: res/resources/ICON/ICON.rc res/resources/ICON/0.ico res/resources/ICON/ICON_MINI.ico
|
||||
@mkdir -p $(@D)
|
||||
@windres $< $@
|
||||
|
||||
|
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |