Skip to content

Commit

Permalink
Emscripten wasm build support.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdelnero committed Jan 2, 2025
1 parent 8c0415c commit af71774
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion HxCFloppyEmulator_software/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ else
endif

ifeq ($(TARGET), Emscripten)
CFLAGS += -I/usr/local/include
CFLAGS += -I/usr/local/include -pthread
LDFLAGS += -lc -lm -ldl
CC = emcc
CPP = em++
BUILD_CC = cc
LIBHXCFE = libhxcfe.a
LIBUSBHXCFE = libusbhxcfe.a
LDFLAGS += -lpthread -s WASM=1 -sALLOW_MEMORY_GROWTH -sASYNCIFY -sOFFSCREENCANVAS_SUPPORT=1 --bind
EXEC = hxcfloppyemulator.wasm
endif

ifdef STANDALONEFSBROWSER_BUILD
Expand Down Expand Up @@ -137,6 +139,8 @@ ifeq ($(TARGET), mingw32)
else ifeq ($(TARGET), mingw64)
cd ../sources/thirdpartylibs/fltk/fltk-1.x.x/ && export LDFLAGS='-static-libstdc++ -static-libgcc' && ./configure --host=x86_64-w64-mingw32 --prefix=/usr/share/mingw-w64
$(MAKE) -C ../sources/thirdpartylibs/fltk/fltk-1.x.x/ DIRS=src CC=x86_64-w64-mingw32-gcc CPP=x86_64-w64-mingw32-g++
else ifeq ($(TARGET), Emscripten)
cd ../sources/thirdpartylibs/fltk/fltk-1.x.x/ && export LDFLAGS='-s WASM=1 -sALLOW_MEMORY_GROWTH -sASYNCIFY -sOFFSCREENCANVAS_SUPPORT=1 --bind' && emcmake cmake -DFLTK_BUILD_TEST:BOOL=OFF -DFLTK_USE_PTHREADS:BOOL=OFF -DFLTK_BUILD_FLUID:BOOL=OFF -DFLTK_BUILD_FLTK_OPTIONS:BOOL=OFF -DFLTK_BUILD_GL:BOOL=OFF && emmake make DIRS=src
else ifeq ($(TARGET), Darwin)
ifneq (,$(findstring arm64,$(MACOSX_ARCH)))
cd ../sources/thirdpartylibs/fltk && \
Expand Down Expand Up @@ -219,6 +223,10 @@ hxcfloppyemulator: main.o utils.o $(GUI) $(MICROINTRO) loader.o soft_cfg_file.o
$(CPP) -o $@ $^ $(LDFLAGS)
cp $@ ../../build

hxcfloppyemulator.wasm: main.o utils.o $(GUI) $(MICROINTRO) loader.o soft_cfg_file.o fileselector.o $(FLTKLIB) $(LIBHXCFE) $(LIBUSBHXCFE) ../../build/libhxcadaptor.a
$(CPP) -o $@ $^ $(LDFLAGS)
cp $@ ../../build

$(LIBHXCFE): ../../build/$(LIBHXCFE)
ln ../../build/$(LIBHXCFE) $(LIBHXCFE)

Expand Down

0 comments on commit af71774

Please sign in to comment.