102 lines
2.8 KiB
Bash
Executable File
102 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
CBUILD_VERSION=2.1.2
|
|
CONFIG_VERSION=1
|
|
|
|
PROJECT="imgui"
|
|
CMP_C="gcc"
|
|
CMP_CPP="g++"
|
|
STD_C="c11"
|
|
STD_CPP="c++11"
|
|
WARN_C="-Wall -Wno-discarded-qualifiers -Wno-unused-parameter"
|
|
WARN_CPP="-Wall -Wno-unused-parameter"
|
|
SRC_C=""
|
|
SRC_CPP="imgui.cpp
|
|
imgui_demo.cpp
|
|
imgui_draw.cpp
|
|
imgui_tables.cpp
|
|
imgui_widgets.cpp
|
|
backends/imgui_impl_sdl2.cpp
|
|
backends/imgui_impl_sdlrenderer2.cpp"
|
|
|
|
# Directory with dependency configs.
|
|
# See cbuild/example_dependency_configs
|
|
DEPENDENCY_CONFIGS_DIR='dependencies'
|
|
# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space.
|
|
ENABLED_DEPENDENCIES=''
|
|
|
|
# OBJDIR structure:
|
|
# ├── objects/ - Compiled object files. Cleans on each call of build task
|
|
# ├── static_libs/ - Symbolic links to static libraries used by linker. Cleans on each call of build task.
|
|
# ├── static_libs/ - Symbolic links to dynamic libraries used by linker. Cleans on each call of build task.
|
|
# └── profile/ - gcc *.gcda profiling info files
|
|
OBJDIR="../obj"
|
|
OUTDIR="../bin"
|
|
STATIC_LIB_FILE="lib$PROJECT.a"
|
|
|
|
# header include directories
|
|
INCLUDE="-I. -I../include/SDL2"
|
|
|
|
# OS-specific options
|
|
case "$OS" in
|
|
WINDOWS)
|
|
EXEC_FILE="$PROJECT.exe"
|
|
SHARED_LIB_FILE="lib$PROJECT.dll"
|
|
;;
|
|
LINUX)
|
|
EXEC_FILE="$PROJECT"
|
|
SHARED_LIB_FILE="lib$PROJECT.so"
|
|
;;
|
|
*)
|
|
error "operating system $OS has no configuration variants"
|
|
;;
|
|
esac
|
|
|
|
# TASKS
|
|
case "$TASK" in
|
|
# creates shared library
|
|
build_shared_lib)
|
|
C_ARGS="-O2 -fpic -flto -shared"
|
|
CPP_ARGS="$C_ARGS"
|
|
LINKER_ARGS="$CPP_ARGS -Wl,-soname,$SHARED_LIB_FILE"
|
|
PRE_TASK_SCRIPT=
|
|
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
|
|
POST_TASK_SCRIPT=
|
|
;;
|
|
# creates shared library with debug symbols and no optimizations
|
|
build_shared_lib_dbg)
|
|
C_ARGS="-O0 -g3 -fpic -shared"
|
|
CPP_ARGS="$C_ARGS"
|
|
LINKER_ARGS="$CPP_ARGS -Wl,-soname,$SHARED_LIB_FILE"
|
|
PRE_TASK_SCRIPT=
|
|
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
|
|
POST_TASK_SCRIPT=
|
|
;;
|
|
# creates static library
|
|
build_static_lib)
|
|
C_ARGS="-O2"
|
|
CPP_ARGS="$C_ARGS"
|
|
PRE_TASK_SCRIPT=
|
|
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
|
|
POST_TASK_SCRIPT=
|
|
;;
|
|
# creates static library with debug symbols and no optimizations
|
|
build_static_lib_dbg)
|
|
C_ARGS="-O0 -g3"
|
|
CPP_ARGS="$C_ARGS"
|
|
PRE_TASK_SCRIPT=
|
|
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
|
|
POST_TASK_SCRIPT=
|
|
;;
|
|
# deletes generated files
|
|
clean)
|
|
TASK_SCRIPT=cbuild/default_tasks/clean.sh
|
|
;;
|
|
# nothing to do
|
|
"" | no_task)
|
|
;;
|
|
# unknown task
|
|
*)
|
|
error "task <$TASK> not found"
|
|
;;
|
|
esac
|