Skip to content

Commit 62689a9

Browse files
authored
[merge] Merge pull request #368 from inexorgame/iceflower/various
Iceflower/various
2 parents 788a94b + 0612f79 commit 62689a9

File tree

11 files changed

+131
-118
lines changed

11 files changed

+131
-118
lines changed

cmake/conan_setup.cmake

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
# Dependency setup via conan.
2-
# Download conan executer in case it does not exists.
3-
if(NOT EXISTS "${PROJECT_BINARY_DIR}/conan.cmake")
4-
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
5-
file(
6-
DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.15/conan.cmake"
7-
"${PROJECT_BINARY_DIR}/conan.cmake"
8-
)
9-
endif()
10-
include(${PROJECT_BINARY_DIR}/conan.cmake)
11-
conan_check(VERSION 1.19.1 REQUIRED)
12-
132
if(INEXOR_BUILD_BENCHMARKS)
143
set(benchmark_option True)
154
else()
@@ -23,16 +12,32 @@ endif()
2312
if(UNIX)
2413
set(compiler_libcxx SETTINGS compiler.libcxx=libstdc++11)
2514
endif()
26-
conan_cmake_run(
27-
CONANFILE conanfile.py
28-
BASIC_SETUP
15+
16+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
17+
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
18+
19+
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
20+
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
21+
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake"
22+
"${CMAKE_BINARY_DIR}/conan.cmake"
23+
EXPECTED_HASH SHA256=396e16d0f5eabdc6a14afddbcfff62a54a7ee75c6da23f32f7a31bc85db23484
24+
TLS_VERIFY ON)
25+
endif()
26+
27+
include(conan)
28+
29+
conan_check(VERSION 1.35.2 REQUIRED)
30+
conan_cmake_autodetect(conan_settings BUILD_TYPE ${CMAKE_BUILD_TYPE})
31+
conan_cmake_install(
32+
PATH_OR_REFERENCE ${PROJECT_SOURCE_DIR}
2933
BUILD outdated
34+
REMOTE conan-center
3035
PROFILE ${INEXOR_CONAN_PROFILE}
31-
PROFILE_AUTO build_type
32-
KEEP_RPATHS
3336
OPTIONS build_benchmarks=${benchmark_option}
34-
build_tests=${tests_option}
37+
OPTIONS build_tests=${tests_option}
38+
SETTINGS ${conan_settings}
3539
SETTINGS compiler.cppstd=17
3640
${compiler_libcxx}
3741
)
38-
conan_check_compiler()
42+
include(conanbuildinfo)
43+
conan_basic_setup()

conanfile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class InexorConan(ConanFile):
3535

3636
def configure(self):
3737
if self.settings.os == "Linux" and self.settings.compiler.libcxx == "libstdc++":
38-
raise Exception("Inexor is not compatible with libstdc++. " \
39-
+ "Please change the 'compiler.libcxx'-setting " \
40-
+ "(e.g. to libstdc++11).")
38+
raise Exception("Inexor is not compatible with libstdc++. "
39+
"Please change the 'compiler.libcxx'-setting "
40+
"(e.g. to libstdc++11).")
4141

4242
def requirements(self):
4343
if self.options.build_benchmarks:
@@ -49,9 +49,9 @@ def imports(self):
4949
# Copies all dll files from packages bin folder to my "bin" folder (win)
5050
self.copy("*.dll", dst="bin", src="bin")
5151
# Copies all dylib files from packages lib folder to my "lib" folder (macosx)
52-
self.copy("*.dylib*", dst="lib", src="lib") # From lib to lib
52+
self.copy("*.dylib*", dst="lib", src="lib")
5353
# Copies all so files from packages lib folder to my "lib" folder (linux)
54-
self.copy("*.so*", dst="lib", src="lib") # From lib to lib
54+
self.copy("*.so*", dst="lib", src="lib")
5555

5656
def build(self):
5757
cmake = CMake(self)

documentation/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ if (INEXOR_BUILD_DOCUMENTATION_USE_VENV)
2424
COMMAND ${Python_EXECUTABLE} -m pip install --no-cache -r requirements.txt
2525
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
2626
COMMAND_ERROR_IS_FATAL ANY
27-
RESULT_VARIABLE proc_result
2827
)
2928
endif()
3029

3130
execute_process(
32-
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../helper/requirements_check/req_check.py requirements.txt
31+
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../helper/req_check.py requirements.txt
3332
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
3433
COMMAND_ERROR_IS_FATAL ANY
3534
)

documentation/source/development/building.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This project uses out of source builds using either `gcc <https://gcc.gnu.org/>`
1414

1515
Generating the documentation will create two subfolders in ``doc`` which will be ignored by git.
1616

17-
There are four CMake targets and options are available:
17+
The following CMake targets and options are available:
1818

1919
.. list-table:: List of CMake build targets.
2020
:header-rows: 1
@@ -54,7 +54,7 @@ There are four CMake targets and options are available:
5454
- Builds inexor-renderer-benchmarks.
5555
- ``OFF``
5656
* - INEXOR_CONAN_PROFILE
57-
- To adjust the conan profile, use ``-DCONNECTOR_CONAN_PROFILE=<name>``.
57+
- To adjust the conan profile, use ``-DINEXOR_CONAN_PROFILE=<name>``.
5858
- ``default``
5959
* - INEXOR_USE_VMA_RECORDING
6060
- Enables or disables `Vulkan Memory Allocator's <https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator>`__ recording feature.
@@ -183,7 +183,7 @@ Configure cmake:
183183

184184
.. note::
185185

186-
- Only pass ``-GNinja`` if the ninja build tool is installed.
186+
Only pass ``-GNinja`` if the ninja build tool is installed.
187187

188188
.. code-block:: shell-session
189189

example/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set_target_properties(
99
)
1010

1111
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
12+
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "inexor-vulkan-renderer-example")
1213
target_compile_options(inexor-vulkan-renderer-example PRIVATE "/MP")
1314
set_target_properties(
1415
inexor-vulkan-renderer-example
@@ -27,5 +28,3 @@ target_link_libraries(
2728
PRIVATE
2829
inexor-vulkan-renderer
2930
)
30-
31-
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "inexor-vulkan-renderer-example")

helper/req_check.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""
2+
Copyright 2021-present Iceflower - [email protected]
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
"""
10+
11+
from argparse import ArgumentParser
12+
from pathlib import Path
13+
14+
import pkg_resources
15+
import sys
16+
17+
18+
def cmd_parser() -> ArgumentParser:
19+
parser = ArgumentParser(prog="req_check",
20+
description="Check if a python installation matches a requirements.txt file")
21+
22+
parser.add_argument(dest='req_file', type=str, help='path to requirements.txt')
23+
parser.add_argument('--quiet', dest='quiet', action='store_true', default=False, help='output nothing')
24+
25+
return parser
26+
27+
28+
def main():
29+
args = cmd_parser().parse_args(sys.argv[1:])
30+
31+
with Path(args.req_file).open(mode='r', encoding='UTF-8') as reader:
32+
dependencies = reader.read()
33+
34+
success = True
35+
for pkg in dependencies.split('\n'):
36+
try:
37+
pkg_resources.require(pkg)
38+
except pkg_resources.DistributionNotFound:
39+
success = False
40+
if not args.quiet:
41+
print(f"Did not found '{pkg}', but is required.")
42+
except pkg_resources.VersionConflict as ex:
43+
success = False
44+
if not args.quiet:
45+
print(f"Found: '{ex.dist}', but '{ex.req}' is required.")
46+
else:
47+
if not args.quiet:
48+
print(f"Found: '{pkg}'.")
49+
exit(0) if success else exit(1)
50+
51+
52+
if __name__ == '__main__':
53+
main()

helper/requirements_check/req_check.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

include/inexor/vulkan-renderer/world/cube.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Cube : public std::enable_shared_from_this<Cube> {
3434
friend class io::NXOCParser;
3535

3636
public:
37-
/// Maximum of sub cubes (childs)
37+
/// Maximum of sub cubes (children)
3838
static constexpr std::size_t SUB_CUBES{8};
3939
/// Cube edges.
4040
static constexpr std::size_t EDGES{12};
@@ -65,14 +65,14 @@ class Cube : public std::enable_shared_from_this<Cube> {
6565

6666
/// Indentations, should only be used if it is a geometry cube.
6767
std::array<Indentation, Cube::EDGES> m_indentations;
68-
std::array<std::shared_ptr<Cube>, Cube::SUB_CUBES> m_childs;
68+
std::array<std::shared_ptr<Cube>, Cube::SUB_CUBES> m_children;
6969

7070
/// Only geometry cube (Type::SOLID and Type::Normal) have a polygon cache.
7171
mutable PolygonCache m_polygon_cache;
7272
mutable bool m_polygon_cache_valid{false};
7373

74-
/// Removes all childs recursive.
75-
void remove_childs();
74+
/// Removes all children recursive.
75+
void remove_children();
7676

7777
/// Get the root to this cube.
7878
[[nodiscard]] std::shared_ptr<Cube> root() noexcept;
@@ -119,8 +119,8 @@ class Cube : public std::enable_shared_from_this<Cube> {
119119
/// Get type.
120120
[[nodiscard]] Type type() const noexcept;
121121

122-
/// Get childs.
123-
[[nodiscard]] const std::array<std::shared_ptr<Cube>, Cube::SUB_CUBES> &childs() const;
122+
/// Get children.
123+
[[nodiscard]] const std::array<std::shared_ptr<Cube>, Cube::SUB_CUBES> &children() const;
124124
/// Get indentations.
125125
[[nodiscard]] std::array<Indentation, Cube::EDGES> indentations() const noexcept;
126126

src/vulkan-renderer/application.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ void Application::load_octree_geometry() {
191191
std::shared_ptr<world::Cube> cube = std::make_shared<world::Cube>(2.0f, glm::vec3{0, -1, -1});
192192
cube->set_type(world::Cube::Type::OCTANT);
193193

194-
cube->childs()[3]->set_type(world::Cube::Type::EMPTY);
195-
cube->childs()[5]->set_type(world::Cube::Type::EMPTY);
196-
cube->childs()[6]->set_type(world::Cube::Type::EMPTY);
197-
cube->childs()[7]->set_type(world::Cube::Type::EMPTY);
194+
cube->children()[3]->set_type(world::Cube::Type::EMPTY);
195+
cube->children()[5]->set_type(world::Cube::Type::EMPTY);
196+
cube->children()[6]->set_type(world::Cube::Type::EMPTY);
197+
cube->children()[7]->set_type(world::Cube::Type::EMPTY);
198198

199199
for (const auto &polygons : cube->polygons(true)) {
200200
for (const auto &triangle : *polygons) {

src/vulkan-renderer/io/nxoc_parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ByteStream NXOCParser::serialize_impl<0>(const std::shared_ptr<const world::Cube
2020
iter_func = [&iter_func, &writer](const std::shared_ptr<const world::Cube> &cube) {
2121
writer.write(cube->type());
2222
if (cube->type() == world::Cube::Type::OCTANT) {
23-
for (const auto &child : cube->childs()) {
23+
for (const auto &child : cube->children()) {
2424
iter_func(child);
2525
}
2626
return;
@@ -49,7 +49,7 @@ std::shared_ptr<world::Cube> NXOCParser::deserialize_impl<0>(const ByteStream &s
4949
iter_func = [&iter_func, &reader](std::shared_ptr<world::Cube> &cube) {
5050
cube->set_type(reader.read<world::Cube::Type>());
5151
if (cube->type() == world::Cube::Type::OCTANT) {
52-
for (auto child : cube->childs()) {
52+
for (auto child : cube->children()) {
5353
iter_func(child);
5454
}
5555
return;

0 commit comments

Comments
 (0)