diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml new file mode 100644 index 0000000..197439b --- /dev/null +++ b/.github/workflows/windows-test.yml @@ -0,0 +1,24 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: CMake on a single platform + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build tests + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: ./build_tests.bat + - name: Start tests + run: ./build/bin/Release/Tests.exe + diff --git a/Core/Types/object_ptr.hpp b/Core/Types/object_ptr.hpp index 3b8414b..aa1146f 100644 --- a/Core/Types/object_ptr.hpp +++ b/Core/Types/object_ptr.hpp @@ -154,9 +154,19 @@ static void add_owner(object_ptr& ptr) if (ptr_) counter::remove_object(ptr_); } - Ty* get() const noexcept { return ptr_.load(); } - Ty& operator*() const noexcept { return *ptr_; } - Ty* operator->() const noexcept { return ptr_.load(); } + Ty* get() const { return ptr_.load(); } + Ty& operator*() const + { + if (!ptr_.load()) + throw std::runtime_error("Null pointer"); + return *ptr_; + } + Ty* operator->() const + { + if (!ptr_.load()) + throw std::runtime_error("Null pointer"); + return ptr_.load(); + } operator bool() const noexcept { return ptr_.load() != nullptr; } object_ptr& operator=(const object_ptr& ptr) { diff --git a/build_Engine.bat b/build_Engine.bat new file mode 100644 index 0000000..d6cbf48 --- /dev/null +++ b/build_Engine.bat @@ -0,0 +1,11 @@ +@echo off +mkdir .\build +cd build +cmake -DBUILD_MODE=Engine .. +cmake --build . --config Release +cd .. +mkdir ".\build\bin\include" +robocopy ".\Core" ".\build\bin\include\Core" *.h *.hpp /S +robocopy ".\Delegate" ".\build\bin\include\Delegate" *.h *.hpp /S +robocopy ".\FastRTTI" ".\build\bin\include\FastRTTI" *.h *.hpp /S +pause \ No newline at end of file diff --git a/build_tests.bat b/build_tests.bat new file mode 100644 index 0000000..bef0c34 --- /dev/null +++ b/build_tests.bat @@ -0,0 +1,5 @@ +@echo off +mkdir build +cd build +cmake -DBUILD_MODE=Tests .. +cmake --build . --config Release diff --git a/configurate Win32.bat b/configurate Win32.bat index ff63dcc..4a49a47 100644 --- a/configurate Win32.bat +++ b/configurate Win32.bat @@ -1,5 +1,5 @@ @echo off mkdir build cd build -cmake .. -A Win32 +cmake -DBUILD_MODE=All .. -A Win32 pause \ No newline at end of file diff --git a/configurate Win64.bat b/configurate Win64.bat index 2a1279f..08a7e36 100644 --- a/configurate Win64.bat +++ b/configurate Win64.bat @@ -1,5 +1,5 @@ @echo off mkdir build cd build -cmake .. -A x64 +cmake -DBUILD_MODE=All .. -A x64 pause \ No newline at end of file