Skip to content

Commit

Permalink
style: apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Guekka authored and github-actions[bot] committed Aug 19, 2023
1 parent c23f03c commit 7192b78
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 89 deletions.
34 changes: 17 additions & 17 deletions cmake/ports/flux/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH
SOURCE_PATH
REPO
tcbrindle/flux
REF
caa30bd4925d25f5bfed7973e265e8eb142d909d
SHA512
bcaf31df73aca84afdfaafb54afb5bdcf34cf299c575a636c1d05c4ec00b33fada4b18137dd21532e7de129f92c6fa628f031de1a53a95731180ec79f9b71b57
HEAD_REF
main)
OUT_SOURCE_PATH
SOURCE_PATH
REPO
tcbrindle/flux
REF
caa30bd4925d25f5bfed7973e265e8eb142d909d
SHA512
bcaf31df73aca84afdfaafb54afb5bdcf34cf299c575a636c1d05c4ec00b33fada4b18137dd21532e7de129f92c6fa628f031de1a53a95731180ec79f9b71b57
HEAD_REF
main)

# Copy header files
file(
INSTALL ${SOURCE_PATH}/include
DESTINATION ${CURRENT_PACKAGES_DIR}
FILES_MATCHING
PATTERN "*.hpp")
INSTALL ${SOURCE_PATH}/include
DESTINATION ${CURRENT_PACKAGES_DIR}
FILES_MATCHING
PATTERN "*.hpp")

file(
INSTALL "${SOURCE_PATH}/LICENSE_1_0.txt"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)
INSTALL "${SOURCE_PATH}/LICENSE_1_0.txt"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)
33 changes: 17 additions & 16 deletions cmake/ports/mpsc-channel/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH
SOURCE_PATH
REPO
Guekka/mpsc-channel-in-cxx
REF
f71892e19ca647dd2cb4fbc24617a8945092a2d8
SHA512
b1537446cc16f69131ff3218e9210067540a5b5ace029fe4d362c7a15a7d8d91dd73b3eef9231296838b26e7151932dacbfc951db2c77a0d67dc2b7c0538d239
HEAD_REF
main)
OUT_SOURCE_PATH
SOURCE_PATH
REPO
Guekka/mpsc-channel-in-cxx
REF
f71892e19ca647dd2cb4fbc24617a8945092a2d8
SHA512
b1537446cc16f69131ff3218e9210067540a5b5ace029fe4d362c7a15a7d8d91dd73b3eef9231296838b26e7151932dacbfc951db2c77a0d67dc2b7c0538d239
HEAD_REF
main)

vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DBUILD_TESTING=OFF
${FEATURE_OPTIONS})
${FEATURE_OPTIONS})
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME mpsc-channel CONFIG_PATH "lib/cmake/mpsc_channel")
vcpkg_cmake_config_fixup(PACKAGE_NAME mpsc-channel CONFIG_PATH
"lib/cmake/mpsc_channel")

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share)
${CURRENT_PACKAGES_DIR}/debug/share)

file(
INSTALL "${SOURCE_PATH}/LICENSE"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)
INSTALL "${SOURCE_PATH}/LICENSE"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)
12 changes: 6 additions & 6 deletions include/btu/bsa/archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ enum class Compression
};

template<class... Keys>
requires requires(Keys... keys) { (std::string(keys.name()), ...); }
requires requires(Keys... keys)
{
(std::string(keys.name()), ...);
}
[[nodiscard]] auto virtual_to_local_path(Keys &&...a_keys) noexcept -> std::u8string
{
std::u8string local;
Expand Down Expand Up @@ -58,11 +61,8 @@ class File final
[[nodiscard]] auto size() const noexcept -> size_t;

template<typename T>
requires btu::common::is_variant_member_v<T, UnderlyingFile>
[[nodiscard]] auto as_raw_file() &&
{
return std::get<T>(std::move(file_));
}
requires btu::common::is_variant_member_v<T, UnderlyingFile>
[[nodiscard]] auto as_raw_file() && { return std::get<T>(std::move(file_)); }

private:
ArchiveVersion ver_;
Expand Down
36 changes: 18 additions & 18 deletions include/btu/bsa/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,24 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Settings,
sets.plugin_extensions = {u8".esl", u8".esm", u8".esp"};
sets.s_dummy_plugin = std::vector(std::begin(dummy::sse), std::end(dummy::sse));
sets.standard_files = {
AllowedPath{u8".bgem", {u8"materials"}},
AllowedPath{u8".bgsm", {u8"materials"}},
AllowedPath{u8".bto", {u8"meshes"}},
AllowedPath{u8".btr", {u8"meshes"}},
AllowedPath{u8".btt", {u8"meshes"}},
AllowedPath{u8".cgid", {u8"grass"}},
AllowedPath{u8".dlodsettings", {u8"lodsettings"}},
AllowedPath{u8".dtl", {u8"meshes"}}, // Unsure
AllowedPath{u8".egm", {u8"meshes"}}, // Unsure
AllowedPath{u8".jpg", {u8"root"}},
AllowedPath{u8".hkb", {u8"meshes"}},
AllowedPath{u8".hkb", {u8"meshes"}},
AllowedPath{u8".hkx", {u8"meshes"}},
AllowedPath{u8".lst", {u8"meshes"}},
AllowedPath{u8".nif", {u8"meshes"}},
AllowedPath{u8".psc", {u8"scripts", u8"source"}},
AllowedPath{u8".tga", {u8"textures"}},
AllowedPath{u8".tri", {u8"meshes"}},
AllowedPath{u8".bgem", {u8"materials"}},
AllowedPath{u8".bgsm", {u8"materials"}},
AllowedPath{u8".bto", {u8"meshes"}},
AllowedPath{u8".btr", {u8"meshes"}},
AllowedPath{u8".btt", {u8"meshes"}},
AllowedPath{u8".cgid", {u8"grass"}},
AllowedPath{u8".dlodsettings", {u8"lodsettings"}},
AllowedPath{u8".dtl", {u8"meshes"}}, // Unsure
AllowedPath{u8".egm", {u8"meshes"}}, // Unsure
AllowedPath{u8".jpg", {u8"root"}},
AllowedPath{u8".hkb", {u8"meshes"}},
AllowedPath{u8".hkb", {u8"meshes"}},
AllowedPath{u8".hkx", {u8"meshes"}},
AllowedPath{u8".lst", {u8"meshes"}},
AllowedPath{u8".nif", {u8"meshes"}},
AllowedPath{u8".psc", {u8"scripts", u8"source"}},
AllowedPath{u8".tga", {u8"textures"}},
AllowedPath{u8".tri", {u8"meshes"}},
};
sets.texture_files = {
AllowedPath{u8".dds", {u8"textures", u8"interface"}},
Expand Down
12 changes: 6 additions & 6 deletions include/btu/common/functional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct bind_back_fn_

template<typename... CallArgs>
constexpr std::invoke_result_t<Fn, CallArgs..., Args...> //
operator()(CallArgs &&...cargs) && noexcept(std::is_nothrow_invocable_v<Fn, CallArgs..., Args...>)
operator()(CallArgs &&...cargs) &&noexcept(std::is_nothrow_invocable_v<Fn, CallArgs..., Args...>)
{
return tuple_apply(
[&](auto &&fn, auto &&...args) -> decltype(auto) {
Expand All @@ -55,7 +55,7 @@ struct bind_back_fn_

/// \overload
template<typename... CallArgs>
constexpr std::invoke_result_t<Fn &, CallArgs..., Args &...> operator()(CallArgs &&...cargs) & noexcept(
constexpr std::invoke_result_t<Fn &, CallArgs..., Args &...> operator()(CallArgs &&...cargs) &noexcept(
std::is_nothrow_invocable_v<Fn &, CallArgs..., Args &...>)
{
return tuple_apply([&](auto &fn, auto &...args)
Expand Down Expand Up @@ -145,7 +145,7 @@ struct bind_back_fn_<Fn, Arg0, Arg1>
template<typename... CallArgs>
constexpr std::invoke_result_t<Fn const &, CallArgs..., Arg0 const &, Arg1 const &> operator()(
CallArgs &&...cargs)
const & noexcept(std::is_nothrow_invocable_v<Fn const &, CallArgs..., Arg0 const &, Arg1 const &>)
const &noexcept(std::is_nothrow_invocable_v<Fn const &, CallArgs..., Arg0 const &, Arg1 const &>)
{
return invoke(fn_args_.fn_, (CallArgs &&) cargs..., fn_args_.arg0_, fn_args_.arg1_);
}
Expand Down Expand Up @@ -174,7 +174,7 @@ template<class Func, class Arg>
concept invocable_l_or_r = std::invocable<Func, Arg &> || std::invocable<Func, Arg &&>;

template<typename Range, typename Func>
requires std::ranges::input_range<Range> && invocable_l_or_r<Func, std::ranges::range_value_t<Range>>
requires std::ranges::input_range<Range> && invocable_l_or_r<Func, std::ranges::range_value_t<Range>>
auto for_each_mt(Range &&rng, Func &&func)
{
auto eptr = std::exception_ptr{};
Expand Down Expand Up @@ -226,8 +226,8 @@ auto for_each_mt(Range &&rng, Func &&func)
*/

template<typename Out, typename Range, typename Func>
[[nodiscard]] auto make_producer_mt(Range &&rng, Func &&func)
requires std::ranges::input_range<Range> && invocable_l_or_r<Func, std::ranges::range_value_t<Range>>
[[nodiscard]] auto make_producer_mt(Range &&rng, Func &&func) requires
std::ranges::input_range<Range> && invocable_l_or_r<Func, std::ranges::range_value_t<Range>>
{
auto channel = mpsc::Channel<Out>::make();
auto sender = std::get<0>(channel);
Expand Down
8 changes: 4 additions & 4 deletions include/btu/common/metaprogramming.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ template<class... Ts>
overload(Ts...) -> overload<Ts...>;

template<typename E>
requires std::is_enum_v<E>
requires std::is_enum_v<E>
constexpr auto to_underlying(E e) -> std::underlying_type_t<E>
{
return static_cast<std::underlying_type_t<E>>(e);
Expand Down Expand Up @@ -91,13 +91,13 @@ template<class T, class U>

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage): we need it to generate code
#define BETHUTIL_MAKE_ENUM_OPERATOR_PAIR(a_type, a_op) \
[[nodiscard]] constexpr auto operator a_op(a_type a_lhs, a_type a_rhs) noexcept -> a_type \
[[nodiscard]] constexpr auto operator a_op(a_type a_lhs, a_type a_rhs) noexcept->a_type \
{ \
return static_cast<a_type>(static_cast<std::underlying_type_t<a_type>>(a_lhs) \
a_op static_cast<std::underlying_type_t<a_type>>(a_rhs)); \
} \
\
constexpr auto operator a_op##=(a_type &a_lhs, a_type a_rhs) noexcept -> a_type & \
constexpr auto operator a_op##=(a_type &a_lhs, a_type a_rhs) noexcept->a_type & \
{ \
return a_lhs = a_lhs a_op a_rhs; \
}
Expand All @@ -106,7 +106,7 @@ template<class T, class U>
#define BETHUTIL_MAKE_ALL_ENUM_OPERATORS(a_type) \
static_assert(std::is_enum_v<a_type>, "\'" #a_type "\' is not an enum"); \
\
[[nodiscard]] constexpr auto operator~(a_type a_val) noexcept -> a_type \
[[nodiscard]] constexpr auto operator~(a_type a_val) noexcept->a_type \
{ \
return static_cast<a_type>(~static_cast<std::underlying_type_t<a_type>>(a_val)); \
} \
Expand Down
4 changes: 2 additions & 2 deletions include/btu/hkx/anim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class AnimExeInfo
[[nodiscard]] virtual constexpr auto output_file_name() const noexcept -> std::string_view = 0;
[[nodiscard]] virtual constexpr auto target_game() const noexcept -> btu::Game = 0;

[[nodiscard]] virtual auto get_required_files(const Path &exe_dir) const noexcept -> std::vector<Path>
= 0;
[[nodiscard]] virtual auto get_required_files(const Path &exe_dir) const noexcept
-> std::vector<Path> = 0;
[[nodiscard]] virtual auto get_full_args(const Path &exe_dir) const -> std::vector<std::string> = 0;

[[nodiscard]] virtual auto is_os_supported() const noexcept -> bool = 0;
Expand Down
19 changes: 10 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ set(HEADER_FILES
"${INCLUDE_DIR}/btu/bsa/detail/archive_type.hpp"
"${INCLUDE_DIR}/btu/esp/error_code.hpp"
"${INCLUDE_DIR}/btu/esp/functions.hpp"
"${INCLUDE_DIR}/btu/hkx/anim.hpp"
"${INCLUDE_DIR}/btu/hkx/error_code.hpp"
"${INCLUDE_DIR}/btu/hkx/anim.hpp"
"${INCLUDE_DIR}/btu/hkx/error_code.hpp"
"${INCLUDE_DIR}/btu/modmanager/mod_folder.hpp"
"${INCLUDE_DIR}/btu/modmanager/mod_manager.hpp"
"${INCLUDE_DIR}/btu/nif/detail/common.hpp"
Expand All @@ -35,8 +35,8 @@ set(HEADER_FILES
"${INCLUDE_DIR}/btu/tex/optimize.hpp"
"${INCLUDE_DIR}/btu/tex/texture.hpp"
"${INCLUDE_DIR}/btu/tex/detail/common.hpp"
"${INCLUDE_DIR}/btu/tex/detail/formats_string.hpp"
../include/btu/common/json.hpp)
"${INCLUDE_DIR}/btu/tex/detail/formats_string.hpp"
../include/btu/common/json.hpp)

set(SOURCE_DIR "${ROOT_DIR}/src")
set(SOURCE_FILES
Expand All @@ -47,7 +47,7 @@ set(SOURCE_FILES
"${SOURCE_DIR}/bsa/unpack.cpp"
"${SOURCE_DIR}/bsa/detail/archive_type.cpp"
"${SOURCE_DIR}/esp/functions.cpp"
"${SOURCE_DIR}/hkx/anim.cpp"
"${SOURCE_DIR}/hkx/anim.cpp"
"${SOURCE_DIR}/modmanager/mod_folder.cpp"
"${SOURCE_DIR}/modmanager/mod_manager.cpp"
"${SOURCE_DIR}/nif/functions.cpp"
Expand Down Expand Up @@ -94,7 +94,8 @@ find_package(bc7enc CONFIG REQUIRED)
target_link_libraries("${PROJECT_NAME}" PRIVATE bc7enc::bc7enc)

find_path(MPSC_CHANNEL_INCLUDE_DIRS "mpsc_channel.hpp")
target_include_directories("${PROJECT_NAME}" PRIVATE ${MPSC_CHANNEL_INCLUDE_DIRS})
target_include_directories("${PROJECT_NAME}"
PRIVATE ${MPSC_CHANNEL_INCLUDE_DIRS})

find_package(nlohmann_json CONFIG REQUIRED)
target_link_libraries("${PROJECT_NAME}" PRIVATE nlohmann_json::nlohmann_json)
Expand All @@ -111,9 +112,9 @@ target_compile_definitions(
"${PROJECT_NAME}" PRIVATE _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)

target_compile_definitions(
"${PROJECT_NAME}" PRIVATE
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
_GLIBCXX_PARALLEL) # required for parallel STL algorithms on GCC
"${PROJECT_NAME}" PRIVATE _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
_GLIBCXX_PARALLEL) # required for parallel STL
# algorithms on GCC

target_compile_options(
"${PROJECT_NAME}"
Expand Down
4 changes: 2 additions & 2 deletions src/bsa/archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ auto Archive::read(Path path) -> std::optional<Archive>
* @param path The path of the file to be written.
*/
template<typename Archive, typename WriteFunc>
void do_write(Archive &&arch, WriteFunc &&write_func, fs::path path)
requires std::is_rvalue_reference_v<decltype(arch)> && std::is_invocable_v<WriteFunc, Archive, fs::path>
void do_write(Archive &&arch, WriteFunc &&write_func, fs::path path) requires
std::is_rvalue_reference_v<decltype(arch)> && std::is_invocable_v<WriteFunc, Archive, fs::path>
{
auto write_and_check = [&](fs::path p) {
std::forward<WriteFunc>(write_func)(BTU_MOV(arch), p);
Expand Down
10 changes: 8 additions & 2 deletions src/hkx/anim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ class Info32to64 : public detail::AnimExeInfo
{
return "OUTFILE64.hkx";
}
[[nodiscard]] constexpr auto target_game() const noexcept -> btu::Game override { return btu::Game::SSE; }
[[nodiscard]] constexpr auto target_game() const noexcept -> btu::Game override
{
return btu::Game::SSE;
}

[[nodiscard]] auto get_required_files([[maybe_unused]] const Path &exe_dir) const noexcept
-> std::vector<Path> override
Expand All @@ -54,7 +57,10 @@ class Info32to64 : public detail::AnimExeInfo
return {(exe_dir / name()).string(), std::string(input_file_name())};
}

[[nodiscard]] auto is_os_supported() const noexcept -> bool override { return true; }
[[nodiscard]] auto is_os_supported() const noexcept -> bool override
{
return true;
}
};
static inline const auto k_exe_32to64 = Info32to64{};

Expand Down
10 changes: 5 additions & 5 deletions src/tex/optimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ auto Settings::get(Game game) noexcept -> const Settings &
sets.compress = true;
sets.use_format_whitelist = true;
sets.allowed_formats = {
DXGI_FORMAT_BC7_UNORM,
DXGI_FORMAT_BC5_UNORM,
DXGI_FORMAT_BC3_UNORM,
DXGI_FORMAT_BC1_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_BC7_UNORM,
DXGI_FORMAT_BC5_UNORM,
DXGI_FORMAT_BC3_UNORM,
DXGI_FORMAT_BC1_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
};
sets.output_format.compressed = DXGI_FORMAT_BC7_UNORM;
sets.game = btu::Game::SSE;
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ set(SOURCE_FILES
"${SOURCE_DIR}/utils.hpp"
"${SOURCE_DIR}/common/filesystem.cpp"
"${SOURCE_DIR}/common/functional.cpp"
"${SOURCE_DIR}/common/json.cpp"
"${SOURCE_DIR}/common/json.cpp"
"${SOURCE_DIR}/common/metaprogramming.cpp"
"${SOURCE_DIR}/common/string.cpp"
"${SOURCE_DIR}/bsa/archive.cpp"
"${SOURCE_DIR}/bsa/pack.cpp"
"${SOURCE_DIR}/bsa/plugin.cpp"
"${SOURCE_DIR}/bsa/unpack.cpp"
"${SOURCE_DIR}/esp/functions.cpp"
"${SOURCE_DIR}/hkx/anim.cpp"
"${SOURCE_DIR}/hkx/anim.cpp"
"${SOURCE_DIR}/modmanager/mod_folder.cpp"
"${SOURCE_DIR}/modmanager/mod_manager.cpp"
"${SOURCE_DIR}/nif/functions.cpp"
Expand Down

0 comments on commit 7192b78

Please sign in to comment.