/Makefile (91e57f285f7909d8fff004e19d0852ae8a5ab620) (13691 bytes) (mode 100644) (type blob)
PROGRAM=rsod
PROGRAM_DRMFREE=rsod-engine
INCLUDES=include/*.h
# Change the value of CXXSTD depending on what is supported by your compiler. Older compilers may require c++1z
CXXSTD=c++17
# SDL2
SDL2_VER=2.30.3
SDL2_DIR=SDL2-$(SDL2_VER)
SDL2_TAR=$(SDL2_DIR).tar.gz
SDL2_WIN_TAR=SDL2-devel-$(SDL2_VER)-mingw.tar.gz
# Bullet
BULLET_OPTIONS=-DUSE_DOUBLE_PRECISION=ON -DNO_OPENGL3=ON -DBUILD_CPU_DEMOS=OFF -DBUILD_OPENGL3_DEMOS=OFF -DBUILD_BULLET2_DEMOS=OFF -DBUILD_EXTRAS=OFF -DBUILD_UNIT_TESTS=OFF
BULLET_VER=3.09
BULLET_DIR=bullet3-$(BULLET_VER)
BULLET_TAR=$(BULLET_VER).tar.gz
BULLET_DYNAMICS=libBulletDynamics.a
BULLET_COLLISION=libBulletCollision.a
BULLET_LINEARMATH=libLinearMath.a
BULLET_LINKS=-l:$(BULLET_DYNAMICS) -l:$(BULLET_COLLISION) -l:$(BULLET_LINEARMATH)
# Object files.
OBJECTS_LIN=qm.o fdungeon.o inventory.o libs.o
OBJECTS_WIN=qm-win.o fdungeon-win.o inventory-win.o libs-win.o
LINCC := gcc -march=x86-64
LINCXX := $(CXX) -march=x86-64
#LINCXX := $(CXX) -m32
CXXFLAGS=-Iinclude -Isrc -I$(BULLET_DIR)/src -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors
CXXDYNAMIC=$(LINCXX) $(CXXFLAGS) -O3 -o $(PROGRAM)-dynamic src/$(PROGRAM).cpp $(OBJECTS_LIN) -Wl,-rpath,. -L. -l:libSDL2.so -pthread -lsteam_api $(BULLET_LINKS) $(shell pkg-config --libs gtk+-3.0)
MACCXX := clang++ -march=x86-64
WINCC := i686-w64-mingw32-gcc-posix -march=pentium4 -static-libgcc -Iinclude-win
WINCXX := i686-w64-mingw32-g++-posix -march=pentium4 -static-libgcc -static-libstdc++ -Iinclude-win
WIN_CMAKE_FLAGS=-DCMAKE_C_COMPILER=i686-w64-mingw32-gcc-win32 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++-win32 -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1
MAC_BULLET_DYNAMICS=libBulletDynamics-mac.a
MAC_BULLET_COLLISION=libBulletCollision-mac.a
MAC_BULLET_LINEARMATH=libLinearMath-mac.a
MAC_BULLET_LINKS=$(MAC_BULLET_DYNAMICS) $(MAC_BULLET_COLLISION) $(MAC_BULLET_LINEARMATH)
WIN_BULLET_DYNAMICS=libBulletDynamics-win.a
WIN_BULLET_COLLISION=libBulletCollision-win.a
WIN_BULLET_LINEARMATH=libLinearMath-win.a
WIN_BULLET_LINKS=$(WIN_BULLET_DYNAMICS) $(WIN_BULLET_COLLISION) $(WIN_BULLET_LINEARMATH)
WEB_PREFIX=sudo docker run --rm -v $(shell pwd):/src -u emscripten trzeci/emscripten
WEB_FLAGS_LEGACY=-s TOTAL_MEMORY=134217728
WEB_FLAGS_NEW=-s INITIAL_MEMORY=134217728
WEB_FLAGS=$(WEB_FLAGS_LEGACY) -fno-rtti -fno-exceptions --llvm-lto 1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1 -s "ENVIRONMENT='web'" -s USE_SDL=0 -s SIMD=0 -s WASM=0 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['Pointer_stringify']" --preload-file data
WEB_SDL_OPT=--disable-render --disable-render-d3d --disable-directx --disable-video-vulkan --disable-filesystem --disable-diskaudio --disable-dummyaudio --disable-libudev --disable-haptic
WEB_SDL_CONFIGURE=emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo $(WEB_SDL_OPT)
WEB_BULLET_DYNAMICS=libBulletDynamics-web.a
WEB_BULLET_COLLISION=libBulletCollision-web.a
WEB_BULLET_LINEARMATH=libLinearMath-web.a
WEB_BULLET_LINKS=$(WEB_BULLET_DYNAMICS) $(WEB_BULLET_COLLISION) $(WEB_BULLET_LINEARMATH)
default: $(PROGRAM_DRMFREE)
drmfree: $(PROGRAM_DRMFREE) $(PROGRAM_DRMFREE).exe
demo: $(PROGRAM)-demo $(PROGRAM)-demo.exe
# CodeBlocks target for GNU/Linux.
Release: $(PROGRAM_DRMFREE)
mkdir -p bin/Release
cp -f $(PROGRAM_DRMFREE) bin/Release/rsod
$(PROGRAM_DRMFREE): $(OBJECTS_LIN) $(BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for GNU/Linux with dynamic SDL.
$(RM) libSDL2.a
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -o $@ src/$(PROGRAM).cpp $(OBJECTS_LIN) \
-Wl,-rpath,. -L. -ldl -pthread -lSDL2 $(BULLET_LINKS) $(shell pkg-config --libs gtk+-3.0)
$(PROGRAM)-static: $(OBJECTS_LIN) libSDL2.a $(BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for GNU/Linux with static SDL.
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -o $@ src/$(PROGRAM).cpp $(OBJECTS_LIN) libSDL2.a \
-Wl,-rpath,. -L. -ldl -pthread $(BULLET_LINKS) $(shell pkg-config --libs gtk+-3.0)
$(PROGRAM)-xr: $(OBJECTS_LIN) xr.o libSDL2.a $(BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
# Building OpenXR version for GNU/Linux.
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__OPENXR__ -o $@ src/$(PROGRAM).cpp $(OBJECTS_LIN) xr.o libSDL2.a \
-Wl,-rpath,. -L. -ldl -pthread $(BULLET_LINKS) $(shell pkg-config --libs gtk+-3.0) -lGLX -lopenxr_loader
$(PROGRAM)-dynamic: $(OBJECTS_LIN) src/$(PROGRAM).cpp $(INCLUDES)
$(CXXDYNAMIC)
$(PROGRAM)-steam: $(OBJECTS_LIN) libSDL2.a $(BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__STEAM__ -o $@ src/$(PROGRAM).cpp $(OBJECTS_LIN) libSDL2.a \
-Wl,-rpath,. -L. -ldl -pthread -lsteam_api $(BULLET_LINKS) $(shell pkg-config --libs gtk+-3.0)
debug: clean $(OBJECTS_LIN) $(BULLET_DYNAMICS) src/$(PROGRAM).cpp
$(LINCXX) -Iinclude -Isrc -I$(BULLET_DIR)/src -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors -g -D__DEBUG__ -o $@ src/$(PROGRAM).cpp $(OBJECTS_LIN) \
-Wl,-rpath,. -L. -ldl -pthread -lSDL2 $(BULLET_LINKS) $(shell pkg-config --libs gtk+-3.0)
lint:
clang-tidy src/$(PROGRAM).cpp -checks=cert-*-cpp -- $(CXXDYNAMIC)
qm.o: include/qm.c
$(LINCC) -std=c99 -Wall $(shell pkg-config --cflags gtk+-3.0) include/qm.c -c -o $@
qm-win.o: include/qm.c
$(WINCC) -std=c99 -Wall include/qm.c -c -o $@
wfcgen: src/wfcgen.cpp
$(LINCXX) -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors -static-libgcc -static-libstdc++ -g -o $@ src/$@.cpp
obj2bin: src/obj2bin.cpp
$(LINCXX) -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors -static-libgcc -static-libstdc++ -g -o $@ src/$@.cpp
obj2anib: src/obj2anib.cpp
$(LINCXX) -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors -static-libgcc -static-libstdc++ -g -o $@ src/$@.cpp
$(PROGRAM)-demo: $(OBJECTS_LIN) libSDL2.a src/$(PROGRAM).cpp $(INCLUDES)
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__STEAM__ -D__DEMO__ -o $@ src/$(PROGRAM).cpp $(OBJECTS_LIN) libSDL2.a \
-Wl,-rpath,. -L. -ldl -pthread -lsteam_api $(BULLET_LINKS)
$(PROGRAM)-demo.exe: $(OBJECTS_WIN) $(WIN_BULLET_DYNAMICS) SDL2.dll include-win/SDL2 src/$(PROGRAM).cpp $(INCLUDES)
$(WINCXX) $(CXXFLAGS) -mwindows -O3 -D__STEAM__ -D__DEMO__ -o $@ src/$(PROGRAM).cpp $(OBJECTS_WIN) \
-L. -lmingw32 -l:SDL2.dll -l:libSDL2main.a -l:steam_api.dll $(WIN_BULLET_LINKS) \
-static -lpthread
fdungeon.o: src/fdungeon.cpp include/avatar.h include/particle.h $(INCLUDES)
$(LINCXX) $(CXXFLAGS) -O3 src/fdungeon.cpp -c -o $@
inventory.o: src/inventory.cpp $(INCLUDES) fdungeon.o
$(LINCXX) $(CXXFLAGS) -O3 src/inventory.cpp -c -o $@
libs.o: src/libs.cpp include/tm_json.h
$(LINCXX) $(CXXFLAGS) -O3 src/libs.cpp -c -o $@
xr.o: src/xr.cpp
$(LINCXX) $(CXXFLAGS) -O3 src/xr.cpp -c -o $@
# Build SDL2 for Linux as compatibly as possible.
libSDL2.a: $(SDL2_DIR)
rm -r -f $(SDL2_DIR)/build
mkdir -p $(SDL2_DIR)/build
export CC="$(LINCC)" ;\
cd $(SDL2_DIR)/build; ../configure --disable-sndio --disable-esd \
--disable-arts --disable-video-directfb --disable-rpath \
--enable-alsa --enable-alsa-shared --enable-pulseaudio \
--enable-pulseaudio-shared --enable-x11-shared --enable-sdl-dlopen \
--disable-input-tslib CFLAGS="-O3" && make
cp $(SDL2_DIR)/build/build/.libs/libSDL2.a $@
touch $@
$(SDL2_DIR): $(SDL2_TAR)
$(RM) -r $@
tar xzvf $(SDL2_TAR) $@
touch $@
$(SDL2_TAR):
wget -c https://libsdl.org/release/$(SDL2_TAR)
$(PROGRAM_DRMFREE)-mac: qm-mac.o fdungeon-mac.o inventory-mac.o libs-mac.o SDL2.framework $(MAC_BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for Mac.
$(MACCXX) $(CXXFLAGS) -O3 -o $@ src/$(PROGRAM).cpp qm-mac.o fdungeon-mac.o inventory-mac.o libs-mac.o \
-F. -L. -Wl,-rpath,"." -framework SDL2 $(MAC_BULLET_LINKS) -ldl -pthread
libs-mac.o: src/libs.cpp include/tm_json.h
$(MACCXX) $(CXXFLAGS) -O3 -o $@ src/libs.cpp -c
$(PROGRAM_DRMFREE).exe: $(OBJECTS_WIN) $(WIN_BULLET_DYNAMICS) SDL2.dll include-win/SDL2 src/$(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for Windows.
$(WINCXX) $(CXXFLAGS) -mwindows -O3 -o $@ src/$(PROGRAM).cpp $(OBJECTS_WIN) \
-L. -lcomdlg32 -lmingw32 -l:SDL2.dll -l:libSDL2main.a $(WIN_BULLET_LINKS) \
-static -lpthread
$(PROGRAM)-steam.exe: $(OBJECTS_WIN) $(WIN_BULLET_DYNAMICS) SDL2.dll include-win/SDL2 src/$(PROGRAM).cpp $(INCLUDES)
$(WINCXX) $(CXXFLAGS) -mwindows -O3 -D__STEAM__ -o $@ src/$(PROGRAM).cpp $(OBJECTS_WIN) \
-L. -lcomdlg32 -lmingw32 -l:SDL2.dll -l:libSDL2main.a -l:steam_api.dll $(WIN_BULLET_LINKS) \
-static -lpthread
fdungeon-win.o: SDL2.dll include-win/SDL2 src/fdungeon.cpp include/avatar.h include/particle.h $(INCLUDES)
$(WINCXX) $(CXXFLAGS) -O3 src/fdungeon.cpp -c -o $@
inventory-win.o: src/inventory.cpp $(INCLUDES) fdungeon-win.o
$(WINCXX) $(CXXFLAGS) -O3 src/inventory.cpp -c -o $@
libs-win.o: libSDL2main.a SDL2.dll include-win/SDL2 src/libs.cpp include/tm_json.h
$(WINCXX) $(CXXFLAGS) -O3 src/libs.cpp -c -o $@
include-win/SDL2: $(SDL2_WIN_TAR)
$(RM) -r $@
mkdir -p include-win
cd include-win ;\
tar xzvf ../$(SDL2_WIN_TAR) --strip-components=3 SDL2-$(SDL2_VER)/i686-w64-mingw32/include/SDL2
touch $@
libSDL2main.a: $(SDL2_WIN_TAR)
tar xzvf $(SDL2_WIN_TAR) --strip-components=3 SDL2-$(SDL2_VER)/i686-w64-mingw32/lib/$@
touch $@
SDL2.dll: $(SDL2_WIN_TAR)
tar xzvf $(SDL2_WIN_TAR) --strip-components=3 SDL2-$(SDL2_VER)/i686-w64-mingw32/bin/$@
touch $@
$(SDL2_WIN_TAR):
wget -c https://libsdl.org/release/$(SDL2_WIN_TAR)
html: libs-web.o libSDL2-web.a src/$(PROGRAM).cpp $(INCLUDES)
mkdir -p $@
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) --closure 1 -Oz -o $@/index.html src/$(PROGRAM).cpp libs-web.o libSDL2-web.a -lwebsocket.js
web: index-template.html web/index.js
cp -f index-template.html $@/index.html
cp -f favicon.ico $@
touch $@
web/index.js: libs-web.o libSDL2-web.a src/$(PROGRAM).cpp $(INCLUDES)
mkdir -p web
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) --closure 1 -Oz -o $@ src/$(PROGRAM).cpp libs-web.o libSDL2-web.a -lwebsocket.js
html-bullet: libs-web.o libSDL2-web.a $(WEB_BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
mkdir -p $@
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) -O3 -o $@/index.html src/$(PROGRAM).cpp libs-web.o libSDL2-web.a $(WEB_BULLET_LINKS) -lwebsocket.js
web-bullet: index-template.html web-bullet/index.js
cp -f index-template.html $@/index.html
cp -f favicon.ico $@
touch $@
web-bullet/index.js: libs-web.o libSDL2-web.a $(WEB_BULLET_DYNAMICS) src/$(PROGRAM).cpp $(INCLUDES)
mkdir -p web
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) -O3 -o $@ src/$(PROGRAM).cpp libs-web.o libSDL2-web.a $(WEB_BULLET_LINKS) -lwebsocket.js
libs-web.o: src/libs.cpp include/tm_json.h
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) -Oz -o $@ src/libs.cpp -c
libSDL2-web.a: $(SDL2_DIR)
rm -r -f $(SDL2_DIR)/build
mkdir -p $(SDL2_DIR)/build
$(WEB_PREFIX) /bin/bash -c "cd $(SDL2_DIR)/build; $(WEB_SDL_CONFIGURE) CFLAGS=\"-Oz\" && emmake make"
cp $(SDL2_DIR)/build/build/.libs/libSDL2.a $@
touch $@
bullet: $(BULLET_DYNAMICS) $(WIN_BULLET_DYNAMICS)
$(BULLET_COLLISION): $(BULLET_DYNAMICS)
$(BULLET_LINEARMATH): $(BULLET_DYNAMICS)
$(BULLET_DYNAMICS): $(BULLET_DIR)
#cd $(BULLET_DIR); ./build_cmake_pybullet_double.sh
mkdir -p $(BULLET_DIR)/build_cmake
cd $(BULLET_DIR)/build_cmake; \
cmake $(BULLET_OPTIONS) -DCMAKE_BUILD_TYPE=Release .. && make
mv $(BULLET_DIR)/build_cmake/src/BulletDynamics/$(BULLET_DYNAMICS) .
mv $(BULLET_DIR)/build_cmake/src/BulletCollision/$(BULLET_COLLISION) .
mv $(BULLET_DIR)/build_cmake/src/LinearMath/$(BULLET_LINEARMATH) .
$(WEB_BULLET_COLLISION): $(WEB_BULLET_DYNAMICS)
$(WEB_BULLET_LINEARMATH): $(WEB_BULLET_DYNAMICS)
$(WEB_BULLET_DYNAMICS): $(BULLET_DIR)
mkdir -p $(BULLET_DIR)/build_cmake_web
$(WEB_PREFIX) /bin/bash -c "cd $(BULLET_DIR)/build_cmake_web; emcmake cmake $(BULLET_OPTIONS) -DCMAKE_BUILD_TYPE=Release .. && emmake make"
mv $(BULLET_DIR)/build_cmake_web/src/BulletDynamics/libBulletDynamics.a ./$(WEB_BULLET_DYNAMICS)
mv $(BULLET_DIR)/build_cmake_web/src/BulletCollision/libBulletCollision.a ./$(WEB_BULLET_COLLISION)
mv $(BULLET_DIR)/build_cmake_web/src/LinearMath/libLinearMath.a ./$(WEB_BULLET_LINEARMATH)
$(MAC_BULLET_COLLISION): $(MAC_BULLET_DYNAMICS)
$(MAC_BULLET_LINEARMATH): $(MAC_BULLET_DYNAMICS)
$(MAC_BULLET_DYNAMICS): $(BULLET_DIR)
mkdir -p $(BULLET_DIR)/build_cmake_mac
cd $(BULLET_DIR)/build_cmake_mac; \
cmake $(BULLET_OPTIONS) -DCMAKE_BUILD_TYPE=Release .. && make
mv $(BULLET_DIR)/build_cmake_mac/src/BulletDynamics/libBulletDynamics.a ./$(MAC_BULLET_DYNAMICS)
mv $(BULLET_DIR)/build_cmake_mac/src/BulletCollision/libBulletCollision.a ./$(MAC_BULLET_COLLISION)
mv $(BULLET_DIR)/build_cmake_mac/src/LinearMath/libLinearMath.a ./$(MAC_BULLET_LINEARMATH)
$(WIN_BULLET_COLLISION): $(WIN_BULLET_DYNAMICS)
$(WIN_BULLET_LINEARMATH): $(WIN_BULLET_DYNAMICS)
$(WIN_BULLET_DYNAMICS): $(BULLET_DIR)
mkdir -p $(BULLET_DIR)/build_cmake_win
cd $(BULLET_DIR)/build_cmake_win; \
cmake $(BULLET_OPTIONS) $(WIN_CMAKE_FLAGS) -DCMAKE_BUILD_TYPE=Release .. && make
mv $(BULLET_DIR)/build_cmake_win/src/BulletDynamics/libBulletDynamics.a ./$(WIN_BULLET_DYNAMICS)
mv $(BULLET_DIR)/build_cmake_win/src/BulletCollision/libBulletCollision.a ./$(WIN_BULLET_COLLISION)
mv $(BULLET_DIR)/build_cmake_win/src/LinearMath/libLinearMath.a ./$(WIN_BULLET_LINEARMATH)
$(BULLET_DIR): $(BULLET_TAR)
$(RM) -r $@
tar xzvf $(BULLET_TAR) $@
touch $@
$(BULLET_TAR):
wget -c https://github.com/bulletphysics/bullet3/archive/$(BULLET_TAR)
clean:
$(RM) wfcgen obj2bin obj2anib debug $(PROGRAM_DRMFREE) $(PROGRAM)-xr $(PROGRAM)-dynamic $(PROGRAM)-steam $(PROGRAM)-demo $(OBJECTS_LIN) xr.o \
$(PROGRAM).exe $(PROGRAM)-steam.exe $(PROGRAM_DRMFREE).exe $(PROGRAM)-demo.exe $(OBJECTS_WIN) libs-web.o
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
170 |
42b08f467f099371d96fc6f35757c4510bfe7987 |
.gitignore |
100644 |
blob |
13691 |
91e57f285f7909d8fff004e19d0852ae8a5ab620 |
Makefile |
100644 |
blob |
2396 |
fc392e2bdb9b9ac4abb5fded56a32df18102c407 |
README.md |
040000 |
tree |
- |
24edde380630a9b606578ec84bef4f4b14a47bc9 |
base |
100644 |
blob |
487269 |
29cfd3578eb40b1f039e271bcaa81af49d1b7f3c |
gamecontrollerdb.txt |
040000 |
tree |
- |
6726c684f35940574c6acfa726e40c17e50dbb59 |
include |
100755 |
blob |
257 |
5da83586fddf2984c55ed40e03f43c504552e8aa |
makeanib |
100755 |
blob |
677 |
e3ce6d4069311dcbb89f1d1166a00a2f9d2934b5 |
package-steam |
100644 |
blob |
879 |
1aa6cc46749b8ad10c792dd501a23d62886ae951 |
package-steam-build-demo.vdf |
100644 |
blob |
887 |
accdaa60338652380422b5c2caa0651cc8b0ea7e |
package-steam-build-playtest.vdf |
100644 |
blob |
879 |
0b12a202f0ef30f781c82678a68c9a5093365e7e |
package-steam-build.vdf |
100644 |
blob |
1182 |
81610ae8ed0d39b7b1412ef22eff86289fe2adb2 |
rsod.cbp |
040000 |
tree |
- |
29b0858232a51d442abbbbfa4e8842d8ae3151c7 |
src |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mse/RSOD
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mse/RSOD
Clone this repository using git:
git clone git://git.rocketgit.com/user/mse/RSOD
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main