Skip to content

Commit de225a0

Browse files
authored
[v3.1.4] from_file(): Resolve symlinks (#17)
* Improve CMake * [v3.1.4] `from_file()`: Resolve symlinks
1 parent 424bad3 commit de225a0

File tree

20 files changed

+74
-60
lines changed

20 files changed

+74
-60
lines changed

.clang-format

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ AllowShortIfStatementsOnASingleLine: Always
1818
AllowShortLoopsOnASingleLine: true
1919
IndentRequires: true
2020
IncludeCategories:
21-
# Headers in <> with .h extension.
22-
- Regex: '<([A-Za-z0-9\/-_])+\.h>'
21+
# Headers in "" with a file extension.
22+
- Regex: '"([A-Za-z0-9\/-_])+\..*"'
2323
Priority: 10
24-
# Headers in <> with .hpp extension.
25-
- Regex: '<([A-Za-z0-9\/-_])+\.hpp>'
24+
# Headers in <> with a file extension.
25+
- Regex: '<([A-Za-z0-9\/-_])+\..*>'
2626
Priority: 20
27-
# Headers in <> without extension.
27+
# Headers in <> without a file extension.
2828
- Regex: '<([A-Za-z0-9\/-_])+>'
2929
Priority: 30
3030
PointerAlignment: Left

.clang-tidy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
Checks: 'clang-analyzer-*,
33
concurrency-*,
44
cppcoreguidelines-*,
5-
-cppcoreguidelines-non-private-member-variables-in-classes,
5+
-cppcoreguidelines-avoid-do-while,
66
-cppcoreguidelines-avoid-magic-numbers,
77
-cppcoreguidelines-avoid-const-or-ref-data-members,
8-
-cppcoreguidelines-avoid-do-while,
8+
-cppcoreguidelines-non-private-member-variables-in-classes,
99
misc-*,
1010
-misc-non-private-member-variables-in-classes,
1111
-misc-no-recursion,
1212
modernize-*,
13+
-modernize-use-trailing-return-type,
1314
performance-*,
1415
portability-*,
1516
readability-*,

.editorconfig

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
[*]
22
insert_final_newline = true
33
charset = utf-8
4-
indent_size = 4
5-
indent_style = tab
6-
# Optional: git will commit as lf, this will only affect local files
7-
end_of_line = lf
8-
9-
[*.{py,md,yml,sh,cmake,json}]
10-
indent_style = space
11-
indent_size = 2
12-
13-
[*.{py,md,yml,sh,cmake,json}.in]
144
indent_style = space
155
indent_size = 2
6+
# Optional: git will commit as lf, this will only affect local files
7+
end_of_line = lf
168

17-
[CMakeLists.txt]
18-
indent_style = space
19-
indent_size = 2
9+
[*.{hpp,cpp}]
10+
indent_style = tab
11+
indent_size = 4

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
uname -m
6161
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 10
6262
- name: configure
63-
run: cmake -S . --preset=ninja-gcc -B build -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
63+
run: cmake -S . --preset=ninja-gcc -B build
6464
- name: build debug
6565
run: cmake --build build --config=Debug -- -v
6666
- name: build release

CMakeLists.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
66
set(CMAKE_DEBUG_POSTFIX "-d")
77

88
include(version.cmake)
9+
set(package_name djson)
910

10-
project(djson VERSION ${djson_version})
11+
project(${package_name} VERSION ${djson_version})
1112

1213
option(DJ_INSTALL "Setup djson install" ${PROJECT_IS_TOP_LEVEL})
1314
option(DJ_BUILD_TESTS "Build djson tests" ${PROJECT_IS_TOP_LEVEL})
@@ -16,6 +17,26 @@ configure_file(Doxyfile.in Doxyfile @ONLY)
1617

1718
add_subdirectory(lib)
1819

20+
if(DJ_INSTALL)
21+
message(STATUS "[${package_name}] setting up install")
22+
include(GNUInstallDirs)
23+
24+
set(install_dst "${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}")
25+
26+
install(
27+
TARGETS ${package_name}
28+
EXPORT ${package_name}-targets
29+
FILE_SET HEADERS
30+
)
31+
32+
install(
33+
EXPORT ${package_name}-targets
34+
DESTINATION "${install_dst}"
35+
NAMESPACE ${package_name}::
36+
FILE ${package_name}-config.cmake
37+
)
38+
endif()
39+
1940
if(DJ_BUILD_TESTS)
2041
enable_testing()
2142
add_subdirectory(tests)

config.cmake.in

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

install_test/exe/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <djson/build_version.hpp>
1+
#include "djson/build_version.hpp"
22
#include <print>
33

44
auto main() -> int { std::println("djson version: {}", dj::build_version_v); }

lib/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,3 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_23)
2929
target_link_libraries(${PROJECT_NAME} PRIVATE
3030
$<$<BOOL:${MINGW}>:stdc++exp>
3131
)
32-
33-
if(DJ_INSTALL)
34-
message(STATUS "[djson] setting up install")
35-
include(GNUInstallDirs)
36-
37-
install(
38-
TARGETS djson
39-
EXPORT djson-targets
40-
FILE_SET HEADERS
41-
)
42-
43-
install(
44-
EXPORT djson-targets
45-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/djson"
46-
NAMESPACE djson::
47-
FILE djson-config.cmake
48-
)
49-
endif()

lib/include/djson/error.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
2-
#include <djson/src_loc.hpp>
2+
#include "djson/src_loc.hpp"
33
#include <string>
44

55
namespace dj {

lib/include/djson/json.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
2-
#include <djson/error.hpp>
3-
#include <djson/string_table.hpp>
2+
#include "djson/error.hpp"
3+
#include "djson/string_table.hpp"
44
#include <expected>
55
#include <format>
66
#include <memory>

0 commit comments

Comments
 (0)