commit 0cd4546c37e0d9aaa55c031d19adc1d442318818 Author: Anish Bhobe Date: Tue Jun 11 16:23:47 2024 +0200 Initial Setup. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8803005 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/ +.cache/ +build/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a0a57f3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b98fbc4 --- /dev/null +++ b/CMakeLists.txt @@ -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" ) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..c0ce12b --- /dev/null +++ b/CMakePresets.json @@ -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" + } + } + ] +} diff --git a/aster_core/CMakeLists.txt b/aster_core/CMakeLists.txt new file mode 100644 index 0000000..c0dddb0 --- /dev/null +++ b/aster_core/CMakeLists.txt @@ -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 ) diff --git a/aster_core/aster.cpp b/aster_core/aster.cpp new file mode 100644 index 0000000..780f4ec --- /dev/null +++ b/aster_core/aster.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main(int, char**) { + + printf("Hello World\n"); + + return 0; +} + diff --git a/aster_core/config.h b/aster_core/config.h new file mode 100644 index 0000000..bb5f85b --- /dev/null +++ b/aster_core/config.h @@ -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 diff --git a/aster_core/constants.h b/aster_core/constants.h new file mode 100644 index 0000000..0ae6649 --- /dev/null +++ b/aster_core/constants.h @@ -0,0 +1,123 @@ +// ============================================= +// Aster: constants.h +// Copyright (c) 2020-2024 Anish Bhobe +// ============================================= + +#pragma once + +#include +#include +#include +#include + +#include + +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 +using Option = std::optional; + +template +constexpr auto cast(from_t&& _in) { + return static_cast(forward(_in)); +} + +template +constexpr auto recast(from_t&& _in) { + return reinterpret_cast(forward(_in)); +} + +constexpr f32 operator ""_deg(f128 degrees) { + return glm::radians(cast(degrees)); +} + +constexpr f32 operator ""_deg(u64 degrees) { + return glm::radians(cast(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 +constexpr T max_value = std::numeric_limits::max(); + +template +constexpr T min_value = std::numeric_limits::min(); + +template +constexpr T lowest_value = std::numeric_limits::lowest(); + +template +constexpr T err_epsilon = std::numeric_limits::epsilon(); + +template +constexpr T positive_inf = std::numeric_limits::infinity(); + +template +constexpr T negative_inf = -std::numeric_limits::infinity(); + +template +constexpr T qnan = std::numeric_limits::quiet_NaN(); + +template +constexpr T snan = std::numeric_limits::signalling_NaN(); diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c36d069 --- /dev/null +++ b/build.sh @@ -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 + diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..8ede462 --- /dev/null +++ b/run.sh @@ -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 diff --git a/vcpkg b/vcpkg new file mode 160000 index 0000000..b276513 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit b27651341123a59f7187b42ef2bc476284afb310 diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..15af179 --- /dev/null +++ b/vcpkg-configuration.json @@ -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" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..325ad9a --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,6 @@ +{ + "dependencies": [ + "glm", + "glfw3" + ] +}