From b9ead172bfc5b2e8f40b8acb097acd9487cddb28 Mon Sep 17 00:00:00 2001 From: Jayden Grubb Date: Tue, 4 Nov 2025 00:13:31 +1000 Subject: [PATCH] Add basic project heirarchy and config --- CMakeLists.txt | 92 ++++++++++++++++--------- LICENSE.txt | 29 ++++++++ {include => assets}/.gitkeep | 0 docs/.gitkeep | 0 editor/CMakeLists.txt | 19 +++++ editor/include/nova/editor/.gitkeep | 0 editor/src/main.cpp | 18 +++++ engine/CMakeLists.txt | 19 +++++ engine/include/nova/audio/.gitkeep | 0 engine/include/nova/core/api.hpp | 30 ++++++++ engine/include/nova/core/debug.hpp | 7 ++ engine/include/nova/ecs/.gitkeep | 0 engine/include/nova/graphics/.gitkeep | 0 engine/include/nova/math/.gitkeep | 0 engine/include/nova/networking/.gitkeep | 0 engine/include/nova/physics/.gitkeep | 0 engine/include/nova/platform/.gitkeep | 0 engine/include/nova/utils/.gitkeep | 0 engine/src/core/debug.cpp | 7 ++ src/main.cpp | 12 ---- templates/.gitkeep | 0 tests/.gitkeep | 0 22 files changed, 188 insertions(+), 45 deletions(-) create mode 100644 LICENSE.txt rename {include => assets}/.gitkeep (100%) create mode 100644 docs/.gitkeep create mode 100644 editor/CMakeLists.txt create mode 100644 editor/include/nova/editor/.gitkeep create mode 100644 editor/src/main.cpp create mode 100644 engine/CMakeLists.txt create mode 100644 engine/include/nova/audio/.gitkeep create mode 100644 engine/include/nova/core/api.hpp create mode 100644 engine/include/nova/core/debug.hpp create mode 100644 engine/include/nova/ecs/.gitkeep create mode 100644 engine/include/nova/graphics/.gitkeep create mode 100644 engine/include/nova/math/.gitkeep create mode 100644 engine/include/nova/networking/.gitkeep create mode 100644 engine/include/nova/physics/.gitkeep create mode 100644 engine/include/nova/platform/.gitkeep create mode 100644 engine/include/nova/utils/.gitkeep create mode 100644 engine/src/core/debug.cpp delete mode 100644 src/main.cpp create mode 100644 templates/.gitkeep create mode 100644 tests/.gitkeep diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d79f52..0b2326e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,44 +1,70 @@ +# Copyright (c) 2025, Jayden Grubb +# SPDX-License-Identifier: BSD-3-Clause + cmake_minimum_required(VERSION 3.20) set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") -project(Example) +project(nova VERSION 0.0.1) enable_language(CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) -add_compile_options( - -Wall - -Wextra - -Wpedantic - -Wold-style-cast +add_compile_definitions( + NOVA_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} + NOVA_VERSION_MINOR=${PROJECT_VERSION_MINOR} + NOVA_VERSION_PATCH=${PROJECT_VERSION_PATCH} ) -add_executable( - ${PROJECT_NAME} - src/main.cpp -) - -# find_package(Example REQUIRED) - -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 $ $ - COMMAND_EXPAND_LISTS +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_options( + /W4 + /permissive- + /EHsc ) -endif () + add_compile_definitions( + NOVA_COMPILER_MSVC + ) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options( + -Wall + -Wextra + -Wpedantic + -Wshadow + -Wold-style-cast + ) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_definitions( + NOVA_COMPILER_GCC + ) + else() + add_compile_definitions( + NOVA_COMPILER_CLANG + ) + endif() +else() + error("Unsupported compiler") +endif() -add_custom_target(run - COMMAND ${PROJECT_NAME} - DEPENDS ${PROJECT_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) +if (WIN32) + add_compile_definitions( + NOVA_PLATFORM_WINDOWS + NOMINMAX + WIN32_LEAN_AND_MEAN + _CRT_SECURE_NO_WARNINGS + _CRT_NONSTDC_NO_WARNINGS + ) +elseif (APPLE) + add_compile_definitions( + NOVA_PLATFORM_MACOS + ) +elseif (UNIX) + add_compile_definitions( + NOVA_PLATFORM_LINUX + ) +else() + error("Unsupported platform") +endif() + +add_subdirectory(engine) +add_subdirectory(editor) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..5da9ff7 --- /dev/null +++ b/LICENSE.txt @@ -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. + diff --git a/include/.gitkeep b/assets/.gitkeep similarity index 100% rename from include/.gitkeep rename to assets/.gitkeep diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt new file mode 100644 index 0000000..c0ed851 --- /dev/null +++ b/editor/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2025, Jayden Grubb +# 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 +) diff --git a/editor/include/nova/editor/.gitkeep b/editor/include/nova/editor/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/editor/src/main.cpp b/editor/src/main.cpp new file mode 100644 index 0000000..57c9bb2 --- /dev/null +++ b/editor/src/main.cpp @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2025, Jayden Grubb + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include + +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; +} diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt new file mode 100644 index 0000000..a94ef86 --- /dev/null +++ b/engine/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2025, Jayden Grubb +# 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 +) diff --git a/engine/include/nova/audio/.gitkeep b/engine/include/nova/audio/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/core/api.hpp b/engine/include/nova/core/api.hpp new file mode 100644 index 0000000..436ac41 --- /dev/null +++ b/engine/include/nova/core/api.hpp @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2025, Jayden Grubb + * + * 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_MACOS) || defined(NOVA_PLATFORM_LINUX) + #if defined(NOVA_EXPORT_SYMBOLS) + #define NOVA_API __attribute__((visibility("default"))) + #else + #define NOVA_API + #endif + #else + #warning "NOVA_API is not defined for this platform" + #define NOVA_API + #endif +#endif + +// clang-format on diff --git a/engine/include/nova/core/debug.hpp b/engine/include/nova/core/debug.hpp new file mode 100644 index 0000000..7e148ae --- /dev/null +++ b/engine/include/nova/core/debug.hpp @@ -0,0 +1,7 @@ +/** + * Copyright (c) 2025, Jayden Grubb + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#pragma once diff --git a/engine/include/nova/ecs/.gitkeep b/engine/include/nova/ecs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/graphics/.gitkeep b/engine/include/nova/graphics/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/math/.gitkeep b/engine/include/nova/math/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/networking/.gitkeep b/engine/include/nova/networking/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/physics/.gitkeep b/engine/include/nova/physics/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/platform/.gitkeep b/engine/include/nova/platform/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/include/nova/utils/.gitkeep b/engine/include/nova/utils/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/engine/src/core/debug.cpp b/engine/src/core/debug.cpp new file mode 100644 index 0000000..ca6b1af --- /dev/null +++ b/engine/src/core/debug.cpp @@ -0,0 +1,7 @@ +/** + * Copyright (c) 2025, Jayden Grubb + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 37f97e0..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -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; -} diff --git a/templates/.gitkeep b/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 0000000..e69de29