added justfile

This commit is contained in:
Robin Müller 2021-10-18 18:02:12 +02:00
parent c2d54cb75b
commit 41919a7fa3
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
8 changed files with 40 additions and 14 deletions

21
Justfile Normal file
View File

@ -0,0 +1,21 @@
python_script := './cmake/scripts/cmake-build-cfg.py'
default_host_os := if os_family() == "linux" { "linux" } else { "host" }
# Build host-debug-ninja target
default: debug-ninja
# Build for Host with Debug configuration and the Make build system
debug-make:
{{python_script}} -o {{default_host_os}} -l build-Debug -g "make"
# Build for Host with Debug configuration and the Ninja build system
debug-ninja:
{{python_script}} -o {{default_host_os}} -l build-Debug -g "ninja"
# Build for Host with Release configuration and the Make build system
release-make:
{{python_script}} -b release -o {{default_host_os}} -l build-Release -g "make"
# Build for Host with Release configuration and the Ninja build system
release-ninja:
{{python_script}} -b release -o {{default_host_os}} -l build-Release -g "ninja"

View File

@ -18,12 +18,11 @@ fi
build_generator="" build_generator=""
os_fsfw="host" os_fsfw="host"
builddir="build-Debug" builddir="build-Debug"
build_generator="make"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
python="py" python="py"
# Could be other OS but this works for now. # Could be other OS but this works for now.
else else
build_generator="Unix Makefiles"
python="python3" python="python3"
fi fi

View File

@ -18,12 +18,11 @@ fi
build_generator="" build_generator=""
os_fsfw="host" os_fsfw="host"
builddir="build-Release" builddir="build-Release"
build_generator="make"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
python="py" python="py"
# Could be other OS but this works for now. # Could be other OS but this works for now.
else else
build_generator="Unix Makefiles"
python="python3" python="python3"
fi fi

View File

@ -18,7 +18,7 @@ fi
build_generator="" build_generator=""
os_fsfw="host" os_fsfw="host"
builddir="build-Debug" builddir="build-Debug"
build_generator="Ninja" build_generator="ninja"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then
python="py" python="py"
# Could be other OS but this works for now. # Could be other OS but this works for now.

View File

@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then
exit 1 exit 1
fi fi
build_generator="Unix Makefiles" build_generator="make"
os_fsfw="linux" os_fsfw="linux"
builddir="build-Debug" builddir="build-Debug"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then

View File

@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then
exit 1 exit 1
fi fi
build_generator="Unix Makefiles" build_generator="make"
os_fsfw="linux" os_fsfw="linux"
builddir="build-Release" builddir="build-Release"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then

View File

@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then
exit 1 exit 1
fi fi
build_generator="Ninja" build_generator="ninja"
os_fsfw="linux" os_fsfw="linux"
builddir="build-Debug" builddir="build-Debug"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then

View File

@ -31,7 +31,9 @@ def main():
default="debug" default="debug"
) )
parser.add_argument("-l", "--builddir", type=str, help="Specify build directory.") parser.add_argument("-l", "--builddir", type=str, help="Specify build directory.")
parser.add_argument("-g", "--generator", type=str, help="CMake Generator") parser.add_argument(
"-g", "--generator", type=str, help="CMake Generator", choices=["make", "ninja"]
)
parser.add_argument( parser.add_argument(
"-t", "--target-bsp", type=str, help="Target BSP, combination of architecture and machine" "-t", "--target-bsp", type=str, help="Target BSP, combination of architecture and machine"
) )
@ -53,7 +55,15 @@ def main():
generator = determine_build_generator() generator = determine_build_generator()
generator_cmake_arg = f"-G \"{generator}\"" generator_cmake_arg = f"-G \"{generator}\""
else: else:
generator_cmake_arg = f"-G \"{args.generator}\"" if args.generator == "make":
if os.name == 'nt':
generator_cmake_arg = '-G "MinGW Makefiles"'
else:
generator_cmake_arg = '-G "Unix Makefiles"'
elif args.generator == 'ninja':
generator_cmake_arg = '-G Ninja'
else:
generator_cmake_arg = args.generator
if args.osal is None: if args.osal is None:
print("No FSFW OSAL specified.") print("No FSFW OSAL specified.")
@ -63,10 +73,7 @@ def main():
cmake_build_type = determine_build_type(args.buildtype) cmake_build_type = determine_build_type(args.buildtype)
if args.target_bsp is not None: cmake_target_cfg_cmd = ''
cmake_target_cfg_cmd = f"-DTGT_BSP=\"{args.target_bsp}\""
else:
cmake_target_cfg_cmd = determine_tgt_bsp(cmake_fsfw_osal)
define_string = "" define_string = ""
if args.defines is not None: if args.defines is not None: