Compare commits
14 Commits
2.2.0
...
579dd5916e
| Author | SHA1 | Date | |
|---|---|---|---|
| 579dd5916e | |||
| 05f3b9a0a0 | |||
| 49ccc76933 | |||
| d1660e05cb | |||
| 259d9873fb | |||
| 46029cd01f | |||
| 5953b84cff | |||
| 4c34c127a6 | |||
| cae29d6395 | |||
| 596c570756 | |||
| 1c93d4eb73 | |||
| 6126001e5a | |||
| 912b348f57 | |||
| d3d7867736 |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# git add --renormalize .
|
||||||
|
*.sh text eol=lf
|
||||||
@@ -1 +1 @@
|
|||||||
2.2.0
|
2.3.0
|
||||||
23
CHANGELOG.md
23
CHANGELOG.md
@@ -1,3 +1,26 @@
|
|||||||
|
## 2.3.0
|
||||||
|
+ Added ***project user config***! Read more in `./project.config.user.default`
|
||||||
|
+ Changed `include` function: replaced prefix `cbuild/` with `@cbuild/`.
|
||||||
|
+ **CONFIG:** Changed `cbuild/default_tasks` to `@cbuild/default_tasks`
|
||||||
|
+ Moved most scripts to `include/`
|
||||||
|
+ Renamed default config to `./project.config.default`
|
||||||
|
|
||||||
|
## 2.2.4
|
||||||
|
+ *default config*: C standard changed to C99
|
||||||
|
+ *default config*: enabled more warnings
|
||||||
|
+ added file `default_vscode/c_cpp_properties.json`
|
||||||
|
+ fixed copying of `default_vscode` files
|
||||||
|
|
||||||
|
## 2.2.3
|
||||||
|
+ removed `\r` characters from `detect_os.sh`
|
||||||
|
|
||||||
|
## 2.2.2
|
||||||
|
+ `bootstrap.sh` can show help for cbuild installations again
|
||||||
|
+ copy dependency out files only if they are newer or don't exist
|
||||||
|
|
||||||
|
## 2.2.1
|
||||||
|
+ updated `bootsrap.sh` to 1.0.2
|
||||||
|
|
||||||
## 2.2.0
|
## 2.2.0
|
||||||
+ **config**: removed slash after `--fullpath-after` in `VALGRIND_ARGS`
|
+ **config**: removed slash after `--fullpath-after` in `VALGRIND_ARGS`
|
||||||
+ **config**: removed `CONFIG_VERSION` variable
|
+ **config**: removed `CONFIG_VERSION` variable
|
||||||
|
|||||||
22
bootstrap.sh
22
bootstrap.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
CBUILD_BOOTSTRAP_VERSION=1.0.1
|
CBUILD_BOOTSTRAP_VERSION=1.0.3
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
function version_parse {
|
function version_parse {
|
||||||
@@ -34,13 +34,14 @@ function print_version_list {
|
|||||||
dir_global="/usr/local/share/cbuild"
|
dir_global="/usr/local/share/cbuild"
|
||||||
files=""
|
files=""
|
||||||
if [ -d "$dir_local" ]; then
|
if [ -d "$dir_local" ]; then
|
||||||
files+="$(find $dir_local -name 'CBUILD_VERSION')"
|
files+=$(find "$dir_local" -maxdepth 2 -name 'CBUILD_VERSION')
|
||||||
fi
|
fi
|
||||||
if [ -d "$dir_global" ]; then
|
if [ -d "$dir_global" ]; then
|
||||||
files+="$(find $dir_global -name 'CBUILD_VERSION')"
|
files+=$(find "$dir_global" -maxdepth 2 -name 'CBUILD_VERSION')
|
||||||
fi
|
fi
|
||||||
for f in $files; do
|
for f in $files; do
|
||||||
cat $f | sed '$a\'
|
cat $f
|
||||||
|
echo " at $(dirname $f)"
|
||||||
done | sort -V
|
done | sort -V
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +69,9 @@ do
|
|||||||
case "${args[i]}" in
|
case "${args[i]}" in
|
||||||
'-v' | '--version')
|
'-v' | '--version')
|
||||||
echo "cbuild-bootstrap v$CBUILD_BOOTSTRAP_VERSION"
|
echo "cbuild-bootstrap v$CBUILD_BOOTSTRAP_VERSION"
|
||||||
|
echo "list of installed cbuild versions:"
|
||||||
|
print_version_list
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
'-h' | '--help')
|
'-h' | '--help')
|
||||||
print_help
|
print_help
|
||||||
@@ -76,10 +80,6 @@ do
|
|||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
project_config_path="${args[i]}"
|
project_config_path="${args[i]}"
|
||||||
;;
|
;;
|
||||||
'--list-versions')
|
|
||||||
print_version_list
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -93,9 +93,9 @@ if [ -z "$CBUILD_VERSION" ]; then
|
|||||||
else
|
else
|
||||||
echo "project config not found"
|
echo "project config not found"
|
||||||
echo "list of installed cbuild versions:"
|
echo "list of installed cbuild versions:"
|
||||||
versions=$(print_version_list)
|
print_version_list
|
||||||
|
# cut installation directories from list
|
||||||
echo "$versions"
|
versions=$(print_version_list | cut -d ' ' -f 1)
|
||||||
latest_version=$(echo "$versions" | tail -n 1)
|
latest_version=$(echo "$versions" | tail -n 1)
|
||||||
echo "select version (default=$latest_version):"
|
echo "select version (default=$latest_version):"
|
||||||
read -r CBUILD_VERSION
|
read -r CBUILD_VERSION
|
||||||
|
|||||||
42
cbuild.sh
42
cbuild.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
INSTALLED_CBUILD_VERSION=2.2.0
|
INSTALLED_CBUILD_VERSION=2.3.0
|
||||||
|
|
||||||
# set \t size to 4 spaces
|
# set \t size to 4 spaces
|
||||||
tabs 4
|
tabs 4
|
||||||
@@ -33,16 +33,16 @@ fi
|
|||||||
|
|
||||||
function include {
|
function include {
|
||||||
local script_path="$1"
|
local script_path="$1"
|
||||||
if [[ "$script_path" == cbuild/* ]]; then
|
if [[ "$script_path" == @cbuild/* ]]; then
|
||||||
script_path="$CBUILD_INSTALL_DIR/$(echo $script_path | sed 's,^cbuild/,,')"
|
script_path="$CBUILD_INSTALL_DIR/$(echo $script_path | sed 's,^@cbuild/,,')"
|
||||||
fi
|
fi
|
||||||
# echp "including script $script_path"
|
# echp "including script $script_path"
|
||||||
. "$script_path"
|
. "$script_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
include "cbuild/myprint.sh"
|
include "@cbuild/include/myprint.sh"
|
||||||
include "cbuild/functions.sh"
|
include "@cbuild/include/functions.sh"
|
||||||
include "cbuild/config.sh"
|
include "@cbuild/include/config.sh"
|
||||||
|
|
||||||
function print_help {
|
function print_help {
|
||||||
myprint "cbuild v$INSTALLED_CBUILD_VERSION"
|
myprint "cbuild v$INSTALLED_CBUILD_VERSION"
|
||||||
@@ -92,22 +92,28 @@ do
|
|||||||
|
|
||||||
# create project config
|
# create project config
|
||||||
project_config_path="$new_project_dir/project.config"
|
project_config_path="$new_project_dir/project.config"
|
||||||
cp "$CBUILD_INSTALL_DIR/default.config" "$project_config_path.temp"
|
cp "$CBUILD_INSTALL_DIR/project.config.default" "$project_config_path.temp"
|
||||||
myprint "Enter project name: "
|
myprint "${WHITE}Enter project name: "
|
||||||
read -r project_name
|
read -r project_name
|
||||||
sed "s,\%PROJECT_NAME\%,$project_name,g" \
|
sed "s,\%PROJECT_NAME\%,$project_name,g" \
|
||||||
"$project_config_path.temp" > "$project_config_path"
|
"$project_config_path.temp" > "$project_config_path"
|
||||||
rm "$project_config_path.temp"
|
rm "$project_config_path.temp"
|
||||||
myprint "${GREEN}created config at '$project_config_path'"
|
myprint "${GREEN}Created '$project_config_path'"
|
||||||
|
# create project user default config
|
||||||
|
project_user_config_path="$new_project_dir/project.config.user.default"
|
||||||
|
cp "$CBUILD_INSTALL_DIR/project.config.user.default" "$project_user_config_path"
|
||||||
|
myprint "${GREEN}Created '$project_user_config_path'"
|
||||||
|
|
||||||
if ask_yn "Copy default .gitignore?"; then
|
if ask_yn "${WHITE}Copy default .gitignore?"; then
|
||||||
cp -v "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/"
|
cp -v "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ask_yn "Copy default .vscode launch tasks?"; then
|
if ask_yn "${WHITE}Copy default .vscode launch tasks?"; then
|
||||||
new_project_vscode_dir="$new_project_dir/.vscode"
|
new_project_vscode_dir="$new_project_dir/.vscode"
|
||||||
mkdir -p "$new_project_vscode_dir"
|
mkdir -pv "$new_project_vscode_dir"
|
||||||
cp -vr "$CBUILD_INSTALL_DIR/default_vscode/"* "$new_project_vscode_dir/"
|
for vscode_dir_f in $(find "$CBUILD_INSTALL_DIR/default_vscode/" -type f); do
|
||||||
|
cp -vr "$vscode_dir_f" "$new_project_vscode_dir/"
|
||||||
|
done
|
||||||
sed "s,\%PROJECT_NAME\%,$project_name,g" \
|
sed "s,\%PROJECT_NAME\%,$project_name,g" \
|
||||||
"$new_project_vscode_dir/launch.json" > "$new_project_vscode_dir/launch.json.temp"
|
"$new_project_vscode_dir/launch.json" > "$new_project_vscode_dir/launch.json.temp"
|
||||||
mv "$new_project_vscode_dir/launch.json.temp" "$new_project_vscode_dir/launch.json"
|
mv "$new_project_vscode_dir/launch.json.temp" "$new_project_vscode_dir/launch.json"
|
||||||
@@ -131,15 +137,17 @@ function call_task {
|
|||||||
load_config "$project_config_path" "$task" true
|
load_config "$project_config_path" "$task" true
|
||||||
|
|
||||||
if [ ! -z "$PRE_TASK_SCRIPT" ]; then
|
if [ ! -z "$PRE_TASK_SCRIPT" ]; then
|
||||||
myprint "${BLUE}executing ${WHITE}$TASK_SCRIPT"
|
myprint "${BLUE}executing ${WHITE}'$PRE_TASK_SCRIPT'"
|
||||||
include "$PRE_TASK_SCRIPT"
|
include "$PRE_TASK_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
myprint "${BLUE}executing ${WHITE}$TASK_SCRIPT"
|
if [ ! -z "$TASK_SCRIPT" ]; then
|
||||||
include "$TASK_SCRIPT"
|
myprint "${BLUE}executing ${WHITE}'$TASK_SCRIPT'"
|
||||||
|
include "$TASK_SCRIPT"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -z "$POST_TASK_SCRIPT" ]; then
|
if [ ! -z "$POST_TASK_SCRIPT" ]; then
|
||||||
myprint "${BLUE}executing ${WHITE}$POST_TASK_SCRIPT"
|
myprint "${BLUE}executing ${WHITE}'$POST_TASK_SCRIPT'"
|
||||||
include "$POST_TASK_SCRIPT"
|
include "$POST_TASK_SCRIPT"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
14
default_vscode/c_cpp_properties.json
Normal file
14
default_vscode/c_cpp_properties.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "all",
|
||||||
|
"defines": [],
|
||||||
|
"includePath": [
|
||||||
|
// "include",
|
||||||
|
"${default}"
|
||||||
|
],
|
||||||
|
"cStandard": "c99"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
DEP_WORKING_DIR='depencencies/libexample1'
|
DEP_WORKING_DIR='dependencies/libexample1'
|
||||||
DEP_PRE_BUILD_COMMAND=''
|
DEP_PRE_BUILD_COMMAND=''
|
||||||
DEP_BUILD_COMMAND='make libexample1.a'
|
DEP_BUILD_COMMAND='make libexample1.a'
|
||||||
DEP_POST_BUILD_COMMAND=''
|
DEP_POST_BUILD_COMMAND=''
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
DEP_WORKING_DIR='depencencies/libexample2'
|
DEP_WORKING_DIR='dependencies/libexample2'
|
||||||
DEP_PRE_BUILD_COMMAND=''
|
DEP_PRE_BUILD_COMMAND=''
|
||||||
DEP_POST_BUILD_COMMAND=''
|
DEP_POST_BUILD_COMMAND=''
|
||||||
DEP_CLEAN_COMMAND='make clean'
|
DEP_CLEAN_COMMAND='make clean'
|
||||||
|
|||||||
0
chmod_scripts.sh → include/chmod_scripts.sh
Executable file → Normal file
0
chmod_scripts.sh → include/chmod_scripts.sh
Executable file → Normal file
@@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
include cbuild/myprint.sh
|
include "@cbuild/include/myprint.sh"
|
||||||
include cbuild/functions.sh
|
include "@cbuild/include/functions.sh"
|
||||||
include cbuild/detect_os.sh
|
include "@cbuild/include/detect_os.sh"
|
||||||
|
|
||||||
function load_config {
|
function load_config {
|
||||||
local project_config_path="$1"
|
local project_config_path="$1"
|
||||||
TASK="$2"
|
TASK="$2"
|
||||||
local quiet=$3
|
local quiet=$3
|
||||||
|
|
||||||
myprint "${BLUE}loading config ${WHITE}'$(realpath $project_config_path)'"
|
myprint "${BLUE}loading ${WHITE}'$project_config_path'"
|
||||||
|
|
||||||
if [ -z "$project_config_path" ]; then
|
if [ -z "$project_config_path" ]; then
|
||||||
error "config path is null"
|
error "config path is null"
|
||||||
@@ -51,6 +51,15 @@ function load_config {
|
|||||||
set -u
|
set -u
|
||||||
include "$project_config_path"
|
include "$project_config_path"
|
||||||
|
|
||||||
|
# load project user config
|
||||||
|
local project_user_config_path="$project_config_path.user"
|
||||||
|
if [ ! -f "$project_user_config_path" ]; then
|
||||||
|
myprint "${YELLOW}creating default project user config ${WHITE}$project_user_config_path"
|
||||||
|
cp "$project_user_config_path.default" "$project_user_config_path"
|
||||||
|
fi
|
||||||
|
myprint "${BLUE}loading ${WHITE}'$project_user_config_path'"
|
||||||
|
include "$project_user_config_path"
|
||||||
|
|
||||||
mkdir -p "$OUTDIR"
|
mkdir -p "$OUTDIR"
|
||||||
mkdir -p "$OBJDIR/objects"
|
mkdir -p "$OBJDIR/objects"
|
||||||
mkdir -p "$OBJDIR/static_libs"
|
mkdir -p "$OBJDIR/static_libs"
|
||||||
@@ -60,5 +69,5 @@ function load_config {
|
|||||||
# dont thorw error on undefined variable
|
# dont thorw error on undefined variable
|
||||||
set +u
|
set +u
|
||||||
|
|
||||||
myprint_quiet $quiet "${GREEN}loaded cbuild config"
|
myprint_quiet $quiet "${GREEN}config loading completed"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
include "cbuild/myprint.sh"
|
include "@cbuild/include/myprint.sh"
|
||||||
|
|
||||||
function detect_os {
|
function detect_os {
|
||||||
local uname_result="$(uname -o)"
|
local uname_result="$(uname -o)"
|
||||||
10
functions.sh → include/functions.sh
Executable file → Normal file
10
functions.sh → include/functions.sh
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
include "cbuild/myprint.sh"
|
include "@cbuild/include/myprint.sh"
|
||||||
|
|
||||||
function exec_script_line {
|
function exec_script_line {
|
||||||
local script="$1"
|
local script="$1"
|
||||||
@@ -90,10 +90,10 @@ function build_dependency {
|
|||||||
if [ "$PRESERVE_OUT_DIRECTORY_STRUCTURE" = true ] && [ "$file_dir" != '.' ]; then
|
if [ "$PRESERVE_OUT_DIRECTORY_STRUCTURE" = true ] && [ "$file_dir" != '.' ]; then
|
||||||
mkdir -p "$proj_root_dir/$OUTDIR/$file_dir"
|
mkdir -p "$proj_root_dir/$OUTDIR/$file_dir"
|
||||||
mkdir -p "$proj_root_dir/$OBJDIR/dynamic_libs/$file_dir"
|
mkdir -p "$proj_root_dir/$OBJDIR/dynamic_libs/$file_dir"
|
||||||
cp -v "$file" "$proj_root_dir/$OUTDIR/$file"
|
cp -v -u --preserve=timestamps "$file" "$proj_root_dir/$OUTDIR/$file"
|
||||||
ln -sfv "$real_file" "$proj_root_dir/$OBJDIR/dynamic_libs/$file"
|
ln -sfv "$real_file" "$proj_root_dir/$OBJDIR/dynamic_libs/$file"
|
||||||
else
|
else
|
||||||
cp -v "$file" "$proj_root_dir/$OUTDIR/"
|
cp -v -u --preserve=timestamps "$file" "$proj_root_dir/$OUTDIR/"
|
||||||
ln -sfv "$real_file" "$proj_root_dir/$OBJDIR/dynamic_libs/"
|
ln -sfv "$real_file" "$proj_root_dir/$OBJDIR/dynamic_libs/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -104,9 +104,9 @@ function build_dependency {
|
|||||||
if [ "$PRESERVE_OUT_DIRECTORY_STRUCTURE" = true ]; then
|
if [ "$PRESERVE_OUT_DIRECTORY_STRUCTURE" = true ]; then
|
||||||
file_dir=$(dirname $file)
|
file_dir=$(dirname $file)
|
||||||
mkdir -p "$proj_root_dir/$OUTDIR/$file_dir"
|
mkdir -p "$proj_root_dir/$OUTDIR/$file_dir"
|
||||||
cp -v "$file" "$proj_root_dir/$OUTDIR/$file"
|
cp -v -u --preserve=timestamps "$file" "$proj_root_dir/$OUTDIR/$file"
|
||||||
else
|
else
|
||||||
cp -v "$file" "$proj_root_dir/$OUTDIR/"
|
cp -v -u --preserve=timestamps "$file" "$proj_root_dir/$OUTDIR/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -1,19 +1,28 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
CBUILD_VERSION=2.2.0
|
CBUILD_VERSION=2.3.0
|
||||||
|
|
||||||
PROJECT="%PROJECT_NAME%"
|
PROJECT="%PROJECT_NAME%"
|
||||||
CMP_C="gcc"
|
CMP_C="gcc"
|
||||||
CMP_CPP="g++"
|
CMP_CPP="g++"
|
||||||
STD_C="c11"
|
STD_C="c99"
|
||||||
STD_CPP="c++11"
|
STD_CPP="c++11"
|
||||||
WARN_C="-Wall -Wno-discarded-qualifiers -Wextra -Wno-unused-parameter"
|
WARN_C="-Wall -Wextra
|
||||||
WARN_CPP="-Wall -Wextra -Wno-unused-parameter"
|
-Wduplicated-branches
|
||||||
|
-Wduplicated-cond
|
||||||
|
-Wformat=2
|
||||||
|
-Wmissing-include-dirs
|
||||||
|
-Wshadow
|
||||||
|
-Werror=return-type
|
||||||
|
-Werror=pointer-arith
|
||||||
|
-Werror=init-self
|
||||||
|
-Werror=incompatible-pointer-types"
|
||||||
|
WARN_CPP="$WARN_C"
|
||||||
SRC_C="$(find src -name '*.c')"
|
SRC_C="$(find src -name '*.c')"
|
||||||
SRC_CPP="$(find src -name '*.cpp')"
|
SRC_CPP="$(find src -name '*.cpp')"
|
||||||
|
|
||||||
# Directory with dependency configs.
|
# Directory with dependency configs.
|
||||||
# See cbuild/example_dependency_configs
|
# See cbuild/example_dependency_configs
|
||||||
DEPENDENCY_CONFIGS_DIR='.'
|
DEPENDENCY_CONFIGS_DIR='dependencies'
|
||||||
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
||||||
ENABLED_DEPENDENCIES=''
|
ENABLED_DEPENDENCIES=''
|
||||||
|
|
||||||
@@ -24,22 +33,24 @@ ENABLED_DEPENDENCIES=''
|
|||||||
# └── profile/ - gcc *.gcda profiling info files
|
# └── profile/ - gcc *.gcda profiling info files
|
||||||
OBJDIR="obj"
|
OBJDIR="obj"
|
||||||
OUTDIR="bin"
|
OUTDIR="bin"
|
||||||
STATIC_LIB_FILE="lib$PROJECT.a"
|
STATIC_LIB_FILE="$PROJECT.a"
|
||||||
|
|
||||||
|
# example: "-I./include"
|
||||||
|
INCLUDE=""
|
||||||
|
|
||||||
# OS-specific options
|
# OS-specific options
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
WINDOWS)
|
WINDOWS)
|
||||||
EXEC_FILE="$PROJECT.exe"
|
EXEC_FILE="$PROJECT.exe"
|
||||||
SHARED_LIB_FILE="$PROJECT.dll"
|
SHARED_LIB_FILE="$PROJECT.dll"
|
||||||
# example: "-I./dependencies/include/SDL2"
|
INCLUDE="$INCLUDE "
|
||||||
INCLUDE=""
|
|
||||||
# example: "-lSDL2 -lSDL2_image"
|
# example: "-lSDL2 -lSDL2_image"
|
||||||
LINKER_LIBS=""
|
LINKER_LIBS=""
|
||||||
;;
|
;;
|
||||||
LINUX)
|
LINUX)
|
||||||
EXEC_FILE="$PROJECT"
|
EXEC_FILE="$PROJECT"
|
||||||
SHARED_LIB_FILE="$PROJECT.so"
|
SHARED_LIB_FILE="$PROJECT.so"
|
||||||
INCLUDE=""
|
INCLUDE="$INCLUDE "
|
||||||
LINKER_LIBS=""
|
LINKER_LIBS=""
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -60,61 +71,61 @@ case "$TASK" in
|
|||||||
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects -fdata-sections -ffunction-sections -Wl,--gc-sections"
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects -fdata-sections -ffunction-sections -Wl,--gc-sections"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||||
PRE_TASK_SCRIPT=
|
PRE_TASK_SCRIPT=""
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
TASK_SCRIPT="@cbuild/default_tasks/build_exec.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# creates executable with debug info and no optimizations
|
# creates executable with debug info and no optimizations
|
||||||
build_exec_dbg)
|
build_exec_dbg)
|
||||||
C_ARGS="-O0 -g3"
|
C_ARGS="-O0 -g3"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||||
PRE_TASK_SCRIPT=
|
PRE_TASK_SCRIPT=""
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
TASK_SCRIPT="@cbuild/default_tasks/build_exec.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# creates shared library
|
# creates shared library
|
||||||
build_shared_lib)
|
build_shared_lib)
|
||||||
C_ARGS="-O2 -fpic -flto -shared"
|
C_ARGS="-O2 -fpic -flto -shared"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS -Wl,-soname,$SHARED_LIB_FILE"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS -Wl,-soname,$SHARED_LIB_FILE"
|
||||||
PRE_TASK_SCRIPT=
|
PRE_TASK_SCRIPT=""
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
|
TASK_SCRIPT="@cbuild/default_tasks/build_shared_lib.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# creates shared library with debug symbols and no optimizations
|
# creates shared library with debug symbols and no optimizations
|
||||||
build_shared_lib_dbg)
|
build_shared_lib_dbg)
|
||||||
C_ARGS="-O0 -g3 -fpic -shared"
|
C_ARGS="-O0 -g3 -fpic -shared"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS -Wl,-soname,$SHARED_LIB_FILE"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS -Wl,-soname,$SHARED_LIB_FILE"
|
||||||
PRE_TASK_SCRIPT=
|
PRE_TASK_SCRIPT=""
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
|
TASK_SCRIPT="@cbuild/default_tasks/build_shared_lib.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# creates static library
|
# creates static library
|
||||||
build_static_lib)
|
build_static_lib)
|
||||||
C_ARGS="-O2 -fpic -fdata-sections -ffunction-sections"
|
C_ARGS="-O2 -fpic -fdata-sections -ffunction-sections"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
PRE_TASK_SCRIPT=
|
PRE_TASK_SCRIPT=""
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
|
TASK_SCRIPT="@cbuild/default_tasks/build_static_lib.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# creates static library with debug symbols and no optimizations
|
# creates static library with debug symbols and no optimizations
|
||||||
build_static_lib_dbg)
|
build_static_lib_dbg)
|
||||||
C_ARGS="-O0 -g3"
|
C_ARGS="-O0 -g3"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
PRE_TASK_SCRIPT=
|
PRE_TASK_SCRIPT=""
|
||||||
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
|
TASK_SCRIPT="@cbuild/default_tasks/build_static_lib.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# executes $EXEC_FILE
|
# executes $EXEC_FILE
|
||||||
exec)
|
exec)
|
||||||
TASK_SCRIPT=cbuild/default_tasks/exec.sh
|
TASK_SCRIPT="@cbuild/default_tasks/exec.sh"
|
||||||
;;
|
;;
|
||||||
# executes $EXEC_FILE with valgrind memory checker
|
# executes $EXEC_FILE with valgrind memory checker
|
||||||
valgrind)
|
valgrind)
|
||||||
VALGRIND_ARGS="-s --read-var-info=yes --track-origins=yes --fullpath-after=$(pwd)/ --leak-check=full --show-leak-kinds=all"
|
VALGRIND_ARGS="-s --read-var-info=yes --track-origins=yes --fullpath-after=$(pwd)/ --leak-check=full --show-leak-kinds=all"
|
||||||
TASK_SCRIPT=cbuild/default_tasks/valgrind.sh
|
TASK_SCRIPT="@cbuild/default_tasks/valgrind.sh"
|
||||||
;;
|
;;
|
||||||
# generates profiling info
|
# generates profiling info
|
||||||
profile)
|
profile)
|
||||||
@@ -128,9 +139,9 @@ case "$TASK" in
|
|||||||
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-generate -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-generate -fprofile-prefix-path=$(realpath $OBJDIR)/objects"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||||
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
PRE_TASK_SCRIPT="@cbuild/default_tasks/build_exec.sh"
|
||||||
TASK_SCRIPT=cbuild/default_tasks/profile.sh
|
TASK_SCRIPT="@cbuild/default_tasks/profile.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# compiles program with -pg and runs it with gprof
|
# compiles program with -pg and runs it with gprof
|
||||||
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
||||||
@@ -141,9 +152,9 @@ case "$TASK" in
|
|||||||
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -pg"
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin -pg"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||||
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
PRE_TASK_SCRIPT="@cbuild/default_tasks/build_exec.sh"
|
||||||
TASK_SCRIPT=cbuild/default_tasks/gprof.sh
|
TASK_SCRIPT="@cbuild/default_tasks/gprof.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# compiles program and runs it with callgrind (part of valgrind)
|
# compiles program and runs it with callgrind (part of valgrind)
|
||||||
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
||||||
@@ -155,9 +166,9 @@ case "$TASK" in
|
|||||||
C_ARGS="-O2 -flto=auto -fuse-linker-plugin"
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||||
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
PRE_TASK_SCRIPT="@cbuild/default_tasks/build_exec.sh"
|
||||||
TASK_SCRIPT=cbuild/default_tasks/callgrind.sh
|
TASK_SCRIPT="@cbuild/default_tasks/callgrind.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# compiles executable with sanitizers and executes it to find errors and warnings
|
# compiles executable with sanitizers and executes it to find errors and warnings
|
||||||
sanitize)
|
sanitize)
|
||||||
@@ -165,19 +176,19 @@ case "$TASK" in
|
|||||||
C_ARGS="-O0 -g3 -fsanitize=undefined,address"
|
C_ARGS="-O0 -g3 -fsanitize=undefined,address"
|
||||||
CPP_ARGS="$C_ARGS"
|
CPP_ARGS="$C_ARGS"
|
||||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||||
PRE_TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
PRE_TASK_SCRIPT="@cbuild/default_tasks/build_exec.sh"
|
||||||
TASK_SCRIPT=cbuild/default_tasks/exec.sh
|
TASK_SCRIPT="@cbuild/default_tasks/exec.sh"
|
||||||
POST_TASK_SCRIPT=
|
POST_TASK_SCRIPT=""
|
||||||
;;
|
;;
|
||||||
# rebuilds specified dependencies
|
# rebuilds specified dependencies
|
||||||
# EXAMPLE: `cbuild rebuild_dependencies=libexample1,fonts`
|
# EXAMPLE: `cbuild rebuild_dependencies=libexample1,fonts`
|
||||||
# 'all' can be specified to rebuild all dependencies
|
# 'all' can be specified to rebuild all dependencies
|
||||||
rebuild_dependencies)
|
rebuild_dependencies)
|
||||||
TASK_SCRIPT=cbuild/default_tasks/rebuild_dependencies.sh
|
TASK_SCRIPT="@cbuild/default_tasks/rebuild_dependencies.sh"
|
||||||
;;
|
;;
|
||||||
# deletes generated files
|
# deletes generated files
|
||||||
clean)
|
clean)
|
||||||
TASK_SCRIPT=cbuild/default_tasks/clean.sh
|
TASK_SCRIPT="@cbuild/default_tasks/clean.sh"
|
||||||
;;
|
;;
|
||||||
# nothing to do
|
# nothing to do
|
||||||
"" | no_task)
|
"" | no_task)
|
||||||
11
project.config.user.default
Normal file
11
project.config.user.default
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Project user config is ignored by git.
|
||||||
|
# Here you can add variables that users might want to change
|
||||||
|
# on their local machine, without commiting to the repository.
|
||||||
|
|
||||||
|
# Directory where you install dependencies.
|
||||||
|
# Do not confuse with DEPENDENCY_CONFIGS_DIR
|
||||||
|
# Example:
|
||||||
|
# libexample source code is at `../libexample`, and dependency config
|
||||||
|
# that specifies how to build this lib is at `dependencies/libexample.config`
|
||||||
|
DEPENDENCIES_DIR=".."
|
||||||
3
setup.sh
3
setup.sh
@@ -66,9 +66,12 @@ if [ -f "$bootstrap_install_path" ]; then
|
|||||||
local_bootstrap_version_int=$(echo $local_bootstrap_version | sed 's/\.//g')
|
local_bootstrap_version_int=$(echo $local_bootstrap_version | sed 's/\.//g')
|
||||||
|
|
||||||
if [[ $local_bootstrap_version_int > $installed_bootstrap_version_int ]]; then
|
if [[ $local_bootstrap_version_int > $installed_bootstrap_version_int ]]; then
|
||||||
|
echo "Found outdated bootstrap.sh in '$CBUILD_INSTALL_DIR', updating"
|
||||||
ln -sf "$(realpath $CBUILD_INSTALL_DIR/bootstrap.sh)" -T "$bootstrap_install_path"
|
ln -sf "$(realpath $CBUILD_INSTALL_DIR/bootstrap.sh)" -T "$bootstrap_install_path"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
echo "Not found bootstrap.sh in '$CBUILD_INSTALL_DIR', installing"
|
||||||
ln -sf "$(realpath $CBUILD_INSTALL_DIR/bootstrap.sh)" -T "$bootstrap_install_path"
|
ln -sf "$(realpath $CBUILD_INSTALL_DIR/bootstrap.sh)" -T "$bootstrap_install_path"
|
||||||
fi
|
fi
|
||||||
|
echo "Link bootstrap.sh to $CBUILD_BIN_DIR"
|
||||||
ln -sf "$(realpath $bootstrap_install_path)" -T "$CBUILD_BIN_DIR/cbuild"
|
ln -sf "$(realpath $bootstrap_install_path)" -T "$CBUILD_BIN_DIR/cbuild"
|
||||||
|
|||||||
Reference in New Issue
Block a user