summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-06-25 10:08:17 +0800
committerruki <[email protected]>2023-06-25 10:08:17 +0800
commit5f437620e46abcb5863884dcac18b1e3980ae05a (patch)
tree271457c76ecaa2fd58699841f8b3c2f546cfb09b
parenta361c06843cf103e8e1d646b7dce7318a26951fa (diff)
support shared library for xmake.sh
-rwxr-xr-xconfigure29
m---------core/src/tbox/tbox0
-rwxr-xr-xcore/xmake.sh4
3 files changed, 32 insertions, 1 deletions
diff --git a/configure b/configure
index c5c273156..35d19f955 100755
--- a/configure
+++ b/configure
@@ -669,6 +669,9 @@ fi
# set the default target mode
_target_mode_default="release"
+# set the default target kind
+_target_kind_default="static"
+
# set the default project generator and build program
if is_host "freebsd" "bsd"; then
_project_generator="gmake"
@@ -739,6 +742,21 @@ is_mode() {
return 1
}
+# determining target kind
+# e.g.
+# if is_kind "release"; then
+# ...
+# fi
+is_kind() {
+ local kind=""
+ for kind in $@; do
+ if test_eq "${_target_kind}" "${kind}"; then
+ return 0
+ fi
+ done
+ return 1
+}
+
# determining target toolchain
# e.g.
# if is_toolchain "clang"; then
@@ -2616,6 +2634,10 @@ Common options:
--mode=MODE Set the given compilation mode. (default: '"${_target_mode_default}"')
- release
- debug
+ --kind=KIND Set the given target kind. (default: '"${_target_kind_default}"')
+ - static
+ - shared
+ - binary
--toolchain=TOOLCHAIN Set toolchain name.
- clang
- gcc
@@ -2688,6 +2710,9 @@ _handle_option() {
elif test_eq "${name}" "mode"; then
_target_mode=${value}
return 0
+ elif test_eq "${name}" "kind"; then
+ _target_kind=${value}
+ return 0
elif test_eq "${name}" "toolchain"; then
_target_toolchain=${value}
return 0
@@ -2918,6 +2943,9 @@ _check_platform() {
if test "x${_target_mode}" = "x"; then
_target_mode=${_target_mode_default}
fi
+ if test "x${_target_kind}" = "x"; then
+ _target_kind=${_target_kind_default}
+ fi
echo "checking for platform ... ${_target_plat}"
echo "checking for architecture ... ${_target_arch}"
}
@@ -3547,6 +3575,7 @@ fi
plat="${_target_plat}"
arch="${_target_arch}"
mode="${_target_mode}"
+kind="${_target_kind}"
#-----------------------------------------------------------------------------
# load project targets
diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox
-Subproject 59fdba9ecadeecf3a9f3b794dac36c9f7708377
+Subproject b276eb4a88a0fec17b3edf2c987a372136c8b30
diff --git a/core/xmake.sh b/core/xmake.sh
index 2ae2e686b..f6cc58d1e 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -23,7 +23,9 @@ if is_mode "debug"; then
set_optimizes "none"
else
set_strip "all"
- set_symbols "hidden"
+ if ! is_kind "shared"; then
+ set_symbols "hidden"
+ fi
set_optimizes "smallest"
# we cannot enable LTO on macOS arm64
if is_plat "macosx" && ! is_arch "arm64"; then