diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..017c5a2 --- /dev/null +++ b/Justfile @@ -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" \ No newline at end of file diff --git a/cmake/scripts/Hosted/make-debug-cfg.sh b/cmake/scripts/Hosted/make-debug-cfg.sh index 883a05d..61cd9a9 100755 --- a/cmake/scripts/Hosted/make-debug-cfg.sh +++ b/cmake/scripts/Hosted/make-debug-cfg.sh @@ -18,12 +18,11 @@ fi build_generator="" os_fsfw="host" builddir="build-Debug" +build_generator="make" if [ "${OS}" = "Windows_NT" ]; then - build_generator="MinGW Makefiles" python="py" # Could be other OS but this works for now. else - build_generator="Unix Makefiles" python="python3" fi diff --git a/cmake/scripts/Hosted/make-release-cfg.sh b/cmake/scripts/Hosted/make-release-cfg.sh index 4618c8d..e215dbb 100755 --- a/cmake/scripts/Hosted/make-release-cfg.sh +++ b/cmake/scripts/Hosted/make-release-cfg.sh @@ -18,12 +18,11 @@ fi build_generator="" os_fsfw="host" builddir="build-Release" +build_generator="make" if [ "${OS}" = "Windows_NT" ]; then - build_generator="MinGW Makefiles" python="py" # Could be other OS but this works for now. else - build_generator="Unix Makefiles" python="python3" fi diff --git a/cmake/scripts/Hosted/ninja-debug-cfg.sh b/cmake/scripts/Hosted/ninja-debug-cfg.sh index 1fc42d7..fb825df 100755 --- a/cmake/scripts/Hosted/ninja-debug-cfg.sh +++ b/cmake/scripts/Hosted/ninja-debug-cfg.sh @@ -18,7 +18,7 @@ fi build_generator="" os_fsfw="host" builddir="build-Debug" -build_generator="Ninja" +build_generator="ninja" if [ "${OS}" = "Windows_NT" ]; then python="py" # Could be other OS but this works for now. diff --git a/cmake/scripts/Linux/make-debug-cfg.sh b/cmake/scripts/Linux/make-debug-cfg.sh index 9fd03ec..0e66388 100755 --- a/cmake/scripts/Linux/make-debug-cfg.sh +++ b/cmake/scripts/Linux/make-debug-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Unix Makefiles" +build_generator="make" os_fsfw="linux" builddir="build-Debug" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Linux/make-release-cfg.sh b/cmake/scripts/Linux/make-release-cfg.sh index 95491e3..89a6712 100755 --- a/cmake/scripts/Linux/make-release-cfg.sh +++ b/cmake/scripts/Linux/make-release-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Unix Makefiles" +build_generator="make" os_fsfw="linux" builddir="build-Release" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Linux/ninja-debug-cfg.sh b/cmake/scripts/Linux/ninja-debug-cfg.sh index fe08aa1..fc28dd2 100755 --- a/cmake/scripts/Linux/ninja-debug-cfg.sh +++ b/cmake/scripts/Linux/ninja-debug-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Ninja" +build_generator="ninja" os_fsfw="linux" builddir="build-Debug" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/cmake-build-cfg.py b/cmake/scripts/cmake-build-cfg.py index 2085750..23b1c70 100755 --- a/cmake/scripts/cmake-build-cfg.py +++ b/cmake/scripts/cmake-build-cfg.py @@ -31,7 +31,9 @@ def main(): default="debug" ) 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( "-t", "--target-bsp", type=str, help="Target BSP, combination of architecture and machine" ) @@ -53,7 +55,15 @@ def main(): generator = determine_build_generator() generator_cmake_arg = f"-G \"{generator}\"" 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: print("No FSFW OSAL specified.") @@ -63,10 +73,7 @@ def main(): cmake_build_type = determine_build_type(args.buildtype) - if args.target_bsp is not None: - cmake_target_cfg_cmd = f"-DTGT_BSP=\"{args.target_bsp}\"" - else: - cmake_target_cfg_cmd = determine_tgt_bsp(cmake_fsfw_osal) + cmake_target_cfg_cmd = '' define_string = "" if args.defines is not None: