Skip to content

Commit

Permalink
build: remove nproc
Browse files Browse the repository at this point in the history
Signed-off-by: He Xian <[email protected]>
  • Loading branch information
hexian000 committed Oct 2, 2024
1 parent 78575ca commit 0b7495e
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions m.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh
cd "$(dirname "$0")"
GENERATOR="Unix Makefiles"
NPROC="1"
set -ex

case "$1" in
Expand All @@ -14,7 +13,7 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_FIND_ROOT_PATH="${SYSROOT};${LIBROOT}" \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
ls -lh "build/src/kcptun-libev"
;;
"xs")
Expand All @@ -27,7 +26,7 @@ case "$1" in
-DCMAKE_FIND_ROOT_PATH="${SYSROOT};${LIBROOT}" \
-DBUILD_STATIC=ON \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
ls -lh "build/src/kcptun-libev"
;;
"r")
Expand All @@ -37,7 +36,7 @@ case "$1" in
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
ls -lh "build/src/kcptun-libev"
;;
"s")
Expand All @@ -48,7 +47,7 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DBUILD_STATIC=ON \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
ls -lh "build/src/kcptun-libev"
;;
"p")
Expand All @@ -58,7 +57,7 @@ case "$1" in
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
(cd "build/src" && objdump -drwS "kcptun-libev" >"kcptun-libev.S")
ls -lh "build/src/kcptun-libev"
;;
Expand All @@ -70,7 +69,7 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DFORCE_POSIX=1 \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
ls -lh "build/src/kcptun-libev"
;;
"clang")
Expand All @@ -82,7 +81,7 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld --rtlib=compiler-rt" \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
(cd "build/src" && llvm-objdump -drwS "kcptun-libev" >"kcptun-libev.S")
ls -lh "build/src/kcptun-libev"
;;
Expand All @@ -94,12 +93,12 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc" \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
TARGET="$(cc -dumpmachine)"
zip -9j "build/kcptun-libev-win32.${TARGET}.zip" \
nice cmake --build "build"
HOST="$(cc -dumpmachine)"
zip -9j "build/kcptun-libev-win32.${HOST}.zip" \
"/usr/bin/msys-2.0.dll" \
"build/src/kcptun-libev.exe"
ls -lh "build/kcptun-libev-win32.${TARGET}.zip"
ls -lh "build/kcptun-libev-win32.${HOST}.zip"
;;
"ndk")
# cross compiling, environment vars need to be set
Expand All @@ -114,7 +113,7 @@ case "$1" in
-DCMAKE_FIND_ROOT_PATH="${SYSROOT};${LIBROOT}" \
-DLINK_STATIC_LIBS=ON \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build"
ls -lh "build/src/kcptun-libev"
;;
"single")
Expand Down Expand Up @@ -144,7 +143,7 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-S . -B "build"
ln -sf build/compile_commands.json compile_commands.json
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build" --parallel
ls -lh "build/src/kcptun-libev"
;;
"san")
Expand All @@ -157,7 +156,7 @@ case "$1" in
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-S "." -B "build"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build" --parallel
ls -lh "build/src/kcptun-libev"
;;
"c")
Expand All @@ -172,7 +171,7 @@ case "$1" in
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-S "." -B "build"
ln -sf "build/compile_commands.json" "compile_commands.json"
nice cmake --build "build" --parallel "${NPROC}"
nice cmake --build "build" --parallel
ls -lh "build/src/kcptun-libev"
;;
esac

0 comments on commit 0b7495e

Please sign in to comment.