Skip to content

Commit 56b2265

Browse files
committed
Rename nesfolly to folly / Remove Boost
1 parent 67acf5b commit 56b2265

File tree

10 files changed

+290
-18
lines changed

10 files changed

+290
-18
lines changed

vcpkg-registry/ports/nesfolly/portfile.cmake renamed to vcpkg-registry/ports/folly/portfile.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ vcpkg_from_github(
77
nesfolly.patch
88
arm-compilation.patch
99
follyconfig.patch
10-
malloc.patch
10+
remove-boost.patch
1111
)
1212

1313
vcpkg_cmake_configure(
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index a44ca977a..4e9ccab83 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -1,17 +1,14 @@
6+
cmake_minimum_required(VERSION 3.21)
7+
-project(nesfolly)
8+
+project(folly)
9+
10+
set(CMAKE_CXX_STANDARD 20)
11+
12+
-# Currently there is a dependency on BOOST-MPL
13+
-find_package(Boost REQUIRED)
14+
-
15+
configure_file(
16+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly-config.h.cmake
17+
${CMAKE_CURRENT_BINARY_DIR}/config/folly/folly-config.h
18+
)
19+
20+
-add_library(nesfolly
21+
+add_library(folly
22+
folly/SharedMutex.cpp
23+
folly/ScopeGuard.cpp
24+
folly/concurrency/CacheLocality.cpp
25+
@@ -32,12 +29,12 @@ add_library(nesfolly
26+
folly/Executor.cpp
27+
folly/portability/SysMembarrier.cpp
28+
folly/memory/MallctlHelper.cpp
29+
+ folly/memory/detail/MallocImpl.cpp
30+
)
31+
32+
-target_compile_features(nesfolly PRIVATE cxx_std_20)
33+
+target_compile_features(folly PRIVATE cxx_std_20)
34+
35+
-target_include_directories(nesfolly PUBLIC
36+
- ${Boost_INCLUDE_DIRS}
37+
+target_include_directories(folly PUBLIC
38+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
39+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/config>)
40+
41+
@@ -71,7 +68,7 @@ install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets # create export s
42+
)
43+
# Install Export Set
44+
install(EXPORT ${PROJECT_NAME}-targets
45+
- NAMESPACE nesfolly::
46+
+ NAMESPACE folly::
47+
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
48+
49+
50+
diff --git a/cmake/config.cmake b/cmake/config.cmake
51+
index 29a8021e9..0e267af7f 100644
52+
--- a/cmake/config.cmake
53+
+++ b/cmake/config.cmake
54+
@@ -1,5 +1,5 @@
55+
@PACKAGE_INIT@
56+
57+
-include(${CMAKE_CURRENT_LIST_DIR}/nesfolly-targets.cmake)
58+
+include(${CMAKE_CURRENT_LIST_DIR}/folly-targets.cmake)
59+
60+
-check_required_components(nesfolly)
61+
+check_required_components(folly)
62+
diff --git a/folly/container/Access.h b/folly/container/Access.h
63+
index 50c948f85..35e5d8670 100644
64+
--- a/folly/container/Access.h
65+
+++ b/folly/container/Access.h
66+
@@ -88,14 +88,14 @@ FOLLY_INLINE_VARIABLE constexpr data_fn data{};
67+
// begin
68+
//
69+
// Invokes unqualified begin with std::begin in scope.
70+
-FOLLY_CREATE_FREE_INVOKER(begin_fn, begin, std);
71+
-FOLLY_INLINE_VARIABLE constexpr begin_fn begin{};
72+
+// FOLLY_CREATE_FREE_INVOKER(begin_fn, begin, std);
73+
+// FOLLY_INLINE_VARIABLE constexpr begin_fn begin{};
74+
75+
// end
76+
//
77+
// Invokes unqualified end with std::end in scope.
78+
-FOLLY_CREATE_FREE_INVOKER(end_fn, end, std);
79+
-FOLLY_INLINE_VARIABLE constexpr end_fn end{};
80+
+// FOLLY_CREATE_FREE_INVOKER(end_fn, end, std);
81+
+// FOLLY_INLINE_VARIABLE constexpr end_fn end{};
82+
83+
} // namespace access
84+
85+
diff --git a/folly/container/Foreach-inl.h b/folly/container/Foreach-inl.h
86+
index d6b709502..ec38285fb 100644
87+
--- a/folly/container/Foreach-inl.h
88+
+++ b/folly/container/Foreach-inl.h
89+
@@ -98,14 +98,14 @@ struct IsTuple<EnableIfTuple<T>, T> : std::true_type {};
90+
/**
91+
* Check if the sequence is a range
92+
*/
93+
-template <typename Type, typename T = typename std::decay<Type>::type>
94+
-using EnableIfRange = void_t<
95+
- decltype(access::begin(std::declval<T&>())),
96+
- decltype(access::end(std::declval<T&>()))>;
97+
-template <typename, typename T>
98+
-struct IsRange : std::false_type {};
99+
-template <typename T>
100+
-struct IsRange<EnableIfRange<T>, T> : std::true_type {};
101+
+// template <typename Type, typename T = typename std::decay<Type>::type>
102+
+// using EnableIfRange = void_t<
103+
+// decltype(access::begin(std::declval<T&>())),
104+
+// decltype(access::end(std::declval<T&>()))>;
105+
+// template <typename, typename T>
106+
+// struct IsRange : std::false_type {};
107+
+// template <typename T>
108+
+// struct IsRange<EnableIfRange<T>, T> : std::true_type {};
109+
110+
struct TupleTag {};
111+
struct RangeTag {};
112+
@@ -114,8 +114,7 @@ struct RangeTag {};
113+
* Should ideally check if it is a tuple and if not return void, but msvc fails
114+
*/
115+
template <typename Sequence>
116+
-using SequenceTag =
117+
- std::conditional_t<IsRange<void, Sequence>::value, RangeTag, TupleTag>;
118+
+using SequenceTag = TupleTag;
119+
120+
struct BeginAddTag {};
121+
struct IndexingTag {};
122+
@@ -153,41 +152,41 @@ LoopControl invoke_returning_loop_control(Func&& f, Args&&... a) {
123+
/**
124+
* Implementations for the runtime function
125+
*/
126+
-template <typename Sequence, typename Func>
127+
-void for_each_range_impl(index_constant<3>, Sequence&& range, Func& func) {
128+
- auto first = access::begin(range);
129+
- auto last = access::end(range);
130+
- for (auto index = std::size_t{0}; first != last; ++index) {
131+
- auto next = std::next(first);
132+
- auto control = invoke_returning_loop_control(func, *first, index, first);
133+
- if (loop_break == control) {
134+
- break;
135+
- }
136+
- first = next;
137+
- }
138+
-}
139+
-template <typename Sequence, typename Func>
140+
-void for_each_range_impl(index_constant<2>, Sequence&& range, Func& func) {
141+
- // make a three arg adaptor for the function passed in so that the main
142+
- // implementation function can be used
143+
- auto three_arg_adaptor = [&func](
144+
- auto&& ele, auto index, auto) -> decltype(auto) {
145+
- return func(std::forward<decltype(ele)>(ele), index);
146+
- };
147+
- for_each_range_impl(
148+
- index_constant<3>{}, std::forward<Sequence>(range), three_arg_adaptor);
149+
-}
150+
-
151+
-template <typename Sequence, typename Func>
152+
-void for_each_range_impl(index_constant<1>, Sequence&& range, Func& func) {
153+
- // make a three argument adaptor for the function passed in that just ignores
154+
- // the second and third argument
155+
- auto three_arg_adaptor = [&func](auto&& ele, auto, auto) -> decltype(auto) {
156+
- return func(std::forward<decltype(ele)>(ele));
157+
- };
158+
- for_each_range_impl(
159+
- index_constant<3>{}, std::forward<Sequence>(range), three_arg_adaptor);
160+
-}
161+
+// template <typename Sequence, typename Func>
162+
+// void for_each_range_impl(index_constant<3>, Sequence&& range, Func& func) {
163+
+// auto first = access::begin(range);
164+
+// auto last = access::end(range);
165+
+// for (auto index = std::size_t{0}; first != last; ++index) {
166+
+// auto next = std::next(first);
167+
+// auto control = invoke_returning_loop_control(func, *first, index, first);
168+
+// if (loop_break == control) {
169+
+// break;
170+
+// }
171+
+// first = next;
172+
+// }
173+
+// }
174+
+// template <typename Sequence, typename Func>
175+
+// void for_each_range_impl(index_constant<2>, Sequence&& range, Func& func) {
176+
+// // make a three arg adaptor for the function passed in so that the main
177+
+// // implementation function can be used
178+
+// auto three_arg_adaptor = [&func](
179+
+// auto&& ele, auto index, auto) -> decltype(auto) {
180+
+// return func(std::forward<decltype(ele)>(ele), index);
181+
+// };
182+
+// for_each_range_impl(
183+
+// index_constant<3>{}, std::forward<Sequence>(range), three_arg_adaptor);
184+
+// }
185+
+//
186+
+// template <typename Sequence, typename Func>
187+
+// void for_each_range_impl(index_constant<1>, Sequence&& range, Func& func) {
188+
+// // make a three argument adaptor for the function passed in that just ignores
189+
+// // the second and third argument
190+
+// auto three_arg_adaptor = [&func](auto&& ele, auto, auto) -> decltype(auto) {
191+
+// return func(std::forward<decltype(ele)>(ele));
192+
+// };
193+
+// for_each_range_impl(
194+
+// index_constant<3>{}, std::forward<Sequence>(range), three_arg_adaptor);
195+
+// }
196+
197+
/**
198+
* Handlers for iteration
199+
@@ -260,40 +259,40 @@ void for_each_impl(TupleTag, Sequence&& range, Func& func) {
200+
static_assert(!std::is_same<tag, void>::value, "unknown invocability");
201+
for_each_tuple_impl(tag{}, std::forward<Sequence>(range), func);
202+
}
203+
-template <typename Sequence, typename Func>
204+
-void for_each_impl(RangeTag, Sequence&& range, Func& func) {
205+
- using iter = decltype(access::begin(std::declval<Sequence>()));
206+
- using type = decltype(*std::declval<iter>());
207+
- using tag = ForEachImplTag<Func, type, iter>;
208+
- static_assert(!std::is_same<tag, void>::value, "unknown invocability");
209+
- for_each_range_impl(tag{}, std::forward<Sequence>(range), func);
210+
-}
211+
-
212+
+// template <typename Sequence, typename Func>
213+
+// void for_each_impl(RangeTag, Sequence&& range, Func& func) {
214+
+// using iter = decltype(access::begin(std::declval<Sequence>()));
215+
+// using type = decltype(*std::declval<iter>());
216+
+// using tag = ForEachImplTag<Func, type, iter>;
217+
+// static_assert(!std::is_same<tag, void>::value, "unknown invocability");
218+
+// for_each_range_impl(tag{}, std::forward<Sequence>(range), func);
219+
+// }
220+
+//
221+
template <typename Sequence, typename Index>
222+
decltype(auto) fetch_impl(IndexingTag, Sequence&& sequence, Index&& index) {
223+
return std::forward<Sequence>(sequence)[std::forward<Index>(index)];
224+
}
225+
-template <typename Sequence, typename Index>
226+
-decltype(auto) fetch_impl(BeginAddTag, Sequence&& sequence, Index index) {
227+
- return *(access::begin(std::forward<Sequence>(sequence)) + index);
228+
-}
229+
+// template <typename Sequence, typename Index>
230+
+// decltype(auto) fetch_impl(BeginAddTag, Sequence&& sequence, Index index) {
231+
+// return *(access::begin(std::forward<Sequence>(sequence)) + index);
232+
+// }
233+
234+
template <typename Sequence, typename Index>
235+
decltype(auto) fetch_impl(TupleTag, Sequence&& sequence, Index index) {
236+
return get_impl<index>(std::forward<Sequence>(sequence));
237+
}
238+
-template <typename Sequence, typename Index>
239+
-decltype(auto) fetch_impl(RangeTag, Sequence&& sequence, Index&& index) {
240+
- using iter = decltype(access::begin(std::declval<Sequence>()));
241+
- using iter_traits = std::iterator_traits<remove_cvref_t<iter>>;
242+
- using iter_cat = typename iter_traits::iterator_category;
243+
- using tag = std::conditional_t<
244+
- std::is_same<iter_cat, std::random_access_iterator_tag>::value,
245+
- BeginAddTag,
246+
- IndexingTag>;
247+
- return fetch_impl(
248+
- tag{}, std::forward<Sequence>(sequence), std::forward<Index>(index));
249+
-}
250+
+// template <typename Sequence, typename Index>
251+
+// decltype(auto) fetch_impl(RangeTag, Sequence&& sequence, Index&& index) {
252+
+// using iter = decltype(access::begin(std::declval<Sequence>()));
253+
+// using iter_traits = std::iterator_traits<remove_cvref_t<iter>>;
254+
+// using iter_cat = typename iter_traits::iterator_category;
255+
+// using tag = std::conditional_t<
256+
+// std::is_same<iter_cat, std::random_access_iterator_tag>::value,
257+
+// BeginAddTag,
258+
+// IndexingTag>;
259+
+// return fetch_impl(
260+
+// tag{}, std::forward<Sequence>(sequence), std::forward<Index>(index));
261+
+// }
262+
263+
} // namespace for_each_detail
264+
265+
diff --git a/folly/functional/Invoke.h b/folly/functional/Invoke.h
266+
index f94435605..87adbf4e2 100644
267+
--- a/folly/functional/Invoke.h
268+
+++ b/folly/functional/Invoke.h
269+
@@ -19,11 +19,11 @@
270+
#include <functional>
271+
#include <type_traits>
272+
273+
-#include <boost/preprocessor/control/expr_iif.hpp>
274+
-#include <boost/preprocessor/facilities/is_empty_variadic.hpp>
275+
-#include <boost/preprocessor/list/for_each.hpp>
276+
-#include <boost/preprocessor/logical/not.hpp>
277+
-#include <boost/preprocessor/tuple/to_list.hpp>
278+
+// #include <boost/preprocessor/control/expr_iif.hpp>
279+
+// #include <boost/preprocessor/facilities/is_empty_variadic.hpp>
280+
+// #include <boost/preprocessor/list/for_each.hpp>
281+
+// #include <boost/preprocessor/logical/not.hpp>
282+
+// #include <boost/preprocessor/tuple/to_list.hpp>
283+
284+
#include <folly/CppAttributes.h>
285+
#include <folly/Portability.h>
286+

vcpkg-registry/ports/nesfolly/vcpkg.json renamed to vcpkg-registry/ports/folly/vcpkg.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
2-
"name": "nesfolly",
2+
"name": "folly",
33
"version-string": "2021.10.11.00",
44
"description": "An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows",
55
"homepage": "https://github.com/facebook/folly",
66
"supports": "x64 | (arm64 & !windows)",
77
"dependencies": [
8-
"boost-mpl",
98
{
109
"name": "vcpkg-cmake",
1110
"host": true

vcpkg-registry/ports/nesfolly/malloc.patch

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

vcpkg-registry/versions/baseline.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"default": {
3-
"nesfolly": { "baseline": "2021.10.11.00", "port-version": 0 },
3+
"folly": { "baseline": "2021.10.11.00", "port-version": 0 },
44
"jemalloc-nes": { "baseline": "5.2.1", "port-version": 0 },
55
"oatpp": { "baseline": "1.3.0", "port-version": 0 }
66
}
File renamed without changes.

vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"benchmark",
2222
"antlr4",
2323
"spdlog",
24-
"nesfolly",
24+
"folly",
2525
"jemalloc-nes",
2626
"simdjson",
2727
"oatpp",

0 commit comments

Comments
 (0)