Skip to content

wenjinghuan999/wengine

Repository files navigation

WEngine

A toy game engine based on Vulkan.

Build

Dependencies

Setting up CMake

This project uses CMake (3.21 or above). Most open source libraries are configured automatically using FetchContent, except for Vulkan. You need to make CMake FindVulkan work by either setting up proper environment variable, or using -DCMAKE_PREFIX_PATH=/path/to/VulkanSDK/1.3.204.1. Then you are ready to go.

Here are some examples.

VSCode (Windows/Linux/MacOS)

Using VSCode and CMake plugin should make things easier. Create settings.json in .vscode folder and add following content into the settings.

{
    "cmake.configureArgs": [
        "-DCMAKE_PREFIX_PATH=/path/to/VulkanSDK/1.3.204.1"
    ]
}

Remember to replace your VulkanSDK location. Then use command palette to configure your CMake. Type and select CMake: Configure in command palette and follow the instruction. Build the project, and you should except executables and libs in binaries/bin and binaries/lib folder.

If you are using Visual Studio 2019, you should update to latest version. Otherwise there may be compile issue with fmt library.

CLion (Windows/Linux/macOS)

  • Open CMakeLists.txt as project, and then go to Settings - CMake.
  • Choose your toolchain (probably Visual Studio on Windows).
  • Add -DCMAKE_PREFIX_PATH=/path/to/VulkanSDK/1.3.204.1 to CMake Options.
  • Change Build Directory to build (as configured in .gitignore).

Visual Studio (Windows)

  • File - Open - CMake..., and choose CMakeLists.txt.
  • Right click on CMakeLists.txt in Solution Explorer, go to CMake Settings (for wengine).
  • Choose Toolset (maybe msvc_x64_x64).
  • Probably add your vcpkg.cmake to CMake toolchain file.
  • Change Build root to something like ${projectDir}\build\${name}.
  • Add -DCMAKE_PREFIX_PATH=/path/to/VulkanSDK/1.3.204.1 to CMake command arguments.

CMake Command Line (Ubuntu/Other Linux)

Install Vulkan SDK (via Ubuntu package manager):

wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-focal.list https://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list
sudo apt update && sudo apt install vulkan-sdk

(I'm using Ubuntu 20.04. Change lunarg-vulkan-focal.list according to your ubuntu version, like lunarg-vulkan-bionic.list for Ubuntu 18.04).

Or download and install Vulkan package manually.

mkdir vulkansdk && cd vulkansdk
curl https://sdk.lunarg.com/sdk/download/1.3.204.1/linux/vulkansdk-linux-x86_64-1.3.204.1.tar.gz --output vulkansdk-linux-x86_64-1.3.204.1.tar.gz
tar -xzf vulkansdk-linux-x86_64-1.3.204.1.tar.gz

We use a quite new version of CMake (3.21), so you probably need to install it.

Installing CMake by source:

sudo apt install build-essential libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4.tar.gz
tar -xzf cmake-3.21.4.tar.gz
cd cmake-3.21.4/
./bootstrap
make -j8
sudo make install

If you met CMake Error: Could not find CMAKE_ROOT !!!, maybe just run hash -r. Or setup CMAKE_ROOT manually.

Or installing CMake using script:

curl https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-linux-x86_64.sh --output cmake-3.21.4-linux-x86_64.sh
bash cmake-3.21.4-linux-x86_64.sh

But you need to set up proper environment variables.

Now check your CMake version with cmake --version.

Installing other dependencies: (follow GLFW compile guide)

sudo apt install xorg-dev

Clone repo (remember to change working directory):

git clone https://github.com/wenjinghuan999/wengine.git
mkdir -p wengine/build
cd wengine/build/

Run CMake and build:

cmake ..
make -j8

Binaries should be showing up in binaries folder.

Xcode (macOS)

Run following commands in project folder:

mkdir build
cd build
cmake -G Xcode ..

Xcode project wengine.xcodeproj should have been generated in build folder.

About

A toy game engine based on Vulkan.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages