Compare commits
4 Commits
v2
...
ab1baec49e
| Author | SHA1 | Date | |
|---|---|---|---|
|
ab1baec49e
|
|||
|
12237c6e4f
|
|||
|
c9474e1214
|
|||
|
aa838c5824
|
108
CMakeLists.txt
108
CMakeLists.txt
@@ -1,44 +1,86 @@
|
|||||||
|
# Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
|
||||||
|
|
||||||
project(Example)
|
project(nova VERSION 0.0.1)
|
||||||
enable_language(CXX)
|
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_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
add_compile_options(
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
-Wall
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug, Release, RelWithDebInfo, MinSizeRel)" FORCE)
|
||||||
-Wextra
|
endif()
|
||||||
-Wpedantic
|
|
||||||
-Wold-style-cast
|
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(
|
||||||
|
NOVA_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||||
|
NOVA_VERSION_MINOR=${PROJECT_VERSION_MINOR}
|
||||||
|
NOVA_VERSION_PATCH=${PROJECT_VERSION_PATCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
${PROJECT_NAME}
|
add_compile_options(
|
||||||
src/main.cpp
|
/W4
|
||||||
)
|
/permissive-
|
||||||
|
/EHsc
|
||||||
# find_package(Example REQUIRED)
|
$<$<BOOL:${NOVA_WERROR}>:/WX>
|
||||||
|
|
||||||
include_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
||||||
# ${Example_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(
|
|
||||||
${PROJECT_NAME}
|
|
||||||
# ${Example_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (CMAKE_IMPORT_LIBRARY_SUFFIX)
|
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}> $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
|
||||||
COMMAND_EXPAND_LISTS
|
|
||||||
)
|
)
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_custom_target(run
|
if (NOVA_SANITIZERS)
|
||||||
COMMAND ${PROJECT_NAME}
|
add_compile_options(/fsanitize=${NOVA_SANITIZERS})
|
||||||
DEPENDS ${PROJECT_NAME}
|
endif()
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
add_compile_definitions(NOVA_COMPILER_MSVC)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
|
add_compile_options(
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
-Wshadow
|
||||||
|
-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")
|
||||||
|
add_compile_definitions(NOVA_COMPILER_GCC)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
add_compile_definitions(NOVA_COMPILER_CLANG)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
add_compile_definitions(
|
||||||
|
NOVA_COMPILER_CLANG
|
||||||
|
NOVA_COMPILER_APPLE_CLANG
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported compiler")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
add_compile_definitions(
|
||||||
|
NOVA_PLATFORM_WINDOWS
|
||||||
|
NOMINMAX
|
||||||
|
WIN32_LEAN_AND_MEAN
|
||||||
|
_CRT_SECURE_NO_WARNINGS
|
||||||
|
_CRT_NONSTDC_NO_WARNINGS
|
||||||
|
)
|
||||||
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
add_compile_definitions(NOVA_PLATFORM_MACOS)
|
||||||
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
add_compile_definitions(NOVA_PLATFORM_LINUX)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported platform")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(engine)
|
||||||
|
add_subdirectory(editor)
|
||||||
|
|||||||
29
LICENSE.txt
Normal file
29
LICENSE.txt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2025, Jayden Grubb
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
0
docs/.gitkeep
Normal file
0
docs/.gitkeep
Normal file
19
editor/CMakeLists.txt
Normal file
19
editor/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
set(NOVA_EDITOR_SRC
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
list(TRANSFORM NOVA_EDITOR_SRC PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
|
add_executable(nova-editor ${NOVA_EDITOR_SRC})
|
||||||
|
|
||||||
|
target_include_directories(nova-editor
|
||||||
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(nova-editor
|
||||||
|
PUBLIC nova
|
||||||
|
)
|
||||||
0
editor/include/nova/editor/.gitkeep
Normal file
0
editor/include/nova/editor/.gitkeep
Normal file
18
editor/src/main.cpp
Normal file
18
editor/src/main.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <print>
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
std::println("Hello, World!");
|
||||||
|
|
||||||
|
for (int i = 0; i < argc; i++) {
|
||||||
|
std::println("argv[{}]: {}", i, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
19
engine/CMakeLists.txt
Normal file
19
engine/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
set(NOVA_ENGINE_SRC
|
||||||
|
core/debug.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
list(TRANSFORM NOVA_ENGINE_SRC PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
|
add_library(nova SHARED ${NOVA_ENGINE_SRC})
|
||||||
|
|
||||||
|
target_include_directories(nova
|
||||||
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(nova
|
||||||
|
PRIVATE NOVA_EXPORT_SYMBOLS
|
||||||
|
)
|
||||||
0
engine/include/nova/audio/.gitkeep
Normal file
0
engine/include/nova/audio/.gitkeep
Normal file
29
engine/include/nova/core/api.hpp
Normal file
29
engine/include/nova/core/api.hpp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#if !defined(NOVA_API)
|
||||||
|
#if defined(NOVA_PLATFORM_WINDOWS)
|
||||||
|
#if defined(NOVA_EXPORT_SYMBOLS)
|
||||||
|
#define NOVA_API __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define NOVA_API __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#elif defined(NOVA_PLATFORM_LINUX) || defined(NOVA_PLATFORM_MACOS)
|
||||||
|
#if defined(NOVA_EXPORT_SYMBOLS)
|
||||||
|
#define NOVA_API __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
|
#define NOVA_API
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define NOVA_API
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// clang-format on
|
||||||
7
engine/include/nova/core/debug.hpp
Normal file
7
engine/include/nova/core/debug.hpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
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;
|
||||||
0
engine/include/nova/ecs/.gitkeep
Normal file
0
engine/include/nova/ecs/.gitkeep
Normal file
0
engine/include/nova/graphics/.gitkeep
Normal file
0
engine/include/nova/graphics/.gitkeep
Normal file
0
engine/include/nova/math/.gitkeep
Normal file
0
engine/include/nova/math/.gitkeep
Normal file
0
engine/include/nova/networking/.gitkeep
Normal file
0
engine/include/nova/networking/.gitkeep
Normal file
0
engine/include/nova/physics/.gitkeep
Normal file
0
engine/include/nova/physics/.gitkeep
Normal file
0
engine/include/nova/platform/.gitkeep
Normal file
0
engine/include/nova/platform/.gitkeep
Normal file
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
|
||||||
7
engine/src/core/debug.cpp
Normal file
7
engine/src/core/debug.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nova/core/debug.hpp>
|
||||||
12
src/main.cpp
12
src/main.cpp
@@ -1,12 +0,0 @@
|
|||||||
#include <cstdlib>
|
|
||||||
#include <print>
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
std::println("Hello, World!");
|
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) {
|
|
||||||
std::println("argv[{}] = {}", i, argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
0
templates/.gitkeep
Normal file
0
templates/.gitkeep
Normal file
0
tests/.gitkeep
Normal file
0
tests/.gitkeep
Normal file
Reference in New Issue
Block a user