Skip to content

farzonl/warfLang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WarfLang

Inspiration for the name

A legally distinct but phonetically similar name to a sci-fi space warrior.

Open in Gitpod

Open in Gitpod

Build Instructions

cmake -B build
make

Build with Ninja

cmake -G Ninja -B build
ninja -C./build

Building on Windows

  • Using Ninja
cmake -GNinja -Bbuild
ninja -C./build
  • Using MSBUILD
cmake -B build
msbuild build\WarfLang.sln -t:Build -p:Configuration=Release

Setup Clang Tidy

On MacOS

ln -s "$(brew --prefix llvm)/share/clang/run-clang-tidy.py" "/usr/local/bin/run-clang-tidy.py"
ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements"
ln -s "$(brew --prefix llvm)/share/clang/run-clang-tidy.py" "/usr/local/bin/run-clang-tidy.py"

Building the fuzzer

On MacOS

cmake -G Ninja -B build -DCMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang \
      -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++

Building with Coverage

on MacOS

cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping" \
      -DCMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang \
      -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++
ninja -C./build
LLVM_PROFILE_FILE="Warflang.profraw" ./build/test/WarfLang_TEST
$(brew --prefix llvm)/bin/llvm-profdata merge -sparse WarfLang.profraw -o WarfLang.profdata
$(brew --prefix llvm)/bin/llvm-cov show -output-dir=out/report -format=html -instr-profile=Warf.profdata -object=build/test/WarfLang_TEST build/src/cli/Warf src/

Run Clang Tidy

After running cmake, the build dir will have a compile_commands.json file. Thats all you need to run run-clang-tidy.py.

run-clang-tidy.py -p build/ -header-filter='.*' -fix -format

Docker Build & Run

  • Build: docker build -t warflang:latest .
  • Run: docker run --name test_vm -it warflang:latest
  • Print out container id: inspect test_vm -f '{{.Id}}'
  • Get valgrind log: docker cp <container id>:root/valgrind.log .

Docker Build & Run aarch64

  • Build: docker build -f Dockerfile.aarch64 -t warflang_arch64:latest .
  • Run: docker run --name arm_test_vm -it warflang_arch64:latest

Docker Build & Run mingw x86_64

  • Build: docker build -f Dockerfile.mingw-cross -t warflang_mingw:latest .
  • Run: docker run --name mingw_test_vm -it warflang_mingw:latest

Docker Build & Run llvm win cross x86_64

  • Build: docker build -f Dockerfile.llvm-win-cross -t warflang_llvm_win_cross:latest .
  • Run: docker run --name llvm_win_test_vm -it warflang_llvm_win_cross:latest

Docker Build & Run osxcross x86_64

  • Build: docker build -f Dockerfile.osx-cross -t warflang_osx:latest .
  • Run: docker run --name osx_test_vm -it warflang_osx:latest

Docker Build & Run freeBSD x86_64

  • Build: docker build -f Dockerfile.freebsd-cross -t warflang_freebsd:latest .
  • Run: docker run --name freebsd_test_vm -it warflang_freebsd:latest

Docker Build & Run emscripten web

  • Build: docker build -f Dockerfile.emscripten -t warflang_web:latest .
  • Run: docker run --name emsdk_test_vm -it warflang_web:latest