aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorsavichevdm <savichevdm@yandex-team.com>2024-09-16 20:01:11 +0300
committersavichevdm <savichevdm@yandex-team.com>2024-09-16 20:21:28 +0300
commit571ed30daf84e8c684f6ad0b07d7dfc74c951a4f (patch)
tree47a94a18cd188fb033d1a3f1bc0b5a2b40dd1d65 /build
parentae1941f90d70deb5d720833355e93d89f4ae38cc (diff)
downloadydb-571ed30daf84e8c684f6ad0b07d7dfc74c951a4f.tar.gz
add support for wasm32 build
commit_hash:6dcdb0136ebcb1fb5a9e0c785160eabf7625e085
Diffstat (limited to 'build')
-rw-r--r--build/conf/compilers/gnu_compiler.conf8
-rw-r--r--build/ya.conf.json10
-rwxr-xr-xbuild/ymake_conf.py7
3 files changed, 23 insertions, 2 deletions
diff --git a/build/conf/compilers/gnu_compiler.conf b/build/conf/compilers/gnu_compiler.conf
index 659c8936e9..9d995a3192 100644
--- a/build/conf/compilers/gnu_compiler.conf
+++ b/build/conf/compilers/gnu_compiler.conf
@@ -75,9 +75,17 @@ when ($ARCH_XTENSA == "yes") {
when ($OS_EMSCRIPTEN == "yes") {
FSTACK=-fno-stack-protector
CFLAGS+=-D__EMSCRIPTEN__
+}
+
+when ($ARCH_WASM64 == "yes") {
CFLAGS+=-D_LIBCPP_HAS_MUSL_LIBC
}
+when ($ARCH_WASM32 == "yes") {
+ CFLAGS+=-D_musl_
+ CFLAGS+=-DEMSCRIPTEN_NOCATCH -fignore-exceptions
+}
+
CFLAGS+=$_C_FLAGS $DEBUG_INFO_FLAGS $_C_FOPTIONS $C_WARNING_OPTS $GCC_PREPROCESSOR_OPTS $USER_CFLAGS $USER_CFLAGS_GLOBAL
CXXFLAGS+=$CFLAGS $_STD_CXX $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL
CONLYFLAGS+=$USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
diff --git a/build/ya.conf.json b/build/ya.conf.json
index e6e50fba2a..99ac585de5 100644
--- a/build/ya.conf.json
+++ b/build/ya.conf.json
@@ -1550,6 +1550,16 @@
"os": "LINUX"
},
"target": {
+ "arch": "wasm32",
+ "os": "EMSCRIPTEN"
+ }
+ },
+ {
+ "default": true,
+ "host": {
+ "os": "LINUX"
+ },
+ "target": {
"arch": "wasm64",
"os": "EMSCRIPTEN"
}
diff --git a/build/ymake_conf.py b/build/ymake_conf.py
index 25f0adf7f6..670ff24337 100755
--- a/build/ymake_conf.py
+++ b/build/ymake_conf.py
@@ -142,10 +142,11 @@ class Platform(object):
self.is_power9le = self.arch == 'power9le'
self.is_powerpc = self.is_power8le or self.is_power9le
+ self.is_wasm32 = self.arch == 'wasm32'
self.is_wasm64 = self.arch == 'wasm64'
- self.is_wasm = self.is_wasm64
+ self.is_wasm = self.is_wasm32 or self.is_wasm64
- self.is_32_bit = self.is_x86 or self.is_armv5te or self.is_armv7 or self.is_armv8m or self.is_riscv32 or self.is_nds32 or self.is_armv7em or self.is_xtensa or self.is_tc32
+ self.is_32_bit = self.is_x86 or self.is_armv5te or self.is_armv7 or self.is_armv8m or self.is_riscv32 or self.is_nds32 or self.is_armv7em or self.is_xtensa or self.is_tc32 or self.is_wasm32
self.is_64_bit = self.is_x86_64 or self.is_armv8 or self.is_powerpc or self.is_wasm64
assert self.is_32_bit or self.is_64_bit
@@ -230,6 +231,7 @@ class Platform(object):
(self.is_xtensa, 'ARCH_XTENSA'),
(self.is_nds32, 'ARCH_NDS32'),
(self.is_tc32, 'ARCH_TC32'),
+ (self.is_wasm32, 'ARCH_WASM32'),
(self.is_wasm64, 'ARCH_WASM64'),
(self.is_32_bit, 'ARCH_TYPE_32'),
(self.is_64_bit, 'ARCH_TYPE_64'),
@@ -1240,6 +1242,7 @@ class GnuToolchain(Toolchain):
(target.is_android and target.is_armv7, 'armv7a-linux-androideabi'),
(target.is_android and target.is_armv8, 'aarch64-linux-android'),
+ (target.is_emscripten and target.is_wasm32, 'wasm32-unknown-emscripten'),
(target.is_emscripten and target.is_wasm64, 'wasm64-unknown-emscripten'),
])