A Simple Build System on top of Ninja* that supporting multiple platforms.
First you have to compile genscript.c.
gcc genscript.c -o gsb.exe or clang genscript.c -o gsb.exe
Then run gsb.exe (Note: It's called gsb.exe on all platform)
Calling gsb.exe with no argument, will step through the following stages:
This stage create the basic directories and initial config files
Directories Created:
- ./bin/
- ./config/
- ./config/modules/
- ./include/
- ./resources/
- ./src/
File Created:
- ./config/default.txt - See Configuration for details
- ./config/modules/base.txt - See Modules for details
Reads system information to create configurations files for the current platform. Platform can be overwrite by setting the following arguments: PLATFORM, PLATFORM_ARCH, PLATFORM_COMPILER, RELEASE, DEBUG
example: ./gsb.exe PLATFORM=Linux RELEASE
File Created:
- ./config/$platform-$arch.txt
- ./config/$platform-common.txt
Creates build scripts base on current platform. It will replace the ./build.ninja file with a link to ./compile/$platform-$arch/build.ninja
Configuration are stored in INI format files.
Example:
[defines]
PLATFORM_BITS=64
[options]
compiler=gcc
linker=gcc
static_linker=ar -rc
program_suffix=
shared_suffix=.so
static_suffix=.a
[includes]
./include/
[libs]
stdc++
m
[lib_flags]
-std=c++11
[flags]
-std=c++11
[defines]
PLATFORM_$PLATFORM
[linker_flags]
-Wl,-rpath -Wl,\\$$ORIGIN/lib
[options-windows]
program_suffix=.exe
shared_suffix=.dll
[options-3ds]
finaliser=3dsxtool
program_suffix=.elf
finalise_suffix=.3dsx
[commands]
compile_cpp=${compiler} ${compiler_includes} ${compller_defines} ${compiler_flags} -o $out -c $in
compile_c=${compiler} ${compiler_includes} ${compller_defines} ${compiler_flags} -o $out -c $in
link_shared=${linker} -shared ${compiler_lib_flags} $in -o ${binary_prefix}$out ${compiler_lib}
link_static=${static_linker} ${object_dir}$out $in
link=${linker} ${compiler_lib_flags} $in -o ${binary_prefix}$out ${compiler_lib}
finalise=${finaliser} ${finalise_flags} $in -o ${binary_prefix}$out
build_resources=echo
clean=rm -rf ${object_dir}
[pkg-linux]
List of file names to be compiled and linked. By default the base.txt file is used, but other modules can be include by prefix the filename without extension with #.
Modules can also be build as Static or Shared Libraries by having the first line of the file start with $static or $shared
./gsb.exe --help PLATFORM=windows RELEASE
Configure Simple Builds system
Reads files from ./config/ to produce configurations for ninja builds
Target: windows-x86_64 on gcc compiler [release mode]
System: linux-x86_64 on gcc compiler [debug mode]
Command Argument:
-batch - Create Batch/Shell script instead of Ninja Build (Not fully supported)
-new - Create New Project
-platform - Add New Platform
-gen - Generate Build scripts
-editor - [Unfinished] Generate Editor files (Currently only for VSCode)
-c= - Binary to Header, via external command
example: ./gsb.exe -h=a.h -i=a.png.temp -c="picasso -o a.png.temp a.png"
Set Target options with arguments:
PLATFORM={os}
PLATFORM_ARCH={arch}
PLATFORM_COMPILER={compiler}
TARGET_TRIPLET={compiler_prefix} aka 'x86_64-w64-mingw32-'
RELEASE or DEBUG
- Has some limited support for creating batch file/Shell Script