Skip to content

Commit 6cdac00

Browse files
committed
chore(cmake): standardize variable naming and packaging configuration
1 parent b08e42c commit 6cdac00

11 files changed

+77
-67
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ nfx-datetime is a modern C++20 library providing high-precision temporal operati
4545

4646
### ⚡ Performance Optimized
4747

48-
- Sub-nanosecond arithmetic operations
48+
- High-precision arithmetic operations (100-nanosecond resolution)
4949
- Highly optimized parsing
5050
- Efficient string formatting
5151
- Zero-cost abstractions with constexpr support
@@ -174,7 +174,7 @@ The complete API documentation is available online at:
174174
cmake .. -DCMAKE_BUILD_TYPE=Release -DNFX_DATETIME_BUILD_DOCUMENTATION=ON
175175

176176
# Build the documentation
177-
cmake --build . --target documentation
177+
cmake --build . --target nfx-datetime-documentation
178178
```
179179

180180
#### Requirements
@@ -495,9 +495,11 @@ See the [CHANGELOG.md](CHANGELOG.md) for a detailed history of changes, new feat
495495

496496
This project is licensed under the MIT License.
497497

498-
## Dependencies
498+
## Acknowledgments
499+
500+
- Inspired by .NET's DateTime API design
499501

500-
### Runtime Dependencies
502+
## Dependencies
501503

502504
### Development Dependencies
503505

TODO.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# nfx-datetime TODO
22

3-
- NIL
3+
Project roadmap and task tracking for the nfx-datetime library.
44

55
### Todo
66

7-
- NIL
7+
- [ ] ZonedDateTime Class: Full IANA timezone database support with automatic DST transitions
8+
- [ ] Week Calculations: ISO week number, week of year, US week numbering
9+
- [ ] Custom Format Strings: Strftime-style formatting (e.g., `%Y-%m-%d %H:%M:%S`)
10+
- [ ] Custom Format Parsing: Parse non-ISO 8601 date strings with format specifiers
11+
- [ ] Locale-Aware Formatting: Localized month/day names, date formats per locale
12+
- [ ] Business Day Operations: Add/subtract working days, check if business day
13+
- [ ] Date Ranges: `DateRange` class with iteration and containment checks
14+
- [ ] Age Calculation: Calculate years/months/days between dates with proper handling
15+
- [ ] Stopwatch/Timer: High-precision timing utilities for performance measurement
16+
- [ ] Astronomy Functions: Sunrise/sunset times, moon phases, solstices/equinoxes
17+
- [ ] HTTP Date Headers: RFC 7231 date format parsing and formatting
18+
- [ ] Leap Second Support: TAI time scale, leap second table
19+
- [ ] Fuzzing Tests: Add fuzzing for parser robustness
20+
- [ ] SIMD Optimizations: Vectorize date calculations where applicable
821

922
### In Progress
1023

benchmark/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ endif()
1515
# Benchmarks source files
1616
#----------------------------------------------
1717

18-
set(BENCHMARK_SOURCES)
18+
set(benchmark_sources)
1919

20-
list(APPEND BENCHMARK_SOURCES
20+
list(APPEND benchmark_sources
2121
BM_DateTime.cpp
2222
BM_DateTimeOffset.cpp
2323
BM_TimeSpan.cpp
@@ -27,7 +27,7 @@ list(APPEND BENCHMARK_SOURCES
2727
# Configure benchmark executables
2828
#----------------------------------------------
2929

30-
foreach(benchmark_source ${BENCHMARK_SOURCES})
30+
foreach(benchmark_source ${benchmark_sources})
3131
get_filename_component(benchmark_target_name ${benchmark_source} NAME_WE)
3232
if(NOT TARGET ${benchmark_target_name})
3333
add_executable(${benchmark_target_name} ${benchmark_source})

cmake/nfx-datetime-config.cmake.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ set(NFX_DATETIME_VERSION_PATCH "@PROJECT_VERSION_PATCH@")
2626
set_and_check(NFX_DATETIME_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
2727
set_and_check(NFX_DATETIME_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
2828

29-
# Our library dependencies (none - self-contained library)
30-
3129
# Include the targets file
3230
include("${CMAKE_CURRENT_LIST_DIR}/nfx-datetime-targets.cmake")
3331

cmake/nfxDateTimeDependencies.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# nfx-datetime - Dependencies configuration
33
#==============================================================================
44

5-
#----------------------------
5+
#----------------------------------------------
66
# Output configuration
7-
#----------------------------
7+
#----------------------------------------------
88

99
set(_SAVED_CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET})
1010
set(_SAVED_CMAKE_MESSAGE_LOG_LEVEL ${CMAKE_MESSAGE_LOG_LEVEL})
@@ -83,9 +83,9 @@ if(NFX_DATETIME_BUILD_BENCHMARKS)
8383
endif()
8484
endif()
8585

86-
#----------------------------
86+
#----------------------------------------------
8787
# Dependency fetching
88-
#----------------------------
88+
#----------------------------------------------
8989

9090
if(NFX_DATETIME_BUILD_TESTS)
9191
if(NOT GTest_FOUND)
@@ -99,9 +99,9 @@ if(NFX_DATETIME_BUILD_BENCHMARKS)
9999
endif()
100100
endif()
101101

102-
#----------------------------
102+
#----------------------------------------------
103103
# Cleanup
104-
#----------------------------
104+
#----------------------------------------------
105105

106106
set(CMAKE_REQUIRED_QUIET ${_SAVED_CMAKE_REQUIRED_QUIET})
107107
set(CMAKE_MESSAGE_LOG_LEVEL ${_SAVED_CMAKE_MESSAGE_LOG_LEVEL})

cmake/nfxDateTimeInstall.cmake

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ install(
3939
# Install library targets
4040
#----------------------------------------------
4141

42-
set(INSTALL_TARGETS)
42+
set(install_targets)
4343

4444
if(NFX_DATETIME_BUILD_SHARED)
45-
list(APPEND INSTALL_TARGETS ${PROJECT_NAME})
45+
list(APPEND install_targets ${PROJECT_NAME})
4646
endif()
4747

4848
if(NFX_DATETIME_BUILD_STATIC)
49-
list(APPEND INSTALL_TARGETS ${PROJECT_NAME}-static)
49+
list(APPEND install_targets ${PROJECT_NAME}-static)
5050
endif()
5151

52-
if(INSTALL_TARGETS)
52+
if(install_targets)
5353
install(
54-
TARGETS ${INSTALL_TARGETS}
54+
TARGETS ${install_targets}
5555
EXPORT nfx-datetime-targets
5656
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
5757
COMPONENT Development
@@ -132,11 +132,15 @@ install(
132132
RENAME "LICENSE-${PROJECT_NAME}.txt"
133133
)
134134

135-
install(
136-
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/licenses/"
137-
DESTINATION "${CMAKE_INSTALL_DOCDIR}/licenses"
138-
FILES_MATCHING PATTERN "LICENSE-*"
139-
)
135+
file(GLOB LICENSE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/licenses/LICENSE-*")
136+
foreach(LICENSE_FILE ${LICENSE_FILES})
137+
get_filename_component(LICENSE_NAME ${LICENSE_FILE} NAME)
138+
install(
139+
FILES ${LICENSE_FILE}
140+
DESTINATION "${CMAKE_INSTALL_DOCDIR}/licenses"
141+
RENAME "${LICENSE_NAME}.txt"
142+
)
143+
endforeach()
140144

141145
#----------------------------------------------
142146
# Install documentation
@@ -169,4 +173,4 @@ if(NFX_DATETIME_BUILD_DOCUMENTATION)
169173
endif()
170174
endif()
171175

172-
message(STATUS "Installation configured for targets: ${INSTALL_TARGETS}")
176+
message(STATUS "Installation configured for targets: ${install_targets}")

cmake/nfxDateTimePackaging.cmake

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ endif()
2121

2222
# --- Detect processor count for parallel packaging ---
2323
include(ProcessorCount)
24-
ProcessorCount(N)
25-
if(NOT N EQUAL 0)
26-
set(CPACK_THREADS ${N})
24+
ProcessorCount(processor_count)
25+
if(NOT processor_count EQUAL 0)
26+
set(CPACK_THREADS ${processor_count})
2727
else()
2828
set(CPACK_THREADS 1)
2929
endif()
@@ -90,6 +90,12 @@ set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "nfx-datetime")
9090
# Platform-specific generators
9191
#----------------------------------------------
9292

93+
# --- Find packaging tools ---
94+
if(UNIX AND NOT APPLE)
95+
find_program(DPKG_CMD dpkg)
96+
find_program(RPM_CMD rpm)
97+
endif()
98+
9399
# --- Generators ---
94100
if(NOT DEFINED CPACK_GENERATOR)
95101
set(CPACK_GENERATOR "")
@@ -105,7 +111,6 @@ if(NOT DEFINED CPACK_GENERATOR)
105111

106112
# --- DEB packages ---
107113
if(NFX_DATETIME_PACKAGE_DEB AND UNIX AND NOT APPLE)
108-
find_program(DPKG_CMD dpkg)
109114
if(DPKG_CMD)
110115
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
111116
else()
@@ -115,7 +120,6 @@ if(NOT DEFINED CPACK_GENERATOR)
115120

116121
# --- RPM packages ---
117122
if(NFX_DATETIME_PACKAGE_RPM AND UNIX AND NOT APPLE)
118-
find_program(RPM_CMD rpm)
119123
if(RPM_CMD)
120124
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
121125
else()
@@ -126,25 +130,15 @@ if(NOT DEFINED CPACK_GENERATOR)
126130
# --- WiX packages ---
127131
if(NFX_DATETIME_PACKAGE_WIX AND WIN32)
128132
if(NOT WIX_CANDLE OR NOT WIX_LIGHT)
129-
set(WIX_SEARCH_PATHS
130-
"C:/Program Files (x86)/WiX Toolset v3.14/bin"
131-
"C:/Program Files (x86)/WiX Toolset v3.11/bin"
132-
"C:/Program Files (x86)/WiX Toolset v3.10/bin"
133-
"$ENV{WIX}bin"
134-
)
135-
136-
find_program(WIX_CANDLE NAMES candle.exe candle PATHS ${WIX_SEARCH_PATHS} NO_DEFAULT_PATH)
137-
find_program(WIX_LIGHT NAMES light.exe light PATHS ${WIX_SEARCH_PATHS} NO_DEFAULT_PATH)
133+
find_program(WIX_CANDLE NAMES candle.exe candle HINTS "$ENV{WIX}/bin")
134+
find_program(WIX_LIGHT NAMES light.exe light HINTS "$ENV{WIX}/bin")
138135
endif()
139136

140137
if(WIX_CANDLE AND WIX_LIGHT)
141138
set(CPACK_GENERATOR "${CPACK_GENERATOR};WIX")
142139
message(STATUS "WiX found: ${WIX_CANDLE} - Windows MSI installer generation enabled")
143140
else()
144-
message(STATUS "WiX not found - install WiX Toolset v3.x for MSI installer support")
145-
if(DEFINED WIX_SEARCH_PATHS)
146-
message(STATUS " Searched paths: ${WIX_SEARCH_PATHS}")
147-
endif()
141+
message(STATUS "WiX not found - install WiX Toolset and ensure WIX environment variable is set")
148142
endif()
149143
endif()
150144

@@ -162,13 +156,12 @@ message(STATUS " Output dir: ${CPACK_PACKAGE_DIRECTORY}")
162156

163157
if("DEB" IN_LIST CPACK_GENERATOR AND UNIX AND NOT APPLE)
164158
if(NOT DEFINED CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
165-
find_program(DPKG_CMD dpkg)
166159
if(DPKG_CMD)
167160
execute_process(COMMAND ${DPKG_CMD} --print-architecture
168-
OUTPUT_VARIABLE DETECTED_DEB_ARCH
161+
OUTPUT_VARIABLE detected_deb_arch
169162
OUTPUT_STRIP_TRAILING_WHITESPACE
170163
ERROR_QUIET)
171-
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${DETECTED_DEB_ARCH}")
164+
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${detected_deb_arch}")
172165
endif()
173166
endif()
174167

@@ -178,10 +171,10 @@ endif()
178171
if("RPM" IN_LIST CPACK_GENERATOR AND UNIX AND NOT APPLE)
179172
if(NOT DEFINED CPACK_RPM_PACKAGE_ARCHITECTURE)
180173
execute_process(COMMAND uname -m
181-
OUTPUT_VARIABLE DETECTED_RPM_ARCH
174+
OUTPUT_VARIABLE detected_rpm_arch
182175
OUTPUT_STRIP_TRAILING_WHITESPACE
183176
ERROR_QUIET)
184-
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${DETECTED_RPM_ARCH}")
177+
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${detected_rpm_arch}")
185178
endif()
186179

187180
message(STATUS "RPM package architecture: ${CPACK_RPM_PACKAGE_ARCHITECTURE}")
@@ -194,7 +187,7 @@ endif()
194187
# --- DEB package settings ---
195188
if("DEB" IN_LIST CPACK_GENERATOR AND UNIX AND NOT APPLE)
196189
set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
197-
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
190+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
198191
set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION})
199192
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
200193
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_VENDOR})
@@ -205,9 +198,9 @@ if("DEB" IN_LIST CPACK_GENERATOR AND UNIX AND NOT APPLE)
205198
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})
206199

207200
# --- Core runtime dependencies ---
208-
set(DEB_DEPENDS "libc6, libstdc++6, libgcc-s1")
201+
set(deb_depends "libc6, libstdc++6, libgcc-s1")
209202

210-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${DEB_DEPENDS}")
203+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${deb_depends}")
211204
message(STATUS "DEB dependencies: ${CPACK_DEBIAN_PACKAGE_DEPENDS}")
212205
endif()
213206

@@ -227,9 +220,9 @@ if("RPM" IN_LIST CPACK_GENERATOR AND UNIX AND NOT APPLE)
227220
set(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_HOMEPAGE_URL})
228221

229222
# --- Core runtime dependencies ---
230-
set(RPM_REQUIRES "glibc, libstdc++")
223+
set(rpm_requires "glibc, libstdc++")
231224

232-
set(CPACK_RPM_PACKAGE_REQUIRES "${RPM_REQUIRES}")
225+
set(CPACK_RPM_PACKAGE_REQUIRES "${rpm_requires}")
233226
message(STATUS "RPM dependencies: ${CPACK_RPM_PACKAGE_REQUIRES}")
234227
endif()
235228

cmake/nfxDateTimeSources.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#==============================================================================
44

55
#----------------------------------------------
6-
# Conditional headers and sources
6+
# Source files
77
#----------------------------------------------
88

9-
set(PRIVATE_SOURCES)
9+
set(private_sources)
1010

11-
list(APPEND PRIVATE_SOURCES
11+
list(APPEND private_sources
1212
${NFX_DATETIME_SOURCE_DIR}/DateTime.cpp
1313
${NFX_DATETIME_SOURCE_DIR}/DateTimeOffset.cpp
1414
${NFX_DATETIME_SOURCE_DIR}/TimeSpan.cpp

cmake/nfxDateTimeTargets.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if(NFX_DATETIME_BUILD_SHARED)
1111
add_library(${PROJECT_NAME} SHARED)
1212
target_sources(${PROJECT_NAME}
1313
PRIVATE
14-
${PRIVATE_SOURCES}
14+
${private_sources}
1515
)
1616

1717
set_target_properties(${PROJECT_NAME} PROPERTIES
@@ -27,7 +27,7 @@ if(NFX_DATETIME_BUILD_STATIC)
2727
add_library(${PROJECT_NAME}-static STATIC)
2828
target_sources(${PROJECT_NAME}-static
2929
PRIVATE
30-
${PRIVATE_SOURCES}
30+
${private_sources}
3131
)
3232

3333
set_target_properties(${PROJECT_NAME}-static PROPERTIES

samples/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ endif()
1515
# Samples source files
1616
#----------------------------------------------
1717

18-
set(SAMPLE_SOURCES)
18+
set(sample_sources)
1919

20-
list(APPEND SAMPLE_SOURCES
20+
list(APPEND sample_sources
2121
Sample_DateTime.cpp
2222
)
2323

2424
#----------------------------------------------
2525
# Configure samples executables
2626
#----------------------------------------------
2727

28-
foreach(sample_source ${SAMPLE_SOURCES})
28+
foreach(sample_source ${sample_sources})
2929
get_filename_component(sample_target_name ${sample_source} NAME_WE)
3030

3131
if(NOT TARGET ${sample_target_name})

0 commit comments

Comments
 (0)