Compare commits
3 Commits
aa838c5824
...
ab1baec49e
| Author | SHA1 | Date | |
|---|---|---|---|
|
ab1baec49e
|
|||
|
12237c6e4f
|
|||
|
c9474e1214
|
@@ -9,6 +9,14 @@ enable_language(CXX)
|
|||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug, Release, RelWithDebInfo, MinSizeRel)" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(NOVA_SANITIZERS "" CACHE STRING "Sanitizers to enable (address, undefined, leak)")
|
||||||
|
set(NOVA_WERROR OFF CACHE BOOL "Treat compiler warnings as errors")
|
||||||
|
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
NOVA_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
|
NOVA_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||||
@@ -21,32 +29,44 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
/W4
|
/W4
|
||||||
/permissive-
|
/permissive-
|
||||||
/EHsc
|
/EHsc
|
||||||
|
$<$<BOOL:${NOVA_WERROR}>:/WX>
|
||||||
)
|
)
|
||||||
add_compile_definitions(
|
|
||||||
NOVA_COMPILER_MSVC
|
if (NOVA_SANITIZERS)
|
||||||
)
|
add_compile_options(/fsanitize=${NOVA_SANITIZERS})
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
endif()
|
||||||
|
|
||||||
|
add_compile_definitions(NOVA_COMPILER_MSVC)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
-Wpedantic
|
-Wpedantic
|
||||||
-Wshadow
|
-Wshadow
|
||||||
-Wold-style-cast
|
-Wold-style-cast
|
||||||
|
$<$<BOOL:${NOVA_WERROR}>:-Werror>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (NOVA_SANITIZERS)
|
||||||
|
add_compile_options(-fsanitize=${NOVA_SANITIZERS})
|
||||||
|
add_link_options(-fsanitize=${NOVA_SANITIZERS})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_definitions(
|
add_compile_definitions(NOVA_COMPILER_GCC)
|
||||||
NOVA_COMPILER_GCC
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
)
|
add_compile_definitions(NOVA_COMPILER_CLANG)
|
||||||
else()
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
NOVA_COMPILER_CLANG
|
NOVA_COMPILER_CLANG
|
||||||
|
NOVA_COMPILER_APPLE_CLANG
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
error("Unsupported compiler")
|
message(FATAL_ERROR "Unsupported compiler")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
NOVA_PLATFORM_WINDOWS
|
NOVA_PLATFORM_WINDOWS
|
||||||
NOMINMAX
|
NOMINMAX
|
||||||
@@ -54,16 +74,12 @@ if (WIN32)
|
|||||||
_CRT_SECURE_NO_WARNINGS
|
_CRT_SECURE_NO_WARNINGS
|
||||||
_CRT_NONSTDC_NO_WARNINGS
|
_CRT_NONSTDC_NO_WARNINGS
|
||||||
)
|
)
|
||||||
elseif (APPLE)
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
add_compile_definitions(
|
add_compile_definitions(NOVA_PLATFORM_MACOS)
|
||||||
NOVA_PLATFORM_MACOS
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
)
|
add_compile_definitions(NOVA_PLATFORM_LINUX)
|
||||||
elseif (UNIX)
|
|
||||||
add_compile_definitions(
|
|
||||||
NOVA_PLATFORM_LINUX
|
|
||||||
)
|
|
||||||
else()
|
else()
|
||||||
error("Unsupported platform")
|
message(FATAL_ERROR "Unsupported platform")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(engine)
|
add_subdirectory(engine)
|
||||||
|
|||||||
35
engine/include/nova/core/types.hpp
Normal file
35
engine/include/nova/core/types.hpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace Nova::Types {
|
||||||
|
|
||||||
|
using u8 = uint8_t;
|
||||||
|
using u16 = uint16_t;
|
||||||
|
using u32 = uint32_t;
|
||||||
|
using u64 = uint64_t;
|
||||||
|
using usize = size_t;
|
||||||
|
using uptr = uintptr_t;
|
||||||
|
using umax = uintmax_t;
|
||||||
|
|
||||||
|
using i8 = int8_t;
|
||||||
|
using i16 = int16_t;
|
||||||
|
using i32 = int32_t;
|
||||||
|
using i64 = int64_t;
|
||||||
|
using isize = ptrdiff_t;
|
||||||
|
using iptr = intptr_t;
|
||||||
|
using imax = intmax_t;
|
||||||
|
|
||||||
|
using f32 = float;
|
||||||
|
using f64 = double;
|
||||||
|
|
||||||
|
} // namespace Nova::Types
|
||||||
|
|
||||||
|
using namespace Nova::Types;
|
||||||
19
engine/include/nova/utils/overloaded.hpp
Normal file
19
engine/include/nova/utils/overloaded.hpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Nova::Utils {
|
||||||
|
|
||||||
|
template<typename... Ts>
|
||||||
|
struct Overloaded : Ts... {
|
||||||
|
using Ts::operator()...;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename... Ts>
|
||||||
|
Overloaded(Ts...) -> Overloaded<Ts...>;
|
||||||
|
|
||||||
|
} // namespace Nova::Utils
|
||||||
Reference in New Issue
Block a user