Initial Setup.

This commit is contained in:
Anish Bhobe 2024-06-11 16:23:47 +02:00
commit 0cd4546c37
13 changed files with 263 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.idea/
.cache/
build/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git

13
CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
# CMakeLists.txt ; Top-level CMake project file.
cmake_minimum_required( VERSION 3.13 )
project( Aster VERSION 0.1.0 )
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
add_subdirectory( "aster_core" )

17
CMakePresets.json Normal file
View File

@ -0,0 +1,17 @@
{
"version": 2,
"configurePresets": [
{
"name": "default",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_MAKE_PROGRAM": "ninja",
"CMAKE_C_COMPILER": "/usr/bin/clang",
"CMAKE_CXX_COMPILER": "/usr/bin/clang++",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
}
]
}

13
aster_core/CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
# CMakeList.txt ; CMake project for Blaze
cmake_minimum_required( VERSION 3.13 )
find_package( glm CONFIG REQUIRED )
set( HEADER_FILES "constants.h" "config.h" )
# set( SOURCE_FILES )
add_library( aster_core "aster.cpp" ${SOURCE_FILES} ${HEADER_FILES} )
set_property( TARGET aster_core PROPERTY CXX_STANDARD 20 )
target_link_libraries( aster_core PRIVATE glm::glm-header-only )

10
aster_core/aster.cpp Normal file
View File

@ -0,0 +1,10 @@
#include <iostream>
#include <glm/glm.hpp>
int main(int, char**) {
printf("Hello World\n");
return 0;
}

20
aster_core/config.h Normal file
View File

@ -0,0 +1,20 @@
// =============================================
// Aster: config.h
// Copyright (c) 2020-2024 Anish Bhobe
// =============================================
#pragma once
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#define GLFW_INCLUDE_VULKAN
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
#define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
#define VULKAN_HPP_NO_EXCEPTIONS
#if defined(NDEBUG)
#define USE_OPTICK (0)
#else
#define USE_OPTICK (1)
#endif

123
aster_core/constants.h Normal file
View File

@ -0,0 +1,123 @@
// =============================================
// Aster: constants.h
// Copyright (c) 2020-2024 Anish Bhobe
// =============================================
#pragma once
#include <cstdint>
#include <cstdio>
#include <optional>
#include <tuple>
#include <glm/glm.hpp>
using c8 = char;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using f128 = long double;
using b8 = bool;
using b32 = u32;
using usize = size_t;
using p64 = intptr_t;
constexpr usize strlen_c(const char* s) {
return *s == '\0' ? 0 : 1 + strlen_c(s + 1);
}
constexpr auto ANSI_Black = "\u001b[30m";
constexpr auto ANSI_Red = "\u001b[31m";
constexpr auto ANSI_Green = "\u001b[32m";
constexpr auto ANSI_Yellow = "\u001b[33m";
constexpr auto ANSI_Blue = "\u001b[34m";
constexpr auto ANSI_Magenta = "\u001b[35m";
constexpr auto ANSI_Cyan = "\u001b[36m";
constexpr auto ANSI_White = "\u001b[37m";
constexpr auto ANSI_Reset = "\u001b[0m";
using std::move;
using std::forward;
using std::tie;
template <typename T>
using Option = std::optional<T>;
template <typename type_t, typename from_t>
constexpr auto cast(from_t&& _in) {
return static_cast<type_t>(forward<from_t>(_in));
}
template <typename type_t, typename from_t>
constexpr auto recast(from_t&& _in) {
return reinterpret_cast<type_t>(forward<from_t>(_in));
}
constexpr f32 operator ""_deg(f128 degrees) {
return glm::radians<f32>(cast<f32>(degrees));
}
constexpr f32 operator ""_deg(u64 degrees) {
return glm::radians<f32>(cast<f32>(degrees));
}
using glm::ivec2;
using glm::ivec3;
using glm::ivec4;
using glm::vec2;
using glm::vec3;
using glm::vec4;
using glm::mat2;
using glm::mat3;
using glm::mat4;
constexpr const char* PROJECT_NAME = "Aster";
struct Version {
u32 major;
u32 minor;
u32 patch;
};
constexpr Version VERSION = {
.major = 0,
.minor = 0,
.patch = 1,
};
enum class Error {
eUnknown = 1000,
eNoDevices = 1001,
};
template <typename T>
constexpr T max_value = std::numeric_limits<T>::max();
template <typename T>
constexpr T min_value = std::numeric_limits<T>::min();
template <typename T>
constexpr T lowest_value = std::numeric_limits<T>::lowest();
template <typename T>
constexpr T err_epsilon = std::numeric_limits<T>::epsilon();
template <typename T>
constexpr T positive_inf = std::numeric_limits<T>::infinity();
template <typename T>
constexpr T negative_inf = -std::numeric_limits<T>::infinity();
template <typename T>
constexpr T qnan = std::numeric_limits<T>::quiet_NaN();
template <typename T>
constexpr T snan = std::numeric_limits<T>::signalling_NaN();

26
build.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/bash
echo "Running CMake"
cmake --preset=default
echo "Running Ninja"
if echo "$@" | grep -e "clean" -q
then
cmake --build build --target clean
elif echo "$@" | grep -e "rebuild" -q
then
cmake --build build --clean-first
else
cmake --build build
fi
if echo "$@" | grep -e "docs" -q
then
if echo "$@" | grep -e "-v" -q
then
doxygen
else
doxygen > /dev/null || echo "Doxygen Failed"
fi
fi

14
run.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
if [ -d "out" ]; then
pushd ./out/ > /dev/null || exit
if echo "$@" | grep -e "debug" -q
then
lldb aster-exe
else
./aster-exe
fi
popd > /dev/null || exit
else
echo "Build blaze first."
fi

1
vcpkg Submodule

@ -0,0 +1 @@
Subproject commit b27651341123a59f7187b42ef2bc476284afb310

14
vcpkg-configuration.json Normal file
View File

@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "b27651341123a59f7187b42ef2bc476284afb310",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}

6
vcpkg.json Normal file
View File

@ -0,0 +1,6 @@
{
"dependencies": [
"glm",
"glfw3"
]
}