From 5ff1c5e0a505790b5c5024f423d1086f0b3268ab Mon Sep 17 00:00:00 2001 From: Miguel Lechon Date: Thu, 21 Jan 2021 18:08:03 +0100 Subject: [PATCH] Windows/Linux clang build scripts. --- build.sh | 50 +++++++++++++++++++++++++++++++++++++++++++ build_with_clang.bat | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100755 build.sh create mode 100755 build_with_clang.bat diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c2adb2c --- /dev/null +++ b/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +CC=clang + +# NOTE(mal): Silent pushd/popd +pushd () { + command pushd "$@" > /dev/null +} +popd () { + command popd "$@" > /dev/null +} + +echo ~~~ Metadesk Build ~~~ +# TODO(mal): Review these warnings +accepted_clang_warnings="-Wno-return-type -Wno-pointer-sign -Wno-writable-strings -Wno-unknown-warning-option" +compile_flags="-I../source/ $accepted_clang_warnings" + +mkdir -p build +pushd build +echo +echo ~~~ Build All Samples ~~~ +$CC $compile_flags ../samples/old_style_custom_layer.c -o old_style_custom_layer +$CC $compile_flags ../samples/static_site_generator/static_site_generator.c -o static_site_generator +$CC $compile_flags ../samples/output_parse/output_parse.c -o output_parse +echo +echo ~~~ Build All Tests ~~~ +$CC $compile_flags ../tests/sanity_tests.c -o sanity_tests +$CC $compile_flags ../tests/unicode_test.c -o unicode_test +clang++ $compile_flags ../tests/cpp_build_test.cpp +popd + +echo +echo ~~~ Running Sanity Tests ~~~ +pushd build +sanity_tests +popd + +echo +echo ~~~ Running Static Site Generator Sample ~~~ +mkdir -p samples/static_site_generator/example_site/generated +pushd samples/static_site_generator/example_site/generated +../../../../build/static_site_generator --siteinfo ../site_info.md --pagedir ../ +popd + +echo +echo ~~~ Running Output Parse Sample ~~~ +mkdir -p samples/output_parse/examples/output +pushd samples/output_parse/examples/output +../../../../build/output_parse ../example.md ../example2.md +popd diff --git a/build_with_clang.bat b/build_with_clang.bat new file mode 100755 index 0000000..e292eb9 --- /dev/null +++ b/build_with_clang.bat @@ -0,0 +1,51 @@ +@echo off + +echo ~~~ Metadesk Build ~~~ +set accepted_clang_warnings=-Wno-return-type -Wno-deprecated-declarations -Wno-pointer-sign -Wno-writable-strings -Wno-unknown-warning-option +set compile_flags=-I../source/ %accepted_clang_warnings% + +if not exist build mkdir build +pushd build +echo. +echo ~~~ Build All Samples ~~~ +clang %compile_flags% ..\samples\old_style_custom_layer.c -o old_style_custom_layer.exe +clang %compile_flags% ..\samples\static_site_generator\static_site_generator.c -o static_site_generator.exe +clang %compile_flags% ..\samples\output_parse\output_parse.c -o output_parse.exe +echo. +echo ~~~ Build All Tests ~~~ +clang %compile_flags% ..\tests\sanity_tests.c -o sanity_tests.exe +clang %compile_flags% ..\tests\unicode_test.c -o unicode_test.exe +clang++ %compile_flags% ..\tests\cpp_build_test.cpp -o cpp_build_test.exe +popd + +echo. +echo ~~~ Running Sanity Tests ~~~ +pushd build +sanity_tests.exe +popd + +echo. +echo ~~~ Running Static Site Generator Sample ~~~ +pushd samples +pushd static_site_generator +pushd example_site +if not exist generated mkdir generated +pushd generated +..\..\..\..\build\static_site_generator.exe --siteinfo ..\site_info.md --pagedir ..\ +popd +popd +popd +popd + +echo. +echo ~~~ Running Output Parse Sample ~~~ +pushd samples +pushd output_parse +pushd examples +if not exist output mkdir output +pushd output +..\..\..\..\build\output_parse.exe ..\example.md ..\example2.md +popd +popd +popd +popd