From 24bd42f3e90160705352dff78a7ac701b6478399 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Tue, 18 Aug 2020 22:03:15 -0500 Subject: [PATCH 01/12] Add CMake version check to set policies. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f438c0b..f294a0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,11 @@ -cmake_minimum_required(VERSION 3.8) -project(Phoenix) +cmake_minimum_required(VERSION 3.8...3.16) + +# Set the correct policies for the current CMake version. +if(${CMAKE_VERSION} VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) +endif() + +project(Phoenix VERSION 0.1) set_property(GLOBAL PROPERTY USE_FOLDERS ON) From b789b1a9cebb91f50a288cec7064effb500f3c12 Mon Sep 17 00:00:00 2001 From: Vyom Fadia Date: Wed, 19 Aug 2020 12:42:22 +0100 Subject: [PATCH 02/12] Change somethjing that crossed my mind. --- Phoenix/Common/Source/PlayerView.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Phoenix/Common/Source/PlayerView.cpp b/Phoenix/Common/Source/PlayerView.cpp index 5b4b8c5..936c7a3 100644 --- a/Phoenix/Common/Source/PlayerView.cpp +++ b/Phoenix/Common/Source/PlayerView.cpp @@ -60,8 +60,13 @@ std::vector PlayerView::update(entt::registry* registry, math::vec3 chunkToCheck = {static_cast(x + posX), static_cast(y + posY), static_cast(z + posZ)}; - chunkToCheck = chunkToCheck * - static_cast(voxels::Chunk::CHUNK_WIDTH); + + // this will allow it to work if we choose to make chunks non cube. + chunkToCheck = + chunkToCheck * math::vec3 {voxels::Chunk::CHUNK_WIDTH, + voxels::Chunk::CHUNK_HEIGHT, + voxels::Chunk::CHUNK_DEPTH}; + bool hasChunk = false; for (const auto chunk : view.chunks) { @@ -71,6 +76,7 @@ std::vector PlayerView::update(entt::registry* registry, break; } } + if (!hasChunk) { voxels::Chunk* chunk = view.map->getChunk(chunkToCheck); @@ -84,5 +90,6 @@ std::vector PlayerView::update(entt::registry* registry, } } } + return newChunks; } From 61dde8f4d45eda67dcb3a574c895c72353e9b60f Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 07:15:42 -0500 Subject: [PATCH 03/12] Update git submodules from build, and tidy up top level CMakeLists. --- CMakeLists.txt | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f294a0a..19d3360 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,33 @@ cmake_minimum_required(VERSION 3.8...3.16) -# Set the correct policies for the current CMake version. +# Set the correct policies if CMake version is less than 3.12. if(${CMAKE_VERSION} VERSION_LESS 3.12) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) endif() -project(Phoenix VERSION 0.1) +project( + Phoenix + VERSION 0.1 + LANGUAGES CXX) +# Use folders. set_property(GLOBAL PROPERTY USE_FOLDERS ON) +# Update git submodules. +find_package(Git QUIET) +if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") + option(UPDATE_SUBMODULES "Update git submodules during build." ON) + if(UPDATE_SUBMODULES) + message(STATUS "Updating git submodules.") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMODULE_RESULT) + if(NOT GIT_SUBMODULE_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMODULE_RESULT}, please checkout submodules.") + endif() + else() + message(STATUS "Not updating") + endif() +endif() + add_subdirectory(Phoenix) From 874f64bb346fa3cfa7820948919c41e5697c1f9d Mon Sep 17 00:00:00 2001 From: JosiahWI <41302989+JosiahWI@users.noreply.github.com> Date: Wed, 19 Aug 2020 08:22:06 -0500 Subject: [PATCH 04/12] Update CMakeLists.txt Correct Phoenix version number. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19d3360..e538391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ endif() project( Phoenix - VERSION 0.1 + VERSION 0.2 LANGUAGES CXX) # Use folders. From 5254a96eeafaf91fc6625e53fa51ab1120b710f3 Mon Sep 17 00:00:00 2001 From: Timothy VanderZee Date: Wed, 19 Aug 2020 15:48:54 -0500 Subject: [PATCH 05/12] Update CI to let CMake clone submodules. --- azure-pipelines.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ceb3439..de20099 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,9 +44,7 @@ jobs: # key: 'ccache | "$(Agent.JobName)"' # path: $(CCACHE_DIR) # displayName: 'CCache' - - script: git submodule update --init - displayName: 'Cloning Submodules' - - script: cmake -H. -BBuild + - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' From e34d51bc3f0062d9d35eeb3cf3bbfc17ce654658 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 15:55:45 -0500 Subject: [PATCH 06/12] Print out better status message when CMake is not updating git submodules. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e538391..2dd7a15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMODULE_RESULT}, please checkout submodules.") endif() else() - message(STATUS "Not updating") + message(STATUS "Git submodules set to manual update only, this can be changed with the UPDATE_SUBMODULES option.") endif() endif() From 0dc1d5ca207f7ba0313c5fbc5b63e5af555e868d Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 16:04:25 -0500 Subject: [PATCH 07/12] Update CI to let CMake handle git submodules on Windows and MacOS. --- azure-pipelines.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index de20099..29ac19c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,9 +60,7 @@ jobs: CMakeArgs: '' steps: - - script: git submodule update --init - displayName: 'Cloning Submodules' - - script: cmake -H. -BBuild + - script: cmake -S . -BBuild - D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -73,9 +71,7 @@ jobs: vmImage: 'macOS-latest' steps: - - script: git submodule update --init - displayName: 'Cloning Submodules' - - script: cmake -H. -BBuild + - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' From 914150c0c754cc788aa3d97d01676454867759c1 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 16:16:35 -0500 Subject: [PATCH 08/12] Fix command for Windows CMake build in CI. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 29ac19c..3df2b81 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,7 +60,7 @@ jobs: CMakeArgs: '' steps: - - script: cmake -S . -BBuild - D UPDATE_SUBMODULES=ON + - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' From b6cc05f34f0bf1901ac1647ce31f296ca0edab55 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 16:17:41 -0500 Subject: [PATCH 09/12] Set CMake minimum version to 3.12; remove version range. --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dd7a15..95ba16a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,4 @@ -cmake_minimum_required(VERSION 3.8...3.16) - -# Set the correct policies if CMake version is less than 3.12. -if(${CMAKE_VERSION} VERSION_LESS 3.12) - cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) -endif() +cmake_minimum_required(VERSION 3.12) project( Phoenix From 544ad645d418e300e2597a8c1452e2b1a15b82a4 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 16:36:20 -0500 Subject: [PATCH 10/12] Remove spaces between options and values for CMake build configuration in CI. --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3df2b81..9512ffc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,7 +44,7 @@ jobs: # key: 'ccache | "$(Agent.JobName)"' # path: $(CCACHE_DIR) # displayName: 'CCache' - - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON + - script: cmake -S. -BBuild -DUPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -60,7 +60,7 @@ jobs: CMakeArgs: '' steps: - - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON + - script: cmake -S. -BBuild -DUPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -71,7 +71,7 @@ jobs: vmImage: 'macOS-latest' steps: - - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON + - script: cmake -S. -BBuild -DUPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' From dd0c40fd1cb96f85695f00f9af1a6cdffebf4def Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 16:37:58 -0500 Subject: [PATCH 11/12] Revert "Remove spaces between options and values for CMake build configuration in CI." This reverts commit 544ad645d418e300e2597a8c1452e2b1a15b82a4. --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9512ffc..3df2b81 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,7 +44,7 @@ jobs: # key: 'ccache | "$(Agent.JobName)"' # path: $(CCACHE_DIR) # displayName: 'CCache' - - script: cmake -S. -BBuild -DUPDATE_SUBMODULES=ON + - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -60,7 +60,7 @@ jobs: CMakeArgs: '' steps: - - script: cmake -S. -BBuild -DUPDATE_SUBMODULES=ON + - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -71,7 +71,7 @@ jobs: vmImage: 'macOS-latest' steps: - - script: cmake -S. -BBuild -DUPDATE_SUBMODULES=ON + - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' From 7521e5d129b9ed43308b757e65f13b52845c9974 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Wed, 19 Aug 2020 16:44:28 -0500 Subject: [PATCH 12/12] Remove -D UPDATE_SUBMODULES option from CMake build in CI, because it's redundant. --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3df2b81..cafb8ab 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,7 +44,7 @@ jobs: # key: 'ccache | "$(Agent.JobName)"' # path: $(CCACHE_DIR) # displayName: 'CCache' - - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON + - script: cmake -S . -B Build displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -60,7 +60,7 @@ jobs: CMakeArgs: '' steps: - - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON + - script: cmake -S . -B Build displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build' @@ -71,7 +71,7 @@ jobs: vmImage: 'macOS-latest' steps: - - script: cmake -S . -B Build -D UPDATE_SUBMODULES=ON + - script: cmake -S . -B Build displayName: 'CMake Configure' - script: cmake --build Build displayName: 'CMake Build'