Skip to content

Commit bcfc64c

Browse files
committed
move to ::crt namespace to prevent future naming collisions
removed types.hpp got rid of chrono folder
1 parent b559123 commit bcfc64c

48 files changed

Lines changed: 169 additions & 188 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
cmake_minimum_required(VERSION 3.24)
22

3-
project(oryx-crt-cpp VERSION 0.2.0 LANGUAGES CXX)
3+
include(cmake/utils.cmake)
4+
5+
oryx_extract_version()
6+
7+
project(oryx-crt-cpp VERSION ${ORYX_CRT_VERSION} LANGUAGES CXX)
48

5-
message(STATUS "Build oryx-crt-cpp: ${PROJECT_VERSION}")
9+
message(STATUS "Build ${PROJECT_NAME}: ${PROJECT_VERSION}")
610

711
include(cmake/utils.cmake)
812

@@ -60,8 +64,7 @@ file(GLOB_RECURSE ORYX_CRT_HEADERS
6064
)
6165

6266
target_sources(${PROJECT_NAME}
63-
PRIVATE
64-
src/frame_rate_controller.cpp
67+
PRIVATE
6568
src/uuid.cpp
6669
PUBLIC
6770
FILE_SET HEADERS

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# oryx-crt-cpp
22

3-
Common C++ Runtime used for personal C++ Projects. Happy to accept any contributions and improvements to this library
3+
Common C++ Runtime used for personal C++ Projects.
44

55
## Third Party libraries
66

7-
Even tho my libary is licensened with the UNLICENSE make sure to check third party licences of the libs included in this library, when using this lib in your project.
8-
97
- [httplib](https://github.com/yhirose/cpp-httplib) MIT license
108
- [thread_pool](https://github.com/bshoshany/thread-pool.git) MIT license
119
- [enchantum](https://github.com/ZXShady/enchantum.git) MIT license

cmake/utils.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
function(_internal_extract_version_fail_message tag)
2+
message(FATAL_ERROR "Could not extract ${tag} version number from chron/version.hpp")
3+
endfunction()
4+
5+
function(oryx_extract_version)
6+
file(READ "${CMAKE_CURRENT_LIST_DIR}/include/oryx/crt/version.hpp" file_contents)
7+
8+
string(REGEX MATCH "kVersionMajor[ \t]*=[ \t]*([0-9]+)" _ "${file_contents}")
9+
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
10+
_internal_extract_version_fail_message(major)
11+
endif()
12+
set(ver_major ${CMAKE_MATCH_1})
13+
14+
string(REGEX MATCH "KVersionMinor[ \t]*=[ \t]*([0-9]+)" _ "${file_contents}")
15+
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
16+
_internal_extract_version_fail_message(minor)
17+
endif()
18+
19+
set(ver_minor ${CMAKE_MATCH_1})
20+
string(REGEX MATCH "kVersionPatch[ \t]*=[ \t]*([0-9]+)" _ "${file_contents}")
21+
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
22+
_internal_extract_version_fail_message(patch)
23+
endif()
24+
set(ver_patch ${CMAKE_MATCH_1})
25+
26+
set(ORYX_CRT_VERSION_MAJOR ${ver_major} PARENT_SCOPE)
27+
set(ORYX_CRT_VERSION_MINOR ${ver_minor} PARENT_SCOPE)
28+
set(ORYX_CRT_VERSION_PATCH ${ver_patch} PARENT_SCOPE)
29+
set(ORYX_CRT_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE)
30+
endfunction()
31+
132
function(oryx_enable_addr_sanitizer target_name)
233
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
334
message(FATAL_ERROR "Sanitizer supported only for gcc/clang!")

include/oryx/chrono/now.hpp

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77

88
#include "from_chars.hpp"
99

10-
namespace oryx::argparse {
10+
namespace oryx::crt {
11+
1112
namespace details {
1213
template <typename>
1314
constexpr bool always_false = false;
1415
}
1516

16-
class CLI {
17+
class ArgumentParser {
1718
public:
18-
CLI(int argc, const char* const* argv)
19+
ArgumentParser(int argc, const char* const* argv)
1920
: view_(argv, argc) {}
2021

2122
auto Contains(std::string_view option) const { return std::ranges::find(view_, option) != view_.end(); }
@@ -59,4 +60,4 @@ class CLI {
5960
std::basic_string_view<const char*> view_;
6061
};
6162

62-
} // namespace oryx::argparse
63+
} // namespace oryx::crt
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "synchronized.hpp"
99

10-
namespace oryx {
10+
namespace oryx::crt {
1111

1212
/**
1313
* @brief CallbackList is a thread safe list that stores callbacks, and can notify these callbacks.
@@ -92,4 +92,4 @@ class CallbackList {
9292
Synchronized<std::vector<Subscriber>> subs_{};
9393
};
9494

95-
} // namespace oryx
95+
} // namespace oryx::crt
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#include <chrono>
44
#include <optional>
55

6-
#include <oryx/scope_exit.hpp>
7-
#include <oryx/chrono/stopwatch.hpp>
6+
#include "scope_exit.hpp"
7+
#include "stopwatch.hpp"
88

9-
namespace oryx::chrono {
9+
namespace oryx::crt {
1010

1111
template <class Clock = std::chrono::steady_clock>
1212
requires std::chrono::is_clock_v<Clock>
@@ -45,4 +45,4 @@ auto MakeFrameRateTimer(int target_fps) {
4545
return CycleTimer<Clock>{typename CycleTimer<Clock>::Duration{1000 / target_fps}};
4646
}
4747

48-
} // namespace oryx::chrono
48+
} // namespace oryx::crt
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <string>
44
#include <string_view>
55

6-
namespace oryx {
6+
namespace oryx::crt {
77

88
/**
99
* @brief Base error class for exception free programming
@@ -19,4 +19,4 @@ class Error {
1919
std::string what_;
2020
};
2121

22-
} // namespace oryx
22+
} // namespace oryx::crt

0 commit comments

Comments
 (0)