Skip to content

Commit

Permalink
project structre setup
Browse files Browse the repository at this point in the history
  • Loading branch information
JungerBoyo authored and JungerBoyo committed Jun 26, 2023
1 parent c1c1d90 commit e38e0a0
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: ci

on:
release:
types: [published]
push:
tags:
branches:
- main

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-2022
- ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Windows setup
if: runner.os == 'Windows'
run: winget install cmake
run: winget install llvm
run: winget install pip
run: winget install ninja

- name: Linux setup
if: runner.os == 'Ubuntu'
run: sudo apt-get install cmake
run: sudo apt-get install llvm
run: sudo apt-get install pip
run: sudo apt-get install ninja

- name: Install conan package manager
run: pip install conan

- name: Install conan packages
run: conan install . --output-folder=build-rel

- name: CMake config
run: cmake -S . -B build-rel -G Ninja -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release

- name: CMake build
run: cmake --build build-rel

- name: CPack project
if: startsWith(github.ref, 'refs/tags')
working-directory: build-rel
run: cpack -G ZIP --config CPackConfig.cmake

- name: Publish release
if: startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
files: build-rel/*.zip


4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.code-workspace
CMakeUserPresets.json
build-rel/
.vscode/
38 changes: 38 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.20)

### before-project config ###

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)

#############################


### project setup ###

project(VE001
VERSION 0.0.1
HOMEPAGE_URL "https://github.com/JungerBoyo/VE-001"
)

######################


### sub dirs ###

add_subdirectory(shaders)
add_subdirectory(src)

################

### add conan install as dependency ###


### package project ###
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "./")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/shaders/bin DESTINATION "shaders/")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/shaders/src DESTINATION "shaders/")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/assets/textures DESTINATION "assets/")

include(CPack)
########################
Empty file added assets/CMakeLists.txt
Empty file.
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conan install . --output-folder=build-rel && \
cmake -S . -B build-rel -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release && \
cmake --build build-rel
6 changes: 6 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[requires]
fmt/8.1.1

[generators]
CMakeDeps
CMakeToolchain
Empty file added shaders/CMakeLists.txt
Empty file.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
find_package(fmt REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} fmt::fmt)
5 changes: 5 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <fmt/core.h>

int main() {
fmt::print("Hello {}!", "Woorld");
}

0 comments on commit e38e0a0

Please sign in to comment.