aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2017-07-19 17:39:02 +0800
committerGitHub <noreply@github.com>2017-07-19 17:39:02 +0800
commit1563c3eb0fc3051819e7752306f5df23d8ab76dd (patch)
tree1f1916fd26fd806d06aaf7eae1ec8215975004b0
parent46d31f7179779087e2b7dfae1befef8f1975d128 (diff)
parent5050164d9e55a8f7ab437bd0983eb0a2e25ca6b1 (diff)
downloaddexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.tar
dexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.tar.gz
dexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.tar.bz2
dexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.tar.lz
dexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.tar.xz
dexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.tar.zst
dexon-solidity-1563c3eb0fc3051819e7752306f5df23d8ab76dd.zip
Merge pull request #2594 from ethereum/emscripten
Add comments to Emscripten flags
-rw-r--r--cmake/EthCompilerSettings.cmake24
1 files changed, 20 insertions, 4 deletions
diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake
index ea3b185a..43317ae1 100644
--- a/cmake/EthCompilerSettings.cmake
+++ b/cmake/EthCompilerSettings.cmake
@@ -160,10 +160,26 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
endif()
if (EMSCRIPTEN)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0 -O3 -s LINKABLE=1 -s DISABLE_EXCEPTION_CATCHING=0 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_DYNAMIC_EXECUTION=1")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_FILESYSTEM=1 -s AGGRESSIVE_VARIABLE_ELIMINATION=1")
+ # Do emit a separate memory initialiser file
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0")
+ # Leave only exported symbols as public and agressively remove others
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections -fvisibility=hidden")
+ # Optimisation level
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
+ # Keep every public symbols (disables dead code elimination)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s LINKABLE=1")
+ # Re-enable exception catching (optimisations above -O1 disable it)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
+ # Remove any code related to exit (such as atexit)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
+ # Remove any code related to filesystem access
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_FILESYSTEM=1")
+ # Remove variables even if it needs to be duplicated (can improve speed at the cost of size)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s AGGRESSIVE_VARIABLE_ELIMINATION=1")
+ # Allow memory growth, but disable some optimisations
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
+ # Disable eval()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DYNAMIC_EXECUTION=1")
add_definitions(-DETH_EMSCRIPTEN=1)
endif()
endif()