Compile CanvasKit without -fPIC, for latest emscripten compatibility.

Due to an issue in emscripten's latest-upstream compiler (link below),
Skia's libraries can't be built using -fPIC. This change allows users
to opt-out of using -fPIC during compilation, and sets compile.sh to
opt-out accordingly.
https://github.com/emscripten-core/emscripten/issues/8995
https://github.com/emscripten-core/emscripten/issues/9317

Change-Id: I25b6e185b58ab1ba8263f2e2f450591f6025f62c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243317
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Shachar Langbeheim 2019-09-24 08:38:12 +03:00 committed by Skia Commit-Bot
parent b5037ca889
commit 497365778e
2 changed files with 6 additions and 4 deletions

View File

@ -9,6 +9,7 @@ declare_args() {
extra_cflags_c = []
extra_cflags_cc = []
extra_ldflags = []
use_PIC = true
malloc = ""
}
@ -88,10 +89,10 @@ config("default") {
"$win_vc/Tools/MSVC/$win_toolchain_version/lib/$target_cpu",
]
} else {
cflags += [
"-fstrict-aliasing",
"-fPIC",
]
if (use_PIC) {
cflags += [ "-fPIC" ]
}
cflags += [ "-fstrict-aliasing" ]
cflags_cc += [ "-std=c++14" ]
# The main idea is to slim the exported API, but these flags also improve link time on Mac.

View File

@ -162,6 +162,7 @@ echo "Compiling bitcode"
is_component_build=false \
werror=true \
target_cpu=\"wasm\" \
use_PIC=false \
\
skia_use_angle = false \
skia_use_dng_sdk=false \