Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt at emscripten #264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -304,6 +304,14 @@ set(CORELIBS
${ENET_LIBRARY}
)

IF (EMSCRIPTEN)

set (CMAKE_EXE_LINKER_FLAGS
"--preload-file ../resources@resources -s TOTAL_MEMORY=67108864 -s ALLOW_MEMORY_GROWTH=1"
)

ENDIF()

# Shadowdive
IF(USE_SUBMODULES)
set(CORELIBS ${CORELIBS} shadowdive)
Expand Down
2 changes: 2 additions & 0 deletions cmake-scripts/FindSDL2.cmake
@@ -1,5 +1,7 @@

IF (NOT EMSCRIPTEN)
FIND_PACKAGE(Threads)
ENDIF ()

SET(SDL2_SEARCH_PATHS
/usr/local/
Expand Down
11 changes: 11 additions & 0 deletions emconfig.sh
@@ -0,0 +1,11 @@
#!/bin/sh -x
EMSHIT=$(realpath emshit)
emcmake cmake . -Bemscripten \
-DZLIB_INCLUDE_DIR=$EMSHIT -DZLIB_LIBRARY=$EMSHIT/libz.a \
-DPNG_PNG_INCLUDE_DIR=$EMSHIT -DPNG_LIBRARY=$EMSHIT/libpng.a \
-DSDL2_INCLUDE_DIR=$EMSHIT -DSDL2_LIBRARY=$EMSHIT/libSDL2.a \
-DENET_INCLUDE_DIR=$EMSHIT -DENET_LIBRARY=$EMSHIT/libenet.a \
-DCONFUSE_INCLUDE_DIR=$EMSHIT/confuse -DCONFUSE_LIBRARY=$EMSHIT/confuse/libconfuse.a \
-DLIBINTL_INCLUDE_DIR=$EMSHIT -DLIBINTL_LIB_FOUND=1 -DLIBINTL_LIBRARIES="" \
-DOPENAL_LIBRARY="" \
-DVERBOSE=1
1,310 changes: 1,310 additions & 0 deletions emscripten/openomf.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/audio/music.c
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef __linux__
#if defined(__linux__) || defined(EMSCRIPTEN)
#include <strings.h> // strcasecmp
#endif // __linux__
#include "resources/pathmanager.h"
Expand Down
2 changes: 1 addition & 1 deletion src/audio/sources/dumb_source.c
Expand Up @@ -2,7 +2,7 @@

#include <stdlib.h>
#include <string.h>
#ifdef __linux__
#if defined(__linux__) || defined(EMSCRIPTEN)
#include <strings.h> // strcasecmp
#endif // __linux__
#include <dumb.h>
Expand Down
20 changes: 20 additions & 0 deletions src/main.c
Expand Up @@ -243,3 +243,23 @@ int main(int argc, char *argv[]) {
pm_free();
return ret;
}


#ifdef __EMSCRIPTEN__


#include <libintl.h>


char * dgettext (const char * domainname, const char * msgid) {
return (char *) "";
}


char * bindtextdomain (const char * domainname, const char * dirname) {
return (char *) "";
}


#endif // __EMSCRIPTEN__