Skip to content

Commit 081b650

Browse files
committed
Refactored out codlili to separate library
1 parent 55cb05e commit 081b650

File tree

4 files changed

+65
-317
lines changed

4 files changed

+65
-317
lines changed

arby/CMakeLists.txt

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
include(GNUInstallDirs)
22

3+
CPMFindPackage(
4+
NAME Codlili
5+
GIT_REPOSITORY https://github.com/saxbophone/codlili.git
6+
GIT_TAG master
7+
)
8+
39
add_library(arby STATIC)
410
# ALIAS target to export a namespaced target even when building in-tree
511
add_library(Arby::arby ALIAS arby)
@@ -38,47 +44,46 @@ target_link_libraries(
3844
PRIVATE
3945
$<BUILD_INTERFACE:arby-compiler-options>
4046
)
47+
# link to codlili, using public linkage as we'll need to install its headers too
48+
target_link_libraries(arby PUBLIC Codlili::codlili)
4149

42-
# install if we're not being built as a sub-project
43-
if (NOT ARBY_SUBPROJECT)
44-
# library
45-
install(
46-
TARGETS arby
47-
EXPORT ArbyTargets
48-
# when a static library
49-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
50-
# when a shared library on UNIX
51-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
52-
# when a DLL on Windows
53-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
54-
)
55-
# public headers
56-
install(
57-
DIRECTORY "include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
58-
)
59-
# CMake export
60-
install(
61-
EXPORT ArbyTargets
62-
FILE ArbyTargets.cmake
63-
NAMESPACE Arby::
64-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Arby"
65-
)
66-
# CMake package
67-
include(CMakePackageConfigHelpers)
68-
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
69-
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfig.cmake"
70-
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Arby"
71-
)
72-
# generate the version file for the config file
73-
write_basic_package_version_file(
74-
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfigVersion.cmake"
75-
VERSION "${version}"
76-
COMPATIBILITY SameMinorVersion
77-
)
78-
install(
79-
FILES
80-
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfig.cmake"
81-
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfigVersion.cmake"
82-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Arby"
83-
)
84-
endif()
50+
# library
51+
install(
52+
TARGETS arby
53+
EXPORT ArbyTargets
54+
# when a static library
55+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
56+
# when a shared library on UNIX
57+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
58+
# when a DLL on Windows
59+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
60+
)
61+
# public headers
62+
install(
63+
DIRECTORY "include/" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
64+
)
65+
# CMake export
66+
install(
67+
EXPORT ArbyTargets
68+
FILE ArbyTargets.cmake
69+
NAMESPACE Arby::
70+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Arby"
71+
)
72+
# CMake package
73+
include(CMakePackageConfigHelpers)
74+
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
75+
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfig.cmake"
76+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Arby"
77+
)
78+
# generate the version file for the config file
79+
write_basic_package_version_file(
80+
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfigVersion.cmake"
81+
VERSION "${version}"
82+
COMPATIBILITY SameMinorVersion
83+
)
84+
install(
85+
FILES
86+
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfig.cmake"
87+
"${CMAKE_CURRENT_BINARY_DIR}/ArbyConfigVersion.cmake"
88+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Arby"
89+
)

arby/include/arby/Nat.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <type_traits>
3434
#include <utility>
3535

36-
#include "codlili.hpp"
36+
#include <codlili/list.hpp>
3737

3838

3939
/**
@@ -246,9 +246,9 @@ namespace com::saxbophone::arby {
246246
}
247247
/**
248248
* @overload
249-
* @remarks Overload for constructing from `codlili::List` of digits
249+
* @remarks Overload for constructing from `codlili::list` of digits
250250
*/
251-
constexpr Nat(const codlili::List<StorageType>& digits) : _digits(digits) {
251+
constexpr Nat(const codlili::list<StorageType>& digits) : _digits(digits) {
252252
if (std::empty(digits)) {
253253
throw std::invalid_argument("cannot construct Nat object with empty digits sequence");
254254
}
@@ -900,13 +900,13 @@ namespace com::saxbophone::arby {
900900
/**
901901
* @returns a copy of the underlying digits that make up this Nat value
902902
*/
903-
constexpr codlili::List<StorageType> digits() const {
903+
constexpr codlili::list<StorageType> digits() const {
904904
return _digits;
905905
}
906906
private:
907907
std::string _stringify_for_base(std::uint8_t base) const;
908908

909-
codlili::List<StorageType> _digits;
909+
codlili::list<StorageType> _digits;
910910
};
911911

912912
/**

arby/include/arby/codlili.hpp

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

0 commit comments

Comments
 (0)