-
-
Notifications
You must be signed in to change notification settings - Fork 812
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3172 from xmake-io/xmake.sh
add xmake.sh
- Loading branch information
Showing
18 changed files
with
4,154 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
target "demo" | ||
add_deps "xmake" | ||
set_kind "binary" | ||
set_basename "xmake" | ||
set_targetdir "${buildir}" | ||
|
||
# add defines | ||
add_defines "__tb_prefix__=\"xmake\"" | ||
|
||
# add includes directory | ||
add_includedirs "${projectdir}/core" "${projectdir}/core/src" | ||
|
||
# add the common source files | ||
add_files "**.c" | ||
|
||
# add links | ||
if is_plat "macosx" && is_config "runtime" "luajit"; then | ||
add_ldflags "-all_load" "-pagezero_size 10000" "-image_base 100000000" | ||
elif is_plat "mingw"; then | ||
add_ldflags "-static-libgcc" | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
target "lua_cjson" | ||
set_kind "static" | ||
set_warnings "all" | ||
add_deps "lua" | ||
add_files "lua-cjson/dtoa.c" | ||
add_files "lua-cjson/lua_cjson.c" | ||
add_files "lua-cjson/strbuf.c" | ||
add_files "lua-cjson/g_fmt.c" | ||
# Use internal strtod() / g_fmt() code for performance and disable multi-thread | ||
add_defines "NDEBUG" "USE_INTERNAL_FPCONV" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/sh | ||
|
||
target "lua" | ||
set_kind "static" | ||
set_warnings "all" | ||
|
||
# add include directories | ||
add_includedirs "lua" "{public}" | ||
|
||
# add the common source files | ||
add_files "lua/lapi.c" | ||
add_files "lua/lauxlib.c" | ||
add_files "lua/lbaselib.c" | ||
add_files "lua/lcode.c" | ||
add_files "lua/lcorolib.c" | ||
add_files "lua/lctype.c" | ||
add_files "lua/ldblib.c" | ||
add_files "lua/ldebug.c" | ||
add_files "lua/ldo.c" | ||
add_files "lua/ldump.c" | ||
add_files "lua/lfunc.c" | ||
add_files "lua/lgc.c" | ||
add_files "lua/linit.c" | ||
add_files "lua/liolib.c" | ||
add_files "lua/llex.c" | ||
add_files "lua/lmathlib.c" | ||
add_files "lua/lmem.c" | ||
add_files "lua/loadlib.c" | ||
add_files "lua/lobject.c" | ||
add_files "lua/lopcodes.c" | ||
add_files "lua/loslib.c" | ||
add_files "lua/lparser.c" | ||
add_files "lua/lstate.c" | ||
add_files "lua/lstring.c" | ||
add_files "lua/lstrlib.c" | ||
add_files "lua/ltable.c" | ||
add_files "lua/ltablib.c" | ||
add_files "lua/ltm.c" | ||
add_files "lua/lundump.c" | ||
add_files "lua/lutf8lib.c" | ||
add_files "lua/lvm.c" | ||
add_files "lua/lzio.c" | ||
|
||
# add defines | ||
add_defines "LUA_COMPAT_5_1" "LUA_COMPAT_5_2" "LUA_COMPAT_5_3" "{public}" | ||
if is_plat "mingw"; then | ||
add_defines "LUA_USE_WINDOWS" | ||
elif is_plat "macosx"; then | ||
add_defines "LUA_USE_MACOSX" | ||
else | ||
add_defines "LUA_USE_LINUX" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
# disable jit compiler for redhat and centos | ||
jit=true | ||
jit_plat="${plat}" | ||
jit_arch="${arch}" | ||
if is_plat "mingw"; then | ||
jit_plat="windows" | ||
if is_arch "x86_64"; then | ||
jit_arch="x64" | ||
else | ||
jit_arch="x86" | ||
fi | ||
fi | ||
if is_arch "arm64" "arm64-v8a"; then | ||
jit_arch="arm64" | ||
elif is_arch "arm" "armv7"; then | ||
jit_arch="arm" | ||
elif is_arch "mips64"; then | ||
jit_arch="mips64" | ||
jit=false | ||
fi | ||
if test -f "/etc/redhat-release"; then | ||
jit=false | ||
fi | ||
if $jit; then | ||
jit_dir="jit" | ||
else | ||
jit_dir="nojit" | ||
fi | ||
jit_autogendir="luajit/autogen/${jit_plat}/${jit_dir}/${jit_arch}" | ||
|
||
target "lua" | ||
set_kind "static" | ||
set_warnings "all" | ||
|
||
# add include directories | ||
add_includedirs "${jit_autogendir}" | ||
add_includedirs "luajit/src" "{public}" | ||
|
||
# add the common source files | ||
add_files "luajit/src/lj_*.c" | ||
add_files "luajit/src/lib_*.c" | ||
if is_plat "mingw"; then | ||
add_files "${jit_autogendir}/lj_vm.o" | ||
else | ||
add_files "${jit_autogendir}/*.S" | ||
fi | ||
|
||
add_defines "USE_LUAJIT" "{public}" | ||
|
||
# disable jit compiler? | ||
if ! $jit; then | ||
add_defines "LUAJIT_DISABLE_JIT" | ||
fi | ||
|
||
# using internal memory management under armv7 gc will cause a crash when free strings in lua_close | ||
if test_eq "${jit_arch}" "arm"; then | ||
add_defines "LUAJIT_USE_SYSMALLOC" | ||
fi | ||
|
||
# fix call math.sin/log crash for fedora/i386/lj_vm.S with `LDFLAGS = -specs=/usr/lib/rpm/redhat/redhat-hardened-ld` in xmake.spec/%set_build_flags | ||
if is_plat "linux" && is_arch "i386"; then | ||
add_asflags "-fPIE" | ||
add_ldflags "-fPIE" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
target "lz4" | ||
set_kind "static" | ||
set_warnings "all" | ||
add_includedirs "lz4/lib" "{public}" | ||
add_files "lz4/lib/lz4.c" | ||
add_files "lz4/lib/lz4frame.c" | ||
add_files "lz4/lib/lz4hc.c" | ||
add_files "lz4/lib/xxhash.c" | ||
add_defines "XXH_NAMESPACE=LZ4_" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
target "sv" | ||
set_languages "c99" | ||
set_kind "static" | ||
add_includedirs "sv/include" "{public}" | ||
add_files "sv/src/*.c" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set_config "hash" true | ||
set_config "charset" true | ||
set_config "force_utf8" true | ||
set_config "float" true | ||
set_config "demo" false | ||
|
||
includes "tbox/src" | ||
target_end | ||
|
||
set_configvar "TB_CONFIG_MODULE_HAVE_HASH" 1 | ||
set_configvar "TB_CONFIG_MODULE_HAVE_CHARSET" 1 | ||
set_configvar "TB_CONFIG_FORCE_UTF8" 1 | ||
set_configvar "TB_CONFIG_TYPE_HAVE_FLOAT" 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/sh | ||
|
||
target "xmake" | ||
set_kind "static" | ||
|
||
# add deps | ||
add_deps "sv" "lua_cjson" "lua" "lz4" "tbox" | ||
|
||
# add defines | ||
add_defines "__tb_prefix__=\"xmake\"" | ||
if is_mode "debug"; then | ||
add_defines "__tb_debug__" "{public}" | ||
fi | ||
|
||
# set the auto-generated config.h | ||
set_configdir "${buildir}/${plat}/${arch}/${mode}" | ||
add_configfiles "xmake.config.h.in" | ||
|
||
# add includes directory | ||
add_includedirs ".." "{public}" | ||
add_includedirs "${buildir}/${plat}/${arch}/${mode}" "{public}" | ||
add_includedirs "../xxhash" | ||
|
||
# add the common source files | ||
add_files "*.c" | ||
add_files "base64/*.c" | ||
add_files "bloom_filter/*.c" | ||
add_files "curses/*.c" | ||
add_files "fwatcher/*.c" | ||
add_files "hash/*.c" | ||
add_files "io/*.c" | ||
add_files "libc/*.c" | ||
add_files "lz4/*.c" | ||
add_files "os/*.c" | ||
add_files "path/*.c" | ||
add_files "process/*.c" | ||
add_files "readline/*.c" | ||
add_files "sandbox/*.c" | ||
add_files "semver/*.c" | ||
add_files "string/*.c" | ||
add_files "tty/*.c" | ||
if is_plat "mingw"; then | ||
add_files "winos/*.c" | ||
fi | ||
|
||
# enable readline | ||
if has_config "readline"; then | ||
add_defines "XM_CONFIG_API_HAVE_READLINE" "{public}" | ||
add_links "readline" "{public}" | ||
fi | ||
|
||
# enable curses | ||
if has_config "curses"; then | ||
add_defines "XM_CONFIG_API_HAVE_CURSES" "{public}" | ||
add_links "curses" "{public}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/sh | ||
|
||
set_project "xmake" | ||
set_version "2.7.3" "%Y%m%d%H%M" | ||
|
||
# set warning all | ||
set_warnings "all" | ||
|
||
# set language: c99 | ||
set_languages "c99" | ||
|
||
# add defines | ||
add_defines "_GNU_SOURCE=1" "_FILE_OFFSET_BITS=64" "_LARGEFILE_SOURCE" | ||
|
||
# disable some compiler errors | ||
if is_plat "macosx"; then | ||
add_cxflags "-Wno-error=deprecated-declarations" "-fno-strict-aliasing" "-Wno-error=nullability-completeness" "-Wno-error=parentheses-equality" | ||
fi | ||
|
||
# add build modes | ||
if is_mode "debug"; then | ||
set_symbols "debug" | ||
set_optimizes "none" | ||
else | ||
set_strip "all" | ||
set_symbols "hidden" | ||
set_optimizes "smallest" | ||
fi | ||
|
||
# the runtime option, lua or luajit | ||
option "runtime" "Use luajit or lua runtime" "lua" | ||
|
||
# the readline option | ||
option "readline" | ||
set_description "Enable or disable readline library" | ||
add_links "readline" | ||
add_cincludes "readline/readline.h" | ||
add_cfuncs "readline" | ||
|
||
# the curses option | ||
option "curses" | ||
set_description "Enable or disable curses library" | ||
add_links "curses" | ||
add_cincludes "curses.h" | ||
option_end | ||
|
||
# add projects | ||
includes "src/lua-cjson" | ||
includes "src/sv" | ||
includes "src/lz4" | ||
includes "src/tbox" | ||
includes "src/xmake" | ||
includes "src/demo" | ||
if is_config "runtime" "luajit"; then | ||
includes "src/luajit" | ||
else | ||
includes "src/lua" | ||
fi | ||
|
||
|