Skip to content

Instantly share code, notes, and snippets.

@loloof64
Last active December 3, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loloof64/05ad6d690dbe13524fe7951977715044 to your computer and use it in GitHub Desktop.
Save loloof64/05ad6d690dbe13524fe7951977715044 to your computer and use it in GitHub Desktop.
Attempt to compile nmrugg/stockfish.js for React-Native

How to

(Please note, that the result still has reference to original DOM model: window, document, ...).

  1. Clone the Stockfish.js repository
  2. Replace the original Makefile in the src folder.
  3. Run make all from inside the src folder.
OBJS = bitbase.o bitboard.o endgame.o evaluate.o main.o \
material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \
search.o thread.o timeman.o tt.o uci.o ucioption.o
EXE = stockfish.wasm
CXXFLAGS = -Oz -DNDEBUG --closure 1 -s ENVIRONMENT=web -s INLINING_LIMIT=1 -s WASM=1 -fPIC -s EVAL_CTORS=0 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN_ASYNC_COMPILATION=1 -s NO_FILESYSTEM=1 -s STANDALONE_WASM
LDFLAGS = -Oz -DNDEBUG --closure 1 -s ENVIRONMENT=web -s INLINING_LIMIT=1 -s WASM=1 -fPIC -s EVAL_CTORS=0 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN_ASYNC_COMPILATION=1 -s NO_FILESYSTEM=1 -s STANDALONE_WASM
clean:
@rm -f $(EXE) stockfish.wasm *.o
all: $(EXE)
$(EXE): $(OBJS)
em++ -std=c++11 -o $@ $^ $(LDFLAGS)
%.o: %.cpp
em++ -std=c++11 -c $< $(CXXFLAGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment