File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666 include :
6767 - name : " ASan"
6868 extra-flags : " -DORYX_CHRON_SANITIZE_ADDRESS=ON"
69+ - name : " TSan"
70+ extra-flags : " -DORYX_CHRON_SANITIZE_THREAD=ON" # Not doing much right now
6971 - name : " Optimized Build"
7072 extra-flags : " -DCMAKE_CXX_FLAGS=-O3"
73+ - name : " Shared Build"
74+ extra-flags : " -DORYX_CHRON_BUILD_SHARED_LIBS=ON"
7175
7276 name : " ${{ github.job }} ${{ matrix.name }}"
7377 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -2,29 +2,33 @@ name: windows
22
33on : [push, pull_request]
44
5- env :
6- VCPKG_BINARY_SOURCES : " clear;x-gha,readwrite"
7-
85jobs :
96 windows-msvc :
107 runs-on : windows-latest
8+ strategy :
9+ matrix :
10+ shared : [OFF, ON]
11+ name : " Windows MSVC ${{ matrix.shared == 'ON' && 'shared' || 'static' }}"
1112 steps :
1213 - name : Checkout
1314 uses : actions/checkout@v4
1415 with :
1516 submodules : recursive
1617 fetch-depth : 0
18+
1719 - name : Export GitHub Actions cache environment variables
1820 uses : actions/github-script@v7
1921 with :
2022 script : |
2123 core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
2224 core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
25+
2326 - uses : ilammy/msvc-dev-cmd@v1
27+
2428 - name : Compile
2529 run : |
26- cmake -B build -DORYX_CHRON_BUILD_TESTS=ON -DCMAKE_CXX_STANDARD=20 -DCMAKE_BUILD_TYPE=Release
30+ cmake -B build -DORYX_CHRON_BUILD_TESTS=ON -DORYX_CHRON_BUILD_SHARED_LIBS=${{ matrix.shared }} - DCMAKE_CXX_STANDARD=20 -DCMAKE_BUILD_TYPE=Release
2731 cmake --build build
32+
2833 - name : Run tests
29- run : |
30- .\build\Debug\chron-cpp_tests --success
34+ run : .\build\Debug\chron-cpp_tests
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ endif()
2929
3030if (ORYX_CHRON_BUILD_SHARED_LIBS)
3131 add_library (${PROJECT_NAME } SHARED )
32+ target_compile_definitions (${PROJECT_NAME } PUBLIC ORYX_CHRON_BUILD_SHARED_LIBS )
3233 set_target_properties (${PROJECT_NAME } PROPERTIES SOVERSION ${PROJECT_VERSION } )
3334else ()
3435 add_library (${PROJECT_NAME } STATIC )
@@ -40,6 +41,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
4041 target_compile_options (${PROJECT_NAME }
4142 PRIVATE
4243 /W4
44+ PUBLIC
45+ $<$<BOOL :${ORYX_CHRON_BUILD_SHARED_LIBS} >:/wd4251 >
4346 )
4447else ()
4548 target_compile_options (${PROJECT_NAME }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44#include < mutex>
55#include < chrono>
66
7- #include < oryx/chron/traits .hpp>
8- #include < oryx/chron/chrono_types .hpp>
7+ #include " common .hpp"
8+ #include " traits .hpp"
99
1010namespace oryx ::chron {
1111
12- class UTCClock {
12+ class ORYX_CHRON_API UTCClock {
1313public:
1414 auto Now () const -> TimePoint { return Clock::now (); }
1515 auto UtcOffset (TimePoint) const -> std::chrono::seconds { return std::chrono::seconds (0 ); }
1616};
1717
18- class LocalClock {
18+ class ORYX_CHRON_API LocalClock {
1919public:
2020 auto Now () const -> TimePoint {
2121 auto now = Clock::now ();
@@ -25,7 +25,7 @@ class LocalClock {
2525 auto UtcOffset (TimePoint now) const -> std::chrono::seconds;
2626};
2727
28- class TzClock {
28+ class ORYX_CHRON_API TzClock {
2929public:
3030 auto Now () const -> TimePoint {
3131 auto now = Clock::now ();
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < chrono>
4+
5+ #ifdef ORYX_CHRON_BUILD_SHARED_LIBS
6+ #ifdef _WIN32
7+ #ifdef chron_cpp_EXPORTS
8+ #define ORYX_CHRON_API __declspec (dllexport)
9+ #else
10+ #define ORYX_CHRON_API __declspec (dllimport)
11+ #endif
12+ #else
13+ #define ORYX_CHRON_API __attribute__ ((visibility(" default" )))
14+ #endif
15+ #else
16+ #define ORYX_CHRON_API
17+ #endif
18+
19+ namespace oryx ::chron {
20+
21+ using Clock = std::chrono::system_clock;
22+ using TimePoint = std::chrono::time_point<Clock>;
23+ using Duration = Clock::duration;
24+
25+ } // namespace oryx::chron
Original file line number Diff line number Diff line change 33#include < cstdint>
44#include < set>
55
6- #include < oryx/chron/details/to_underlying.hpp>
7-
86namespace oryx ::chron::details {
97
108namespace traits {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include " traits.hpp"
4+
5+ namespace oryx ::chron {
6+
7+ class NullMutex {
8+ public:
9+ void lock () noexcept {}
10+ void unlock () noexcept {}
11+ };
12+
13+ static_assert (traits::BasicLockable<NullMutex>);
14+
15+ } // namespace oryx::chron
Original file line number Diff line number Diff line change 11#pragma once
22
3- #include < optional>
43#include < mutex>
4+ #include < string_view>
5+ #include < optional>
6+ #include < functional>
57#include < algorithm>
68
7- #include < oryx/chron/details/null_mutex.hpp>
8-
9+ #include " common.hpp"
910#include " chron_data.hpp"
1011#include " traits.hpp"
12+ #include " null_mutex.hpp"
1113
1214namespace oryx ::chron {
1315
14- struct ExpressionParser {
16+ struct ORYX_CHRON_API ExpressionParser {
1517 auto operator ()(std::string_view cron_expression) const -> std::optional<ChronData>;
1618};
1719
18- template <traits::BasicLockable MutexType = details:: NullMutex>
20+ template <traits::BasicLockable MutexType = NullMutex>
1921class CachedExpressionParser : ExpressionParser {
2022public:
2123 using Pair = std::pair<std::size_t , ChronData>;
You can’t perform that action at this time.
0 commit comments