DEADSOFTWARE

emscripten: fix sdl2
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 3 Apr 2020 17:23:27 +0000 (20:23 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 3 Apr 2020 17:23:27 +0000 (20:23 +0300)
src/CMakeLists.txt

index d39526222f66f8dc959d51057ee26232d4ec98a0..83cd7f2147ebd6ae5fbbda0e827ffd9252c8ea0a 100644 (file)
@@ -57,7 +57,7 @@ if(WITH_SDL)
   endif()
 elseif(WITH_SDL2)
   if(D2D_FOR_EMSCRIPTEN)
-    set(D2D_SYSTEM_SRC "${D2D_SDL_SRC}")
+    set(D2D_SYSTEM_SRC "${D2D_SDL2_SRC}")
     set(D2D_SYSTEM_INCLUDE_DIR "")
     set(D2D_SYSTEM_LIBRARY "-lSDL2")
     set(D2D_SYSTEM_LINKFLAGS "-s USE_SDL=2")
@@ -118,13 +118,13 @@ elseif(WITH_SDLMIXER)
   set(D2D_SOUND_SRC "${D2D_SDLMIXER_SRC}")
   set(D2D_SOUND_INCLUDE_DIR "${SDLMIXER_INCLUDE_DIR}")
   set(D2D_SOUND_LIBRARY "${SDLMIXER_LIBRARY}")
-else(WITH_STUBSOUND)
+else()
   message(FATAL_ERROR "Select SOUND_DRIVER as 'OPENAL' or 'SDLMIXER' or 'STUB'")
-endif(WITH_STUBSOUND)
+endif()
 
 if (NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
-endif (NOT CMAKE_BUILD_TYPE)
+endif()
 set(CMAKE_C_FLAGS "")
 set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall")
 set(CMAKE_C_FLAGS_RELEASE "-O3") # -DNDEBUG
@@ -145,7 +145,9 @@ if(D2D_FOR_EMSCRIPTEN)
   set(CMAKE_EXECUTABLE_SUFFIX ".html")
   configure_file(${D2D_GAME_ROOT}/doom2d.wad doom2d.wad COPYONLY)
   set(D2D_DOOM2D_WAD doom2d.wad)
-  set_target_properties(doom2d PROPERTIES LINK_FLAGS "-s WASM=0 -s DISABLE_EXCEPTION_CATCHING=1 -s SAFE_HEAP=1 -s ASSERTIONS=1 -s GL_ASSERTIONS=1 ${D2D_SYSTEM_LINKFLAGS} ${D2D_RENDER_LINKFLAGS} ${D2D_SOUND_LINKFLAGS} --preload-file ${D2D_DOOM2D_WAD}")
+  configure_file(${D2D_GAME_ROOT}/default.cfg default.cfg COPYONLY)
+  set(D2D_DEFAULT_CFG default.cfg)
+  set_target_properties(doom2d PROPERTIES LINK_FLAGS "-s WASM=0 -s DISABLE_EXCEPTION_CATCHING=1 -s SAFE_HEAP=1 -s ASSERTIONS=1 -s GL_ASSERTIONS=1 ${D2D_SYSTEM_LINKFLAGS} ${D2D_RENDER_LINKFLAGS} ${D2D_SOUND_LINKFLAGS} --preload-file ${D2D_DOOM2D_WAD} --preload-file ${D2D_DEFAULT_CFG}")
 else()
   target_link_libraries(doom2d "${D2D_SYSTEM_LIBRARY}" "${D2D_RENDER_LIBRARY}" "${D2D_SOUND_LIBRARY}")
 endif()