Skip to content

Guide to contributing, Building code using CMake

Johnryzon edited this page Sep 12, 2026 · 4 revisions

Introduction

image

As you may know, building code is important to test for bugs or to ship the code to the public. But for people who may not use tools like CMake, here's the way to build code. And the example will be based from Ciyac.

Installing

Firstly, to build code, you must install CMake; if you haven't, depending on the OS, you can follow these instructions:

On Windows:

winget install Kitware.CMake

On macOS:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"  # To if have no brew installed
brew install cmake

On Linux:

# Example: Ubuntu
sudo apt install cmake # It's that easy, no need for long commands

Building code

Now, if it's installed, we'll build the code, but first, write the CMakeLists.txt, but Ciyac already has the CMake list, so you don't have to worry.

Now, after you write the CMakeLists.txt, you just need to type:

cmake -S . -B build # you can type: "cmake -B build"
cmake --build build

But if you wanna debug things like using gdb, you may run:

cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
gdb build/ciya # may replace it with correct path

And lastly, it'll be different between OS, but for Linux, run:

./build/ciya 

And for Windows, it's

./build/Debug/ciya

But it could be different, so just randomly search for the binary.

Q&A

I hope the guide helps, but if you have any problems or questions, I'll reply in a few hours to a few days. But, hope you have a good day =).

The original creator, Johnryzon Z. Abejero

Contributor:

  • Nguyễn Phước Thành Lâm

Clone this wiki locally