Add default linker flags for emscripten toolchains in the CMakeLists.txt file

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-04-12 18:51:26 +02:00
parent 87c090ceeb
commit 4da10b61dd
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 3 additions and 1 deletions

View File

@ -57,6 +57,8 @@ if (${IS_GNU} OR ${IS_CLANG})
endif()
if (NOT DEFINED EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -fstack-clash-protection")
else()
set(CMAKE_EXE_LINKER_FLAGS "--closure 1 -sWASM=0 --memory-init-file 0 -sEXPORTED_FUNCTIONS=_main ${CMAKE_EXE_LINKER_FLAGS}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstrict-enums -pipe -funwind-tables -fasynchronous-unwind-tables -frtti -fexceptions")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fmerge-all-constants -ftree-vectorize -fno-math-errno")

2
Jenkinsfile vendored
View File

@ -45,7 +45,7 @@ pipeline {
buildTarget('x86_64-linux-gnu', 'x86_64', 'amd64')
buildTarget('i686-linux-gnu', 'i386', 'i386')
cmakeBuild buildDir: "cmake-build-release-emscripten", buildType: 'release', cleanBuild: true, installation: 'Latest',
cmakeArgs: "-DCMAKE_TOOLCHAIN_FILE=\"/usr/share/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake\" -DCMAKE_EXE_LINKER_FLAGS=\"--closure 1 -sWASM=0 --memory-init-file 0\" ${no_compilation_cache_flags()}",
cmakeArgs: "-DCMAKE_TOOLCHAIN_FILE=\"/usr/share/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake\" ${no_compilation_cache_flags()}",
generator: cmake_generator()
cmake arguments: "--build ./cmake-build-release-emscripten", installation: 'Latest'
}