1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.

This commit is contained in:
CRTkafa 2026-10-22 16:30:40 +08:00
parent c3b032a45a
commit 0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions

31
port/Makefile Normal file
View file

@ -0,0 +1,31 @@
# First link of the port (HANDOFF task 8). Runs on the MacBook build node (arm64, clang++, make).
# usage (in the synced tree, e.g. ~/choc3-link): make -C port -j8 -k (build dir: port/build, gitignored)
# Same compile flags as docs/port/PORTING.md step 5, but compiling instead of -fsyntax-only.
ROOT := $(abspath ..)
P := $(ROOT)/parity-out/thirdparty
BUILD ?= build
SRC := $(shell find src game external -name '*.cpp' -o -name '*.mm' | sort)
# sdk-only files that are compiled but not linked: the shipped game contains no TDisplay/TDisplayImpl and no
# TFlatFileMap/TFileMapHandler symbol (nothing uses them; their bodies of TDisplayImpl/TFileMapHandler are unknown).
NOLINK := src/core/display.cpp src/core/flatfilemap.cpp
ALLOBJ := $(patsubst %,$(BUILD)/%.o,$(SRC))
OBJ := $(filter-out $(patsubst %,$(BUILD)/%.o,$(NOLINK)),$(ALLOBJ))
INC := -Iinclude -Isrc/core -Isrc/gl -Isrc/mac -Igame -I$(P)/build/lua-5.0.2/src -I$(P)/src/libogg-1.0/include \
-I$(P)/src/libvorbis-1.0/include -I$(P)/build/jpeg-6b -I$(P)/src/libpng-1.2.5 -I$(P)/src/zlib-1.2.1 \
-I$(P)/build/jasper-1.900.1/src/libjasper/include -I$(P)/src/libpng-1.2.5/contrib/visupng -Iexternal/openal
CXXFLAGS := -std=c++17 -DNDEBUG -DBOOST_NO_AUTO_PTR -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -DGL_SILENCE_DEPRECATION -w $(INC)
LIBS := $(P)/lib/libvorbisfile.a $(P)/lib/libvorbis.a $(P)/lib/libogg.a $(P)/lib/libpng.a $(P)/lib/libjasper.a \
$(P)/lib/libjpeg.a $(P)/lib/liblua.a $(P)/lib/libz.a
FRAMEWORKS := -framework Carbon -framework OpenGL -framework CoreAudio -framework AudioToolbox \
-framework AudioUnit -framework CoreFoundation -framework Foundation -framework WebKit -framework AppKit
all: $(BUILD)/choc3port $(ALLOBJ)
$(BUILD)/choc3port: $(OBJ)
clang++ -o $@ $(OBJ) $(LIBS) $(FRAMEWORKS) 2> $(BUILD)/link.log || { grep -c . $(BUILD)/link.log; exit 1; }
$(BUILD)/%.cpp.o: %.cpp
@mkdir -p $(dir $@)
clang++ $(CXXFLAGS) -c $< -o $@
$(BUILD)/%.mm.o: %.mm
@mkdir -p $(dir $@)
clang++ $(CXXFLAGS) -x objective-c++ -c $< -o $@
clean:
rm -rf $(BUILD)