Firstly, clone the Cortex.cpp repository here and initialize the submodules:
git clone https://github.com/janhq/cortex.cpp
cd cortex.cpp
git submodule update --init --recursive
You also need to install CMake. On Linux and MacOS, you can install CMake via your package manager
sudo apt install cmake # Ubuntu
brew install cmake # MacOS
On Windows, you can download CMake from https://cmake.org/download/.
- Navigate to the
engine
folder. - Configure the vpkg:
cd vcpkg
./bootstrap-vcpkg.bat
./vcpkg install
- Build the Cortex.cpp inside the
engine/build
folder (you can change-DCMAKE_TOOLCHAIN_FILE
to use your ownvcpkg
):
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build . --config Release
- Verify that Cortex.cpp is installed correctly by getting help information.
cortex -h
- Navigate to the
engine
folder. - Configure the vpkg:
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg install
- Build the Cortex.cpp inside the
engine/build
folder (you can change-DCMAKE_TOOLCHAIN_FILE
to use your ownvcpkg
):
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
make -j4
- Verify that Cortex.cpp is installed correctly by getting help information.
./cortex -h
-
Open Cortex.cpp repository in Codespaces or local devcontainer
devcontainer up --workspace-folder .
-
Configure vpkg in
engine/vcpkg
:
cd engine/vcpkg
export VCPKG_FORCE_SYSTEM_BINARIES="$([[ $(uname -m) == 'arm64' ]] && echo '1' || echo '0')"
./bootstrap-vcpkg.sh
- Build the Cortex.cpp inside the
engine/build
folder:
cd engine
mkdir -p build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$(realpath ..)/vcpkg/scripts/buildsystems/vcpkg.cmake
make -j$(grep -c ^processor /proc/cpuinfo)
- Verify that Cortex.cpp is installed correctly by getting help information.
cd engine/build
./cortex -h
- Everytime a rebuild is needed, just run the commands above using oneliner
npx -y runme run --filename README.md -t devcontainer -y