Build Argentum from sources on Windows

Directory structure:

   llvm-project-llvmorg-17.0.4  - download and extract LLVM sources here
      build-dbg                 - working directory for the build system
   llvm-17.0.4-dbg              - install dir for debug version of llvm
   SDL2-2.28.5                  - install dir for SDL
   SDL2_image-2.6.3             - install dir for SDL_image
   argentum                     - directory for argentum sources
       out                      - working directory for build system (VS-compatible name)

Install prerequisites

Build LLVM from sources

Unzip LLVM sources from
to d:\cpp\llvm-project-llvmorg-17.0.4

Make VS project/solution files

This takes several minutes

cd /d D:\cpp\llvm-project-llvmorg-17.0.4

cmake -S llvm -B build-dbg -G "Visual Studio 17 2022" ^

Build the LLVM project

This might take several hours.

cmake --build build-dbg


Check for errors and if everything is ok, install LLVM into d:\cpp\llvm-17.0.4-dbg directory:

cmake --build build-dbg --target install


  1. Unzip
    to d:\cpp\SDL2-2.28.5
  2. Unzip
    to d:\cpp\SDL2_image-2.6.3


  1. Download from the newest ""
  2. Unzip to d:\curl-src
  3. Build with
cd /d d:\curl-src
cmake -B build -G "Visual Studio 17 2022" -DCURL_USE_SCHANNEL=on -DCMAKE_INSTALL_PREFIX=D:\cpp\curl
cmake --build build --target install


Clone repo

cd /d d:\cpp
git clone
cd argentum

Make build files

cmake -S . -B out -G "Visual Studio 17 2022" ^
-DCMAKE_INSTALL_PREFIX="D:\cpp\argentum-dbg" ^
-DSDL2_DIR="D:/cpp/SDL2-2.28.5/cmake" ^
-DSDL2_image_DIR="D:/cpp/SDL2_image-2.6.3/cmake" ^

Build project

cmake --build out

Run the Argentum Compiler

cd /D D:\cpp\argentum\out\Debug
agc --help

Compile to LLVM bit-code:

agc -src d:\cpp\argentum\demo -start helloWorld -o x.ll -emit-llvm -S -g


  • -src d:\argentum-demo\src -- where ag sources are located
  • -start helloWorld -- module name to compile
  • -o x.ll -- to file x.ll
  • -emit-llvm -- produce llvm bit-code instead of native code
  • -S -- write in text bit-code form
  • -g -- generate debug info

Build and execute Hello World

agc -src d:\cpp\argentum\demo -start helloWorld -O3 -o x.obj
d:\cpp\llvm-17.0.4-dbg\bin\lld-link x.obj ag_runtime.lib

Build and execute SDL demo

:: Compile
agc -src d:\cpp\argentum\demo -start demo -o x.obj -O3

:: Link
lld-link x.obj ag_runtime.lib ^
d:\cpp\SDL2-2.28.5\lib\x64\SDL2.lib ^

:: Copy DLLs to cwd
copy d:\cpp\SDL2_image-2.6.3\lib\x64\SDL2_image.dll
copy d:\cpp\SDL2-2.28.5\lib\x64\SDL2.dll

:: Copy graphics
copy d:\cpp\argentum\demo\*.png
copy d:\cpp\argentum\demo\*.jpg

:: run

Leave a Reply

Your email address will not be published. Required fields are marked *