Ignore:
Timestamp:
08/14/24 00:56:06 (4 months ago)
Author:
Maciej Komosinski
Message:

Updated for current SDK sources and current Emscripten

File:
1 edited

Legend:

Unmodified
Added
Removed
  • js/sdk/Makefile-SDK-Emscripten.mak

    r865 r1324  
    11#
    22# Framsticks SDK makefile for Emscripten builds
     3#
     4# Before 2020, this makefile could be used natively under Windows as well (see history if needed).
     5# However, now that the Windows Subsystem for Linux (WSL) exists, this file only supports Linux.
    36#
    47
    58include frams/Makefile-SDK-files
    69
     10# set this path based on the project directory structure
    711JS_PATH=../js/sdk
    8 
    9 #Note: CURDIR needed because on linux, Emscripten does not differentiate between relative and absolute path, which causes shutil to raise Error("%s and %s are the same file" % (src, dst))
    10 ifeq ($(OS),Windows_NT)
    11         CACHE_DIR=cache-tmp
    12 else
    13         CACHE_DIR=$(CURDIR)/cache-tmp
    14 endif
    1512
    1613SDK_JS=$(JS_PATH)/frams-sdk.js
     
    2522
    2623# same as in cpp/frams/Makefile-SDK:
    27 CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Werror=return-type
     24CXXWARNINGS=-Wall -Wno-parentheses -Wno-overloaded-virtual -Wno-format -Wno-invalid-offsetof -Werror=return-type
    2825
    29 SDK_BUILD_CONFIG= -include frams/config/sdk_build_config.h
    30 CACHE_DESTINATION= --cache $(CACHE_DIR)
    31 CXXFLAGS= -I$(CURDIR) -std=gnu++11 -O3 $(SDK_BUILD_CONFIG) $(CXXWARNINGS) $(CACHE_DESTINATION)
     26SDK_BUILD_CONFIG= -include frams/config/sdk-build-config.h
     27CXXFLAGS= -I$(CURDIR) -std=gnu++17 -O3 $(SDK_BUILD_CONFIG) $(CXXWARNINGS)
     28
     29# avoid "duplicate symbol" linking errors. Instead of this pipeline, could use the "uniq" function built in included gmsl, or define a recursive function to filter out duplicates while preserving the order of elements. Also consider "$^".
     30SDK_LIB_OBJS := $(shell echo $(SDK_LIB_OBJS) | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
    3231
    3332#############################################
    3433
    35 $(SDK_JS): $(I_IMPL_JS) $(I_IMPL_SRC) $(I_OBJ) $(SDK_BIN)
    36         $(CXX) $(SDK_BIN) $(I_OBJ) --post-js $(I_IMPL_JS) -g4 --memory-init-file 0 -s FORCE_FILESYSTEM=1 -s ALIASING_FUNCTION_POINTERS=0 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=3 -s BINARYEN_ASYNC_COMPILATION=0 -s WASM=0 $(CACHE_DESTINATION) -o $@
    37 
    38 $(SDK_BIN): $(SDK_LIB_OBJS)
    39         $(CXX) $(SDK_LIB_OBJS) $(LDFLAGS) $(CACHE_DESTINATION) -o $@
     34$(SDK_JS): $(I_IMPL_JS) $(I_IMPL_SRC) $(I_OBJ) $(SDK_LIB_OBJS)
     35        $(CXX) $(SDK_LIB_OBJS) $(I_OBJ) --post-js $(I_IMPL_JS) -O3 -s FORCE_FILESYSTEM=1 -s ALIASING_FUNCTION_POINTERS=0 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=3 -s BINARYEN_ASYNC_COMPILATION=0 -sWASM=0  -o $@
    4036
    4137$(I_IMPL_SRC) $(I_IMPL_JS): $(I_IDL)
    42         python $(EMSCRIPTEN)/tools/webidl_binder.py $(I_IDL) $(I_PATH)/js_interface_impl
     38        python3 $(EMSCRIPTEN)/tools/webidl_binder.py $(I_IDL) $(I_PATH)/js_interface_impl
    4339
    4440#############################################
    4541
     42include common/Makefile-maintain
    4643
    47 full_clean:
    48 ifeq ($(OS),Windows_NT)
    49         del /s /q WebIDLGrammar.pkl parser.out *.o
    50         rmdir /s /q $(CACHE_DIR)
    51 else
    52         rm -f WebIDLGrammar.pkl parser.out $(SDK_LIB_OBJS)
    53         rm -rf $(CACHE_DIR)
    54 endif
     44full_clean: clean
     45        rm -f WebIDLGrammar.pkl parser.out $(I_OBJ) $(I_IMPL_SRC) $(I_IMPL_JS) $(SDK_BIN) $(SDK_JS)
Note: See TracChangeset for help on using the changeset viewer.