-updated tests:

*updated build scripts
 *removed tls variables from code (needed to support WebAssembly)
 *some mmutils tweaks
 *some fixes
 *pthread TLS thread ID implementation
-added Atomic file (reimplementation of atomics templates for emscripten)
-added emscripten support to ecs.std
This commit is contained in:
Mergul 2019-11-25 20:06:16 +00:00
parent 46de0f6adb
commit 946fbf2934
18 changed files with 443 additions and 229 deletions

View file

@ -13,7 +13,7 @@ def compile(sources, output):
if file_extension == '.d' and filename != 'package':
files.append(os.path.join(r, file))
ldc_cmd = 'ldc2 ' + shared_flags + ldc_flags + '-oq -mtriple=wasm32-unknown-unknown-wasm -betterC --output-bc --od=.bc --singleobj --checkaction=C --of=' + output + ' '
ldc_cmd = compiler + shared_flags + ldc_flags + '-oq -mtriple=wasm32-unknown-unknown-wasm -betterC --output-bc --od=.bc --singleobj --checkaction=C --of=' + output + ' '
for path in sources:
ldc_cmd += '-I' + path + ' '
@ -31,12 +31,14 @@ def compile(sources, output):
print()
compiler = 'ldc2 '
#compiler = 'ldmd2 -vtls '
shared_flags = ''
clean = 0
demo = 0
sources = ['tests', 'source']
emc_flags = '-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[\'png\']" --preload-file assets '
ldc_flags = '--d-version=SDL_209 --d-version=BindSDL_Static --d-version=BindSDL_Image --d-version=MM_USE_POSIX_THREADS '
ldc_flags = '--d-version=ECSEmscripten --d-version=SDL_209 --d-version=BindSDL_Static --d-version=BindSDL_Image --d-version=MM_USE_POSIX_THREADS '
import_paths = ['external/sources', 'external/imports', 'external/wasm_imports', '../source', 'utils/source', 'simple/source']
for arg in sys.argv[1:]:
@ -60,7 +62,7 @@ for arg in sys.argv[1:]:
shared_flags += '-g '
elif(arg == '-g4'):
ldc_flags += '-g '
emc_flags += '-g4 '
emc_flags += '-g4 --source-map-base ./ '
elif(arg == '--llvm-lto'):
emc_flags += '--llvm-lto 3 '
elif(arg == '--simd'):
@ -69,12 +71,12 @@ for arg in sys.argv[1:]:
shared_flags += '-O3 '
ldc_flags += '-release -enable-inlining '
emc_flags += '--llvm-lto 3 -s SIMD=1 '
elif(arg == '-quiet'):
emc_flags += "-Wl,--no-check-features "
elif(arg == '--clean'):
clean = 1
elif(arg == '-pthread'):
shared_flags += '-O3 '
ldc_flags += '-release -enable-inlining '
emc_flags += '-s PTHREAD_POOL_SIZE=16 -s USE_PTHREADS=1 '
emc_flags += '-s USE_PTHREADS=1 '
elif(arg == '--demo=simple'):
demo = 0
else:
@ -90,8 +92,8 @@ compile(['source'], 'demo.bc')
if clean or os.path.exists('../ecs.bc') == 0 or os.path.isfile('../ecs.bc') == 0:
compile(['../source'], '../ecs.bc')
emcc_cmd = 'emcc -v ' + shared_flags + emc_flags + '-s ERROR_ON_UNDEFINED_SYMBOLS=0 -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s TOTAL_MEMORY=256MB -s WASM_MEM_MAX=1024MB -s MALLOC=dlmalloc -s WASM=1 -o index.html '
#-s ALLOW_MEMORY_GROWTH=1 -s PROXY_TO_PTHREAD=1
emcc_cmd = 'emcc -v ' + shared_flags + emc_flags + '-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s ALLOW_MEMORY_GROWTH=1 -s WASM_MEM_MAX=2048MB -s MALLOC=dlmalloc -s WASM=1 -o index.html '
#-s ALLOW_MEMORY_GROWTH=1 -s PROXY_TO_PTHREAD=1 -Wl,--no-check-features -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=512MB
emcc_cmd += '../ecs.bc '
emcc_cmd += 'utils.bc '