Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f484056
Remove vcpkg submodule
marceline-cramer Jul 15, 2021
d93b289
Remove vcpkg cmake infrastructure
marceline-cramer Jul 15, 2021
9eb3958
Add cglm submodule
marceline-cramer Jul 15, 2021
649ca70
Re-add cglm CMake subdir
marceline-cramer Jul 15, 2021
2f6431e
Fix world.c flecs/system include
marceline-cramer Jul 15, 2021
286b0c3
Replace mondradiko_find_dependency with find_package/pkg-config
marceline-cramer Jul 15, 2021
2e024c7
Temporarily disable Windows CI
marceline-cramer Jul 15, 2021
ff51700
Install Ubuntu dependencies
marceline-cramer Jul 15, 2021
7261882
Switch from ubuntu-20.04 to ubuntu-latest
marceline-cramer Jul 15, 2021
78f6f63
Add sudo apt update
marceline-cramer Jul 15, 2021
d14e8e9
Temporarily remove OpenXR
marceline-cramer Jul 15, 2021
a71c7c8
Support glslangValidator
marceline-cramer Jul 15, 2021
2fc9468
Support targetless SDL2
marceline-cramer Jul 15, 2021
b6bdd52
Specialize glslc/glslangValidator args
marceline-cramer Jul 15, 2021
1b85ae6
Re-enable OpenXR
marceline-cramer Jul 15, 2021
3555c93
Build and install OpenXR in workflow
marceline-cramer Jul 15, 2021
68484d4
Fix OpenXR SDK GitHub URL
marceline-cramer Jul 15, 2021
7256d6b
Fix OpenXR SDK admin installation
marceline-cramer Jul 15, 2021
1be994f
Use CMake install over ninja
marceline-cramer Jul 15, 2021
80c4377
Actually compile OpenXR...
marceline-cramer Jul 15, 2021
7937215
Remove bad popd
marceline-cramer Jul 15, 2021
19dcf9e
Install ninja via apt
marceline-cramer Jul 15, 2021
6c30627
Install libxrandr-dev and libwayland-dev
marceline-cramer Jul 15, 2021
ec3f62b
Add GLVND
marceline-cramer Jul 15, 2021
40a079a
Reorganize apt and ninja handling
marceline-cramer Jul 15, 2021
50114ee
Fix apt
marceline-cramer Jul 15, 2021
dd01876
Add redundant ninja installation
marceline-cramer Jul 15, 2021
d9ca4e1
Link OpenXR
marceline-cramer Jul 15, 2021
753c654
Re-enable Windows CI
marceline-cramer Jul 15, 2021
b7e9bab
Reorganize Windows CI steps
marceline-cramer Jul 15, 2021
d96d48c
Use bash for OpenXR install
marceline-cramer Jul 15, 2021
7ffe780
Temporarily disable sudo install OpenXR
marceline-cramer Jul 15, 2021
ef43811
Revert "Temporarily disable sudo install OpenXR"
marceline-cramer Jul 15, 2021
ac02234
Specialize Linux/Windows OpenXR install step
marceline-cramer Jul 15, 2021
54aaada
choco install vulkan-sdk
marceline-cramer Jul 15, 2021
0184157
Add volk library
marceline-cramer Jul 16, 2021
775957b
Remove unnecessary vulkan include from frame_data.h
marceline-cramer Jul 16, 2021
b7d6b06
Replace vulkan with volk
marceline-cramer Jul 16, 2021
37c8a97
Revert "choco install vulkan-sdk"
marceline-cramer Jul 16, 2021
ad32cc5
Add COMPILE_SHADERS option
marceline-cramer Jul 16, 2021
159e215
Disable CI shader compilation
marceline-cramer Jul 16, 2021
47459cc
Build and install SDL2 on Windows
marceline-cramer Jul 16, 2021
6676fbc
apt install libvulkan-dev
marceline-cramer Jul 16, 2021
3eb916c
Checkout SDL 2.0.10
marceline-cramer Jul 16, 2021
10d199b
Add basic Findlibuv.cmake
marceline-cramer Jul 16, 2021
21bbbd2
Build and install libuv on Windows CI
marceline-cramer Jul 16, 2021
7ce82e8
Disable libuv test building
marceline-cramer Jul 16, 2021
70ec1f0
Add libuv find_library Windows path suffix
marceline-cramer Jul 16, 2021
54ca70c
Replace pkg-config/Findlibuv libuv with submodule
marceline-cramer Jul 16, 2021
1a10f29
Remove libuv installation in CI
marceline-cramer Jul 16, 2021
fa5a7d7
Remove vulkan include from cli main
marceline-cramer Jul 16, 2021
f4a3385
Set CMP077 policy to NEW
marceline-cramer Jul 16, 2021
ee2e6b6
Build and install Vulkan headers on Windows
marceline-cramer Jul 25, 2021
adf69f2
Capitalize 'ninja'
marceline-cramer Jul 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 61 additions & 27 deletions .github/workflows/build_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-latest
- os: windows-latest
cc: cl.exe
cxx: cl.exe
Expand All @@ -29,47 +29,81 @@ jobs:
with:
submodules: 'true'

- name: install ninja-build tool
uses: mondradiko/gha-setup-ninja@v3
- uses: actions/checkout@v2
with:
repository: 'KhronosGroup/OpenXR-SDK'
path: 'OpenXR-SDK'

- name: setup VsDev environment
if: runner.os == 'Windows'
uses: mondradiko/gha-setup-vsdevenv@v3

- name: apt
if: runner.os == 'Linux'
run: sudo apt install libwayland-dev libxrandr-dev
- uses: mondradiko/gha-setup-ninja@v3
- name: Build OpenXR SDK
working-directory: 'OpenXR-SDK'
run: |
mkdir build
pushd build
cmake -GNinja ..
cmake --build .

- name: cached vcpkg runtime
- name: Install OpenXR SDK (Linux)
if: runner.os == 'Linux'
uses: actions/cache@v2
working-directory: 'OpenXR-SDK/build'
run: sudo cmake --install .

- name: Install OpenXR SDK (Windows)
if: runner.os == 'Windows'
working-directory: 'OpenXR-SDK/build'
run: cmake --install .

- name: Checkout SDL2 (Windows only)
uses: actions/checkout@v2
if: runner.os == 'Windows'
with:
key: ${{ runner.os }}-${{ hashFiles('.git/modules/vcpkg/HEAD') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('vcpkg/.git/HEAD') }}
path: vcpkg/vcpkg
repository: 'libsdl-org/SDL'
ref: 'release-2.0.10'
path: 'SDL2'

- name: setup environment vars
- name: Build and Install SDL2 (Windows only)
if: runner.os == 'Windows'
working-directory: 'SDL2'
run: |
CACHE_KEY=$(echo "${{ runner.os }}-${{ github.head_ref }}" | tr -cd '[a-zA-Z0-9]._-')
echo "CACHE_KEY=$CACHE_KEY" | tee -a $GITHUB_ENV
if [ "${{ runner.os }}" == "Linux" ]; then
echo "ci_vcpkg_cache_dir=/home/runner/.cache/vcpkg" >> $GITHUB_ENV
else
echo "ci_vcpkg_cache_dir=$LOCALAPPDATA/vcpkg" >> $GITHUB_ENV
fi
mkdir build
pushd build
cmake -GNinja ..
cmake --build .
cmake --install .

- name: dependency binary cache
uses: actions/cache@v2
- name: Checkout Vulkan-Headers (Windows only)
uses: actions/checkout@v2
if: runner.os == 'Windows'
with:
path: ${{ env.ci_vcpkg_cache_dir }}
key: ${{ env.CACHE_KEY }}-vcpkg-binarycache4
restore-keys: ${{ env.CACHE_KEY }}-vcpkg-binarycache3
repository: 'KhronosGroup/Vulkan-Headers'
path: 'Vulkan-Headers'

- name: Install Vulkan-Headers (Windows only)
if: runner.os == 'Windows'
working-directory: 'Vulkan-Headers'
run: |
mkdir build
pushd build
cmake -GNinja ..
cmake --build .
cmake --install .

- name: apt
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libvulkan-dev libsdl2-dev

- name: configure
- uses: mondradiko/gha-setup-ninja@v3
- name: Configure
run: |
mkdir build
cd build
cmake -GNinja -DTRACY_ENABLE=ON ..
pushd build
cmake -GNinja -DTRACY_ENABLE=ON -DCOMPILE_SHADERS=OFF ..

- name: compile
run: ninja -C build
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "lib/Tracy"]
path = lib/Tracy
url = https://github.com/wolfpld/Tracy
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/Microsoft/vcpkg
[submodule "lib/cglm"]
path = lib/cglm
url = https://github.com/recp/cglm
[submodule "lib/libuv"]
path = lib/libuv
url = https://github.com/libuv/libuv
76 changes: 26 additions & 50 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.13)
include(cmake/prelude.cmake)
project(mdo-core VERSION 0.0.0)

# options
option(COMPILE_SHADERS "Compile shaders in bulid tree.")
option(COMPILE_SHADERS "Enable shader compilation." ON)
option(TRACY_ENABLE "Enable Tracy profiling.")

if(MSVC)
Expand All @@ -14,52 +13,32 @@ if(MSVC)
include_directories(include)

# dependencies
#include(FindVulkan)
include(FindVulkan)
#if(NOT Vulkan_FOUND)
# message(FATAL_ERROR "Vulkan not found.")
# message(FATAL_ERROR "Vulkan not found.")
#endif()
#if(NOT Vulkan_GLSLC_EXECUTABLE)
# message(FATAL_ERROR "glslc not found.")
#endif()

add_subdirectory(lib)

find_mondradiko_dependency(
mondradiko::vulkan "Vulkan" NOCONFIG
INSTALL "vulkan-sdk"
Vulkan::Vulkan
)

find_mondradiko_dependency(
mondradiko::sdl2 "SDL2" SDL2::SDL2main
INSTALL "sdl2[vulkan]"
UNIX SDL2::SDL2-static
# UNIX SDL2::SDL2
WIN32 SDL2::SDL2
)
find_program(GLSL_COMPILER glslc NO_CACHE)
if(GLSL_COMPILER) # glslc args
set(GLSL_ARGS "-O")
else() # glslangValidator args
message(WARNING "glslc not found, using slower glslangValidator instead")
find_program(GLSL_COMPILER glslangValidator NO_CACHE)
set(GLSL_ARGS "-V")
endif()

find_mondradiko_dependency(
mondradiko::libuv "unofficial-libuv" unofficial::libuv::libuv
INSTALL "libuv"
)
if(COMPILE_SHADERS AND NOT GLSL_COMPILER)
message(FATAL_ERROR "Suitable shader compiler not found.")
endif()

find_mondradiko_dependency(
mondradiko::openxr "OpenXR"
INSTALL "openxr-loader"
OpenXR::headers
OpenXR::openxr_loader
OpenXR::openxr-all-supported
)
add_subdirectory(lib)

find_mondradiko_dependency(
mondradiko::flecs "flecs" flecs::flecs_static
INSTALL "flecs"
)
find_package(SDL2 REQUIRED)
if(TARGET SDL2::SDL2) # support targeted SDL2 distributions
set(SDL2_LIBRARIES SDL2::SDL2 SDL2::SDL2main)
endif()

find_mondradiko_dependency(
mondradiko::cglm "cglm" cglm::cglm
INSTALL "cglm"
)
find_package(OpenXR REQUIRED)

# shaders
function(spirv_shader ret GLSL VAR)
Expand All @@ -68,7 +47,7 @@ function(spirv_shader ret GLSL VAR)

add_custom_command(
OUTPUT ${SPIRV}
COMMAND Vulkan::glslc -O -o ${SPIRV} ${GLSL}
COMMAND ${GLSL_COMPILER} ${GLSL_ARGS} ${GLSL} -o ${SPIRV}
DEPENDS ${GLSL}
)

Expand All @@ -93,9 +72,6 @@ set(SHADERS_SRC
if(COMPILE_SHADERS)
spirv_shaders(SHADERS_BIN ${SHADERS_SRC})
add_library(mdo-shaders INTERFACE ${SHADERS_BIN})
else()
message(WARNING "Shader compilation is disabled.")
message(WARNING "Ask Marceline on Discord for a .zip of the current shaders.")
endif()

# main library
Expand All @@ -118,13 +94,13 @@ set(MDO_CORE_SRC
add_library(mdo-core SHARED ${MDO_CORE_SRC})

target_link_libraries(mdo-core
mondradiko::sdl2
mondradiko::vulkan
mondradiko::libuv
mondradiko::openxr
mondradiko::cglm
${SDL2_LIBRARIES}
OpenXR::openxr_loader
flecs
cglm
tracy
uv_a
volk
)

add_executable(mdo-cli cli/main.c)
Expand Down
1 change: 0 additions & 1 deletion cli/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <vulkan/vulkan_core.h>

#include "displays/display.h"
#include "displays/sdl/sdl_display.h"
Expand Down
Loading