diff --git a/.github/workflows/build-system.yml b/.github/workflows/build-system.yml index d85c4be4a..9c217935b 100644 --- a/.github/workflows/build-system.yml +++ b/.github/workflows/build-system.yml @@ -67,15 +67,24 @@ jobs: id: build run: | ${{ matrix.c }} ${{ matrix.cxx }} ${{ matrix.vulkan }} cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} - cmake --build build --config ${{ matrix.configuration }} --target Engine Interop Samples Engine_Tests -j - + cmake --build build --config ${{ matrix.configuration }} -j + - name: Test NovelRT - ${{ matrix.configuration }} - if: steps.build.outcome == 'success' + if: false && steps.build.outcome == 'success' id: test run: | - cd build/tests/NovelRT.Tests ctest --output-on-failure -C ${{ matrix.configuration }} + - name: Install NovelRT - ${{ matrix.configuration }} + run: | + cmake --install build --prefix inst ${{ contains(matrix.configuration, 'Release') && '--strip' || '' }} --config ${{ matrix.configuration }} + + - name: Upload Artifacts - ${{ matrix.configuration }} + uses: actions/upload-artifact@v3 + with: + name: NovelRT_${{ matrix.os }}_${{ matrix.configuration }} + path: inst + Documentation: name: Doxygen - Ubuntu runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f463821c..9f239ef0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,178 +5,35 @@ cmake_policy(SET CMP0083 NEW) # control generation of PIE cmake_policy(SET CMP0091 NEW) # MSVC runtime library flags cmake_policy(SET CMP0135 NEW) # ExternalProject_Add respects timestamps -# Hacky hack hack for Windows -# Needs to be set before project is called. -__- -# We require windows SDK version: v10.0.22621 due to the D3D12 enum values -# we want only being available from this version onwards. -if(WIN32) - set(CMAKE_SYSTEM_VERSION 10.0.22621.0) -endif() - project(NovelRT - VERSION 1.0.0 #MVP Version - DESCRIPTION "NovelRT game engine" - HOMEPAGE_URL "https://novelrt.dev" - LANGUAGES C CXX + VERSION 1.0.0 + DESCRIPTION "NovelRT Game Engine" + HOMEPAGE_URL "https://novelrt.dev/" + LANGUAGES CXX ) include(CheckPIESupported) check_pie_supported() -# -# Set the proper backend target for NovelRT -# -set(NOVELRT_TARGET_OPTIONS "Win32" "Linux" "macOS") -set(NOVELRT_TARGET_OPTIONS "${NOVELRT_TARGET_OPTIONS}" CACHE INTERNAL "List of valid platforms for NovelRT") -if(NOT DEFINED NOVELRT_TARGET) - message(STATUS "No backend specified - setting default based on detected OS.") - if(WIN32) - set(NOVELRT_TARGET "Win32" CACHE STRING "") - elseif(APPLE) - set(NOVELRT_TARGET "macOS" CACHE STRING "") - elseif(UNIX) - set(NOVELRT_TARGET "Linux" CACHE STRING "") - else() - set(NOVELRT_TARGET "Unknown" CACHE STRING "") - endif() -endif() - -# -# Prepend so that our FindVulkan gets picked up first when needed -# -list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") - -# -# Defining options -# -option(NOVELRT_FETCH_DEPENDENCIES "Fetch and build NovelRT dependencies instead of providing system-based ones" ON) -option(NOVELRT_BUILD_SAMPLES "Build NovelRT samples" ON) -option(NOVELRT_BUILD_DOCUMENTATION "Build NovelRT documentation" OFF) -option(NOVELRT_BUILD_TESTS "Build NovelRT tests" ON) -option(NOVELRT_BUILD_INTEROP "Build NovelRT's Interop library" ON) -option(NOVELRT_VERBOSE_BUILD "Build NovelRT using verbose output" OFF) -option(NOVELRT_INSTALL "Generate installation targets" ON) -option(NOVELRT_USE_STD_SPAN "Alias \"NovelRT::Utilities::Misc:Span\" to \"std::span\" instead of \"gsl::span\"." OFF) -option(NOVELRT_BUILD_DEPS_WITH_MAX_CPU "Use all available CPU processing power when scaffolding/building the NovelRT internal dependences" OFF) - -# -# Dependency Version Constraints -# -set(NOVELRT_DOXYGEN_VERSION "1.8.17" CACHE STRING "Doxygen version") -set(NOVELRT_FLAC_VERSION "1.3.4" CACHE STRING "FLAC version") -set(NOVELRT_GLFW_VERSION "3.3.7" CACHE STRING "GLFW3 version") -set(NOVELRT_GSL_VERSION "4.0.0" CACHE STRING "Microsoft.GSL version") -set(NOVELRT_ONETBB_VERSION "2021.5.0" CACHE STRING "OneTBB version") -set(NOVELRT_OPENAL_VERSION "1.21.1" CACHE STRING "OpenAL version") -set(NOVELRT_OGG_VERSION "1.3.5" CACHE STRING "Ogg version") -set(NOVELRT_OPUS_VERSION "1.3.1" CACHE STRING "Opus version") -set(NOVELRT_PNG_VERSION "1.6.35" CACHE STRING "PNG version") -set(NOVELRT_SNDFILE_VERSION "1.1.0" CACHE STRING "SndFile version") -set(NOVELRT_SPDLOG_VERSION "1.10.0" CACHE STRING "spdlog version") -set(NOVELRT_VORBIS_VERSION "1.3.7" CACHE STRING "Vorbis version") -set(NOVELRT_VULKAN_VERSION "1.3.231" CACHE STRING "Vulkan version") - -# -# Alias "NovelRT::Utilities::Misc:Span" to "std::span" instead of "gsl::span". -# If enabled, you need to make sure you current configuration supports "std::span". -# -if(NOVELRT_USE_STD_SPAN) - add_compile_definitions(NOVELRT_USE_STD_SPAN=true) -endif() - -# -# Setup Debug Output -# -if(NOVELRT_VERBOSE_BUILD) - set(CMAKE_VERBOSE_MAKEFILE TRUE) - set(VERBOSE TRUE) - message(VERBOSE "NovelRT - Target Link Libs:") - message(VERBOSE ${NOVELRT_ENGINE_LINK_LIBS}) - message(VERBOSE "NovelRT - Target Compile Definitions:") - message(VERBOSE ${NOVELRT_TARGET_COMPILE_DEFS}) - message(VERBOSE "NovelRT - Target Compile Options:") - message(VERBOSE ${NOVELRT_TARGET_COMPILE_OPTIONS}) -endif() - - -# -# Documentation Generation target -# -if(NOVELRT_BUILD_DOCUMENTATION) - find_package(Doxygen ${NOVELRT_DOXYGEN_VERSION} - COMPONENTS dot - ) - if(DOXYGEN_FOUND) - add_subdirectory(doxygen) - endif() -endif() +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) -find_package(Vulkan ${NOVElRT_VULKAN_VERSION} REQUIRED - OPTIONAL_COMPONENTS MoltenVK) -if(APPLE AND NOT Vulkan_MoltenVK_FOUND) - message(SEND_ERROR "Could not find MoltenVK, which is required for graphics support") -endif() - -# -# Add subdirectories -# -add_subdirectory(thirdparty) -add_subdirectory(resources) -add_subdirectory(src) - -if(NOVELRT_BUILD_SAMPLES) - add_subdirectory(samples) -endif() - -if(NOVELRT_BUILD_TESTS) - enable_testing() - add_subdirectory(tests) -endif() - - -# -# Install files other than the libraries themselves -# Targets' CMakeLists contains respective installations -# -if(NOVELRT_INSTALL) - install( - EXPORT NovelRT - EXPORT_LINK_INTERFACE_LIBRARIES - NAMESPACE NovelRT:: - DESTINATION lib - ) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/NovelRTConfigVersion.cmake + COMPATIBILITY SameMajorVersion +) - #Moved to main CMakeLists as headers should always be distributed for now - install( - DIRECTORY ${PROJECT_SOURCE_DIR}/include/NovelRT/ - DESTINATION include/NovelRT - FILES_MATCHING PATTERN "*.h" - ) +list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") - if(NOVELRT_BUILD_INTEROP) - install( - DIRECTORY ${PROJECT_SOURCE_DIR}/include/NovelRT.Interop/ - DESTINATION include/NovelRT.Interop - FILES_MATCHING PATTERN "*.h" - ) - endif() +enable_testing() +add_subdirectory(core) - if(NOVELRT_DEPS_INSTALLED) - install( - DIRECTORY ${NOVELRT_DEPS_PATH}/lib/ - DESTINATION lib - PATTERN "*gtest*" EXCLUDE - ) - install( - DIRECTORY ${NOVELRT_DEPS_PATH}/include/ - DESTINATION include - PATTERN "gtest" EXCLUDE - ) - install( - DIRECTORY ${NOVELRT_DEPS_PATH}/share/ - DESTINATION share - PATTERN "doc" EXCLUDE - PATTERN "man" EXCLUDE - ) - endif() -endif() +install( + EXPORT NovelRTConfig + NAMESPACE NovelRT:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NovelRT +) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/NovelRTConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NovelRT +) diff --git a/cmake/GenerateCombinedHeader.cmake b/cmake/GenerateCombinedHeader.cmake new file mode 100644 index 000000000..49a0ddd89 --- /dev/null +++ b/cmake/GenerateCombinedHeader.cmake @@ -0,0 +1,61 @@ +set(_gch_default_file_template "${CMAKE_CURRENT_LIST_DIR}/GenerateCombinedHeader.h.in" CACHE INTERNAL "") + +function(generate_combined_header) + cmake_parse_arguments( + PARSE_ARGV 0 + _gch + "INSTALL" + "TARGET;FILE_NAME;FILE_TEMPLATE;DESTINATION" + "HEADER_SETS" + ) + + if(NOT _gch_FILE_NAME) + set(_gch_FILE_NAME "$.hpp") + endif() + + if(NOT _gch_FILE_TEMPLATE) + set(_gch_FILE_TEMPLATE "${_gch_default_file_template}") + endif() + + foreach(_set IN LISTS _gch_HEADER_SETS) + get_target_property(_basedirs ${_gch_TARGET} "HEADER_DIRS_${_set}") + get_target_property(_files ${_gch_TARGET} "HEADER_SET_${_set}") + foreach(_file IN LISTS _files) + set(_relpath "${_file}") + foreach(_dir IN LISTS _basedirs) + file(RELATIVE_PATH _test "${_dir}" "${_file}") + string(LENGTH "${_test}" _testlen) + string(LENGTH "${_relpath}" _rellen) + if(_testlen LESS _rellen) + set(_relpath "${_test}") + endif() + endforeach() + list(APPEND _include_snippets "#include <${_relpath}>") + endforeach() + endforeach() + + string(MAKE_C_IDENTIFIER "${_gch_FILE_NAME}" _macro) + string(TOUPPER "${_macro}" _macro) + list(JOIN _include_snippets "\n" _include_snippet) + + set(GENERATE_COMBINED_HEADER_INCLUDE_GUARD "#ifndef ${_macro}\n#define ${_macro}") + set(GENERATE_COMBINED_HEADER_INCLUDE_GUARD_END "#endif // !${_macro}") + set(GENERATE_COMBINED_HEADER_INCLUDES "${_include_snippet}") + + configure_file( + "${_gch_FILE_TEMPLATE}" + "${_gch_FILE_NAME}.in" + ) + file(GENERATE + OUTPUT "${_gch_FILE_NAME}" + INPUT "${CMAKE_CURRENT_BINARY_DIR}/${_gch_FILE_NAME}.in" + TARGET "${_gch_TARGET}" + ) + + if(_gch_INSTALL) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/${_gch_FILE_NAME}" + DESTINATION "${_gch_DESTINATION}" + ) + endif() +endfunction() diff --git a/cmake/GenerateCombinedHeader.h.in b/cmake/GenerateCombinedHeader.h.in new file mode 100644 index 000000000..19a57672f --- /dev/null +++ b/cmake/GenerateCombinedHeader.h.in @@ -0,0 +1,5 @@ +@GENERATE_COMBINED_HEADER_INCLUDE_GUARD@ + +@GENERATE_COMBINED_HEADER_INCLUDES@ + +@GENERATE_COMBINED_HEADER_INCLUDE_GUARD_END@ diff --git a/common/CombinedHeader.h.in b/common/CombinedHeader.h.in new file mode 100644 index 000000000..0f78d9bb8 --- /dev/null +++ b/common/CombinedHeader.h.in @@ -0,0 +1,6 @@ +#pragma once + +// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root +// for more information. + +@GENERATE_COMBINED_HEADER_INCLUDES@ diff --git a/src/NovelRT/Atom.cpp b/core/Atom.cpp similarity index 90% rename from src/NovelRT/Atom.cpp rename to core/Atom.cpp index 26ba7a1a6..cf72263d5 100644 --- a/src/NovelRT/Atom.cpp +++ b/core/Atom.cpp @@ -1,18 +1,14 @@ // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#include -#ifndef __TBB_PREVIEW_MUTEXES -#define __TBB_PREVIEW_MUTEXES 1 -#endif -#include #include -#include #include +#include +#include + namespace NovelRT { - Atom Atom::GetNextEcsPrimitiveInfoConfigurationId() noexcept { static std::atomic_uintptr_t _nextEcsPrimitiveInfoConfigurationId(0); @@ -76,9 +72,9 @@ namespace NovelRT AtomFactory& AtomFactoryDatabase::GetFactory(const std::string& factoryName) noexcept { - static tbb::mutex _mutex; + //static tbb::mutex _mutex; static std::unordered_map _factories; - std::scoped_lock lock(_mutex); + //std::scoped_lock lock(_mutex); auto it = _factories.find(factoryName); if (it == _factories.end()) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 000000000..7036b440b --- /dev/null +++ b/core/CMakeLists.txt @@ -0,0 +1,75 @@ +include(GenerateCombinedHeader) + +add_library(NovelRT-Core STATIC + Atom.cpp +) + +target_sources(NovelRT-Core + PUBLIC + FILE_SET public_headers + TYPE HEADERS + BASE_DIRS include + FILES + include/NovelRT/Core/Atom.hpp + include/NovelRT/Core/Exceptions/CharacterNotFoundException.hpp + include/NovelRT/Core/Exceptions/CompilationErrorException.hpp + include/NovelRT/Core/Exceptions/DuplicateKeyException.hpp + include/NovelRT/Core/Exceptions/FileNotFoundException.hpp + include/NovelRT/Core/Exceptions/FunctionNotFoundException.hpp + include/NovelRT/Core/Exceptions/InitialisationFailureException.hpp + include/NovelRT/Core/Exceptions/InvalidOperationException.hpp + include/NovelRT/Core/Exceptions/IOException.hpp + include/NovelRT/Core/Exceptions/KeyNotFoundException.hpp + include/NovelRT/Core/Exceptions/NotInitialisedException.hpp + include/NovelRT/Core/Exceptions/NotSupportedException.hpp + include/NovelRT/Core/Exceptions/NullPointerException.hpp + include/NovelRT/Core/Exceptions/OutOfMemoryException.hpp + include/NovelRT/Core/Exceptions/RuntimeNotFoundException.hpp + include/NovelRT/Core/Exceptions/TimeoutException.hpp +) + +generate_combined_header( + TARGET NovelRT-Core + FILE_NAME Core.hpp + FILE_TEMPLATE "${PROJECT_SOURCE_DIR}/common/CombinedHeader.h.in" + INSTALL DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/NovelRT + HEADER_SETS public_headers +) + +set_target_properties(NovelRT-Core + PROPERTIES + EXPORT_NAME Core + POSITION_INDEPENDENT_CODE ON +) + +target_compile_features(NovelRT-Core + PUBLIC + cxx_std_17 +) + +target_compile_options(NovelRT-Core + PRIVATE + $<$:-Wall> + $<$:-Wabi> + $<$:-Werror> + $<$:-Wextra> + $<$:-Wpedantic> + $<$:-pedantic-errors> + + $<$:-Wall> + $<$:-Werror> + $<$:-Wextra> + $<$:-Wpedantic> + $<$:-pedantic-errors> + + $<$:/W4> + $<$:/WX> + $<$:/permissive-> +) + +install( + TARGETS NovelRT-Core + EXPORT NovelRTConfig + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/include/NovelRT/Atom.h b/core/include/NovelRT/Core/Atom.hpp similarity index 84% rename from include/NovelRT/Atom.h rename to core/include/NovelRT/Core/Atom.hpp index 9f057a911..8ceca2eb5 100644 --- a/include/NovelRT/Atom.h +++ b/core/include/NovelRT/Core/Atom.hpp @@ -1,3 +1,5 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. @@ -6,15 +8,10 @@ #include #include -#ifndef NOVELRT_ATOM_H -#define NOVELRT_ATOM_H - namespace NovelRT { class Atom { - friend class AtomHashFunction; - private: uintptr_t _value; @@ -100,22 +97,4 @@ namespace NovelRT public: [[nodiscard]] static AtomFactory& GetFactory(const std::string& factoryName) noexcept; }; - - class AtomHashFunction - { - public: - size_t operator()(Atom atom) const noexcept - { - return static_cast(atom._value); - } - }; } - -namespace std -{ - template<> class numeric_limits : public numeric_limits - { - }; -} - -#endif // NOVELRT_ATOM_H diff --git a/include/NovelRT/Exceptions/CharacterNotFoundException.h b/core/include/NovelRT/Core/Exceptions/CharacterNotFoundException.hpp similarity index 73% rename from include/NovelRT/Exceptions/CharacterNotFoundException.h rename to core/include/NovelRT/Core/Exceptions/CharacterNotFoundException.hpp index 907391bdf..b43ddf367 100644 --- a/include/NovelRT/Exceptions/CharacterNotFoundException.h +++ b/core/include/NovelRT/Core/Exceptions/CharacterNotFoundException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_CHARACTERNOTFOUNDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_CHARACTERNOTFOUNDEXCEPTION_H - #include #include @@ -18,5 +17,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_CHARACTERNOTFOUNDEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/CompilationErrorException.h b/core/include/NovelRT/Core/Exceptions/CompilationErrorException.hpp similarity index 76% rename from include/NovelRT/Exceptions/CompilationErrorException.h rename to core/include/NovelRT/Core/Exceptions/CompilationErrorException.hpp index 4e2d2a969..aae15662b 100644 --- a/include/NovelRT/Exceptions/CompilationErrorException.h +++ b/core/include/NovelRT/Core/Exceptions/CompilationErrorException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_COMPILATIONERROREXCEPTION_H -#define NOVELRT_EXCEPTIONS_COMPILATIONERROREXCEPTION_H - #include #include @@ -18,5 +17,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_COMPILATIONERROREXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/DuplicateKeyException.h b/core/include/NovelRT/Core/Exceptions/DuplicateKeyException.hpp similarity index 75% rename from include/NovelRT/Exceptions/DuplicateKeyException.h rename to core/include/NovelRT/Core/Exceptions/DuplicateKeyException.hpp index 967ce3143..f830de757 100644 --- a/include/NovelRT/Exceptions/DuplicateKeyException.h +++ b/core/include/NovelRT/Core/Exceptions/DuplicateKeyException.hpp @@ -1,8 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_DUPLICATEKEYEXCEPTION_H -#define NOVELRT_EXCEPTIONS_DUPLICATEKEYEXCEPTION_H #include #include @@ -18,5 +18,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_DUPLICATEKEYEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/FileNotFoundException.h b/core/include/NovelRT/Core/Exceptions/FileNotFoundException.hpp similarity index 81% rename from include/NovelRT/Exceptions/FileNotFoundException.h rename to core/include/NovelRT/Core/Exceptions/FileNotFoundException.hpp index c41d953fc..6e1125b31 100644 --- a/include/NovelRT/Exceptions/FileNotFoundException.h +++ b/core/include/NovelRT/Core/Exceptions/FileNotFoundException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_FILENOTFOUNDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_FILENOTFOUNDEXCEPTION_H - #include #include @@ -22,5 +21,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_FILENOTFOUNDEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/FunctionNotFoundException.h b/core/include/NovelRT/Core/Exceptions/FunctionNotFoundException.hpp similarity index 88% rename from include/NovelRT/Exceptions/FunctionNotFoundException.h rename to core/include/NovelRT/Core/Exceptions/FunctionNotFoundException.hpp index 374b6ec51..d06e12a39 100644 --- a/include/NovelRT/Exceptions/FunctionNotFoundException.h +++ b/core/include/NovelRT/Core/Exceptions/FunctionNotFoundException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_FUNCTIONNOTFOUNDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_FUNCTIONNOTFOUNDEXCEPTION_H - #include #include @@ -33,5 +32,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_FUNCTIONNOTFOUNDEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/IOException.h b/core/include/NovelRT/Core/Exceptions/IOException.hpp similarity index 83% rename from include/NovelRT/Exceptions/IOException.h rename to core/include/NovelRT/Core/Exceptions/IOException.hpp index 6c59a3f46..b5b66ccc8 100644 --- a/include/NovelRT/Exceptions/IOException.h +++ b/core/include/NovelRT/Core/Exceptions/IOException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_IOEXCEPTION_H -#define NOVELRT_EXCEPTIONS_IOEXCEPTION_H - #include #include @@ -22,5 +21,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_IOEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/InitialisationFailureException.h b/core/include/NovelRT/Core/Exceptions/InitialisationFailureException.hpp similarity index 86% rename from include/NovelRT/Exceptions/InitialisationFailureException.h rename to core/include/NovelRT/Core/Exceptions/InitialisationFailureException.hpp index a8c467f9f..100e5151b 100644 --- a/include/NovelRT/Exceptions/InitialisationFailureException.h +++ b/core/include/NovelRT/Core/Exceptions/InitialisationFailureException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_INITIALISATIONFAILUREEXCEPTION_H -#define NOVELRT_EXCEPTIONS_INITIALISATIONFAILUREEXCEPTION_H - #include #include @@ -33,5 +32,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_INITIALISATIONFAILUREEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/InvalidOperationException.h b/core/include/NovelRT/Core/Exceptions/InvalidOperationException.hpp similarity index 77% rename from include/NovelRT/Exceptions/InvalidOperationException.h rename to core/include/NovelRT/Core/Exceptions/InvalidOperationException.hpp index 22a47c1b7..e348c5d36 100644 --- a/include/NovelRT/Exceptions/InvalidOperationException.h +++ b/core/include/NovelRT/Core/Exceptions/InvalidOperationException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_INVALIDOPERATIONEXCEPTION_H -#define NOVELRT_EXCEPTIONS_INVALIDOPERATIONEXCEPTION_H - #include #include @@ -21,5 +20,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_INVALIDOPERATIONEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/KeyNotFoundException.h b/core/include/NovelRT/Core/Exceptions/KeyNotFoundException.hpp similarity index 77% rename from include/NovelRT/Exceptions/KeyNotFoundException.h rename to core/include/NovelRT/Core/Exceptions/KeyNotFoundException.hpp index 4185cecd8..25ad8280d 100644 --- a/include/NovelRT/Exceptions/KeyNotFoundException.h +++ b/core/include/NovelRT/Core/Exceptions/KeyNotFoundException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_KEYNOTFOUNDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_KEYNOTFOUNDEXCEPTION_H - #include namespace NovelRT::Exceptions @@ -20,5 +19,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_KEYNOTFOUNDEXCEPTION_H diff --git a/include/NovelRT/Exceptions/NotInitialisedException.h b/core/include/NovelRT/Core/Exceptions/NotInitialisedException.hpp similarity index 83% rename from include/NovelRT/Exceptions/NotInitialisedException.h rename to core/include/NovelRT/Core/Exceptions/NotInitialisedException.hpp index c596011c1..56685081b 100644 --- a/include/NovelRT/Exceptions/NotInitialisedException.h +++ b/core/include/NovelRT/Core/Exceptions/NotInitialisedException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_NOTINITIALISEDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_NOTINITIALISEDEXCEPTION_H - #include #include @@ -23,5 +22,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_NOTINITIALISEDEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/NotSupportedException.h b/core/include/NovelRT/Core/Exceptions/NotSupportedException.hpp similarity index 77% rename from include/NovelRT/Exceptions/NotSupportedException.h rename to core/include/NovelRT/Core/Exceptions/NotSupportedException.hpp index 89b10c2de..c03abda43 100644 --- a/include/NovelRT/Exceptions/NotSupportedException.h +++ b/core/include/NovelRT/Core/Exceptions/NotSupportedException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_NOTSUPPORTEDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_NOTSUPPORTEDEXCEPTION_H - #include #include @@ -20,5 +19,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_NOTSUPPORTEDEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/NullPointerException.h b/core/include/NovelRT/Core/Exceptions/NullPointerException.hpp similarity index 80% rename from include/NovelRT/Exceptions/NullPointerException.h rename to core/include/NovelRT/Core/Exceptions/NullPointerException.hpp index 2a36ecb72..43e2bf53e 100644 --- a/include/NovelRT/Exceptions/NullPointerException.h +++ b/core/include/NovelRT/Core/Exceptions/NullPointerException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_NULLPOINTEREXCEPTION_H -#define NOVELRT_EXCEPTIONS_NULLPOINTEREXCEPTION_H - #include #include @@ -21,5 +20,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_NULLPOINTEREXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/OutOfMemoryException.h b/core/include/NovelRT/Core/Exceptions/OutOfMemoryException.hpp similarity index 78% rename from include/NovelRT/Exceptions/OutOfMemoryException.h rename to core/include/NovelRT/Core/Exceptions/OutOfMemoryException.hpp index 50d54b917..7ecbe39f7 100644 --- a/include/NovelRT/Exceptions/OutOfMemoryException.h +++ b/core/include/NovelRT/Core/Exceptions/OutOfMemoryException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_OUTOFMEMORYEXCEPTION_H -#define NOVELRT_EXCEPTIONS_OUTOFMEMORYEXCEPTION_H - #include #include @@ -21,5 +20,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_OUTOFMEMORYEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/RuntimeNotFoundException.h b/core/include/NovelRT/Core/Exceptions/RuntimeNotFoundException.hpp similarity index 72% rename from include/NovelRT/Exceptions/RuntimeNotFoundException.h rename to core/include/NovelRT/Core/Exceptions/RuntimeNotFoundException.hpp index c4d47a2cf..e002083a8 100644 --- a/include/NovelRT/Exceptions/RuntimeNotFoundException.h +++ b/core/include/NovelRT/Core/Exceptions/RuntimeNotFoundException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_RUNTIMENOTFOUNDEXCEPTION_H -#define NOVELRT_EXCEPTIONS_RUNTIMENOTFOUNDEXCEPTION_H - #include #include @@ -17,5 +16,3 @@ namespace NovelRT::Exceptions } }; } - -#endif //! NOVELRT_EXCEPTIONS_RUNTIMENOTFOUNDEXCEPTION_H \ No newline at end of file diff --git a/include/NovelRT/Exceptions/TimeoutException.h b/core/include/NovelRT/Core/Exceptions/TimeoutException.hpp similarity index 87% rename from include/NovelRT/Exceptions/TimeoutException.h rename to core/include/NovelRT/Core/Exceptions/TimeoutException.hpp index 7e5e6ec9f..00425d37d 100644 --- a/include/NovelRT/Exceptions/TimeoutException.h +++ b/core/include/NovelRT/Core/Exceptions/TimeoutException.hpp @@ -1,9 +1,8 @@ +#pragma once + // Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root // for more information. -#ifndef NOVELRT_EXCEPTIONS_TIMEOUTEXCEPTION_H -#define NOVELRT_EXCEPTIONS_TIMEOUTEXCEPTION_H - #include #include #include diff --git a/include/NovelRT/Exceptions/Exceptions.h b/include/NovelRT/Exceptions/Exceptions.h deleted file mode 100644 index 67c807834..000000000 --- a/include/NovelRT/Exceptions/Exceptions.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Created by Matt on 06/01/2021. -// - -#ifndef NOVELRT_EXCEPTIONS_H -#define NOVELRT_EXCEPTIONS_H - -#include "CharacterNotFoundException.h" -#include "CompilationErrorException.h" -#include "DuplicateKeyException.h" -#include "FileNotFoundException.h" -#include "FunctionNotFoundException.h" -#include "IOException.h" -#include "InitialisationFailureException.h" -#include "InvalidOperationException.h" -#include "KeyNotFoundException.h" -#include "NotInitialisedException.h" -#include "NotSupportedException.h" -#include "NullPointerException.h" -#include "OpenGLLinkageFailureException.h" -#include "OutOfMemoryException.h" -#include "RuntimeNotFoundException.h" -#include "TimeoutException.h" - -#endif // NOVELRT_EXCEPTIONS_H diff --git a/include/NovelRT/Exceptions/OpenGLLinkageFailureException.h b/include/NovelRT/Exceptions/OpenGLLinkageFailureException.h deleted file mode 100644 index b5c4fd017..000000000 --- a/include/NovelRT/Exceptions/OpenGLLinkageFailureException.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright © Matt Jones and Contributors. Licensed under the MIT Licence (MIT). See LICENCE.md in the repository root -// for more information. - -#ifndef NOVELRT_EXCEPTIONS_OPENGLLINKAGEFAILUREEXCEPTION_H -#define NOVELRT_EXCEPTIONS_OPENGLLINKAGEFAILUREEXCEPTION_H - -#include -#include - -namespace NovelRT::Exceptions -{ - class OpenGLLinkageFailureException final : public std::runtime_error - { - public: - OpenGLLinkageFailureException(uint32_t programId, const std::string& errorMessage) - : std::runtime_error(std::string("Program with ID \"") + std::to_string(programId) + - "\" has encountered an error. Error: " + errorMessage) - { - } - }; -} - -#endif //! NOVELRT_EXCEPTIONS_OPENGLLINKAGEFAILUREEXCEPTION_H \ No newline at end of file