Skip to content

Commit 8956e01

Browse files
committed
CMake build system and some Boom-feature support
1 parent 6a0398c commit 8956e01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+4897
-372867
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ STRIFE*.pcx
4545
.*.swp
4646
.DS_store
4747

48+
build
4849
*.bc
4950
*.wasm
5051
doom.*

CMakeLists.txt

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required( VERSION 3.0.0 )
2+
project(wasm-doom)
3+
4+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
5+
6+
include_directories(
7+
gifenc
8+
opl
9+
sdl_mixer
10+
src
11+
src/doom
12+
)
13+
file (GLOB_RECURSE SRC_FILES *.c)
14+
15+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Oz -Wall \
16+
-Wno-\#warnings \
17+
-Wno-macro-redefined \
18+
-Wno-switch \
19+
-s WASM=1 \
20+
-s USE_SDL=2 \
21+
-s USE_LIBPNG=1 \
22+
-s ALLOW_MEMORY_GROWTH=1 \
23+
-s NO_EXIT_RUNTIME=1 \
24+
-s EXTRA_EXPORTED_RUNTIME_METHODS=['FS'] \
25+
--no-heap-copy")
26+
27+
if (CMAKE_BUILD_TYPE MATCHES Debug)
28+
add_executable(index ${SRC_FILES})
29+
target_link_libraries(index)
30+
set_target_properties( index PROPERTIES SUFFIX ".html" )
31+
32+
set(CMAKE_C_FLAGS_DEBUG "-s ASSERTIONS=2 --source-map-base http://localhost:8000/ -g4 --preload-file ${CMAKE_CURRENT_LIST_DIR}/../[email protected]")
33+
34+
add_custom_command(TARGET index POST_BUILD
35+
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
36+
COMMAND sed -i index.wasm.map 's|${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/||g' index.wasm.map
37+
COMMENT "Fix WebAssembly source map root"
38+
)
39+
40+
em_link_js_library(index ${libraryJsFiles})
41+
else()
42+
add_executable(doom ${SRC_FILES})
43+
target_link_libraries(doom)
44+
set_target_properties( doom PROPERTIES SUFFIX ".js" )
45+
46+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s MODULARIZE=1 -s ASSERTIONS=0")
47+
48+
em_link_js_library(doom ${libraryJsFiles})
49+
endif()

build.sh

-323
This file was deleted.

gifenc/example

-12.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)