mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-10 23:44:29 +00:00
a lot of fixes
This commit is contained in:
parent
cf574c407f
commit
a499714251
22 changed files with 270 additions and 155 deletions
9
.dockerignore
Normal file
9
.dockerignore
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
build*/
|
||||
.cache/
|
||||
.git/
|
||||
.github/
|
||||
compile_commands.json
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
install_dir/
|
||||
|
||||
|
|
@ -30,6 +30,7 @@ jobs:
|
|||
- name: install library
|
||||
run: |
|
||||
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release --log-level=DEBUG -DCMAKE_INSTALL_PREFIX=./install_dir
|
||||
cmake --build ./build -j$(nproc)
|
||||
cmake --install ./build --prefix ./install_dir
|
||||
rm -rf build
|
||||
|
||||
|
|
@ -37,12 +38,12 @@ jobs:
|
|||
run: CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild2 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=1 --log-level=DEBUG
|
||||
|
||||
- name: build with installed version via cmake
|
||||
run: cmake --build build2 --config Debug -j4 --verbose
|
||||
run: cmake --build build2 --config Debug -j$(nproc) --verbose
|
||||
|
||||
- name: test
|
||||
run: |
|
||||
cd build2
|
||||
ctest --build-config Debug -j4
|
||||
ctest --build-config Debug -j$(nproc)
|
||||
|
||||
- name: clear
|
||||
run: rm -rf build2
|
||||
|
|
@ -51,9 +52,9 @@ jobs:
|
|||
run: CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild3 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG=1 -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=1 --log-level=DEBUG
|
||||
|
||||
- name: build with installed version via pkgconfig
|
||||
run: cmake --build build3 --config Debug -j4 --verbose
|
||||
run: cmake --build build3 --config Debug -j$(nproc) --verbose
|
||||
|
||||
- name: test
|
||||
run: |
|
||||
cd build3
|
||||
ctest --build-config Debug -j4
|
||||
ctest --build-config Debug -j$(nproc)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ package(default_visibility = ["//visibility:public"])
|
|||
cc_library(
|
||||
name = "magic_enum",
|
||||
hdrs = glob(["include/magic_enum/*.hpp"]),
|
||||
includes = ["include/magic_enum"],
|
||||
includes = ["include"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ a local magic_enum via pkgconfig" NO
|
|||
|
||||
if(${MAGIC_ENUM_OPT_TEST_INSTALLED_VERSION} OR ${MAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG})
|
||||
add_subdirectory(test)
|
||||
else()
|
||||
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include/magic_enum")
|
||||
set(EXPORT_NAMESPACE "${PROJECT_NAME}::")
|
||||
|
|
@ -45,7 +45,7 @@ else()
|
|||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
add_library(${EXPORT_NAMESPACE}${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
||||
target_include_directories(
|
||||
${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${INCLUDES}>
|
||||
${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
|
|
@ -75,15 +75,16 @@ else()
|
|||
# export
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADERS "${INCLUDES}/*.h" "${INCLUDES}/*.hxx" "${INCLUDES}/*.hpp")
|
||||
foreach(headerFile ${HEADERS})
|
||||
get_filename_component(headerFileParentDir "${headerFile}" DIRECTORY)
|
||||
file(RELATIVE_PATH headerFileRelParentDir "${INCLUDES}" "${headerFileParentDir}")
|
||||
if(NOT DEFINED PROJECT_INCLUDE_HEADER_PATTERN)
|
||||
set(PROJECT_INCLUDE_HEADER_PATTERN "*")
|
||||
endif()
|
||||
|
||||
install(FILES "${headerFile}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${headerFileRelParentDir}"
|
||||
install(
|
||||
DIRECTORY ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}
|
||||
DESTINATION include
|
||||
FILES_MATCHING
|
||||
PATTERN "${PROJECT_INCLUDE_HEADER_PATTERN}"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
|
||||
|
|
@ -159,5 +160,3 @@ else()
|
|||
|
||||
include(CPack)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
|||
71
Dockerfile
Normal file
71
Dockerfile
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
FROM gentoo/stage3:latest
|
||||
|
||||
RUN echo "Updating Gentoo index registry..."
|
||||
RUN emerge-webrsync
|
||||
|
||||
|
||||
RUN echo "Setting up package manager"
|
||||
# Allow emerge newer versions of cmake. We need it because vcpkg wants it.
|
||||
RUN echo "dev-build/cmake ~amd64" >> /etc/portage/package.accept_keywords/unmask
|
||||
# # Get some packages as binaries and don't compile them. Actually, it allows to not compile only zip :(
|
||||
# RUN rm -rf /etc/portage/binrepos.conf/*
|
||||
# RUN echo -e "[binhost]\npriority = 9999\nsync-uri = https://gentoo.osuosl.org/experimental/amd64/binpkg/default/linux/17.1/x86-64/" >> /etc/portage/binrepos.conf/osuosl.conf
|
||||
# RUN cat /etc/portage/binrepos.conf/*
|
||||
# Arguments that going to be added automatically to `emerge` command. `man emerge` in help. Or read https://wiki.gentoo.org/wiki/Binary_package_guide/en#Installing_binary_packages .
|
||||
# RUN echo 'EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --binpkg-respect-use=y --getbinpkg=y --verbose --verbose-conflicts "' >> /etc/portage/make.conf
|
||||
|
||||
RUN echo "Installing dependencies..."
|
||||
|
||||
RUN emerge --quiet --verbose --tree --verbose-conflicts --jobs=2 dev-vcs/git dev-build/cmake zip
|
||||
|
||||
# RUN echo "Installing vcpkg..."
|
||||
# RUN git clone https://github.com/Microsoft/vcpkg.git && \
|
||||
# ./vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||
#
|
||||
# COPY ./vcpkg.json ./vcpkg.json
|
||||
#
|
||||
# RUN echo "Installing dependencies using vcpkg"
|
||||
# RUN ./vcpkg/vcpkg install
|
||||
|
||||
WORKDIR /backend
|
||||
|
||||
RUN echo "Copy sources of the project"
|
||||
COPY . .
|
||||
RUN ls -lah
|
||||
|
||||
# expected to be mounted at runtime as volume.
|
||||
# COPY resources/ ./resources/
|
||||
|
||||
|
||||
RUN echo "Configuring project..."
|
||||
RUN cmake -S ./ -B ./build --log-level DEBUG
|
||||
|
||||
|
||||
# RUN echo "Building project..."
|
||||
# RUN cmake --build ./build --parallel $(nproc) --verbose
|
||||
|
||||
RUN echo "really installing"
|
||||
RUN cmake --install ./build
|
||||
|
||||
RUN echo "checking cmake-cmake"
|
||||
RUN cmake -S. -B build2 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=1 --log-level=DEBUG
|
||||
RUN cmake --build build2 -j $(nproc) --verbose
|
||||
|
||||
RUN echo "checking pkgconfig-cmake"
|
||||
RUN cat "/usr/local/share/pkgconfig/magic_enum.pc"
|
||||
RUN cmake -S. -B build3 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG=1 --log-level=DEBUG
|
||||
RUN cmake --build build3 -j $(nproc) --verbose
|
||||
|
||||
|
||||
|
||||
# RUN echo "what's with linking?"
|
||||
# RUN ls -lahR /usr/local/lib64
|
||||
# RUN lddtree /usr/local/lib64/libArby.so
|
||||
# RUN lddtree /usr/local/bin/Arby
|
||||
|
||||
# CMD ./build/Backend
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
|
||||
enum class AnimalFlags : std::uint64_t { HasClaws = 1 << 10, CanFly = 1 << 20, EatsFish = 1 << 30, Endangered = std::uint64_t{1} << 40 };
|
||||
// Add specialization `is_flags` to define that enum are flags.
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
|
||||
enum class Color : int { RED = -10, BLUE = 0, GREEN = 10 };
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <magic_enum/magic_enum_containers.hpp>
|
||||
|
||||
enum class Color { RED = 1, GREEN = 2, BLUE = 4 };
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <magic_enum/magic_enum_containers.hpp>
|
||||
|
||||
enum class Color { RED = 1, GREEN = 2, BLUE = 4 };
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <magic_enum/magic_enum_containers.hpp>
|
||||
|
||||
enum class Color { RED = 1, GREEN = 2, BLUE = 4 };
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
|
||||
enum class Color : int { RED = -10, BLUE = 0, GREEN = 10 };
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
|
||||
enum class Language : int {
|
||||
日本語 = 10,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#define MAGIC_ENUM_ENABLE_HASH
|
||||
#include <magic_enum_switch.hpp>
|
||||
#include <magic_enum/magic_enum_switch.hpp>
|
||||
|
||||
enum class Color { RED, BLUE, GREEN };
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module;
|
|||
|
||||
#include <version>
|
||||
#ifndef MAGIC_ENUM_USE_STD_MODULE
|
||||
#include <magic_enum_all.hpp>
|
||||
#include <magic_enum/magic_enum_all.hpp>
|
||||
#endif
|
||||
|
||||
export module magic_enum;
|
||||
|
|
@ -13,7 +13,7 @@ import std;
|
|||
extern "C++" {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
|
||||
#include <magic_enum_all.hpp>
|
||||
#include <magic_enum/magic_enum_all.hpp>
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,29 @@ endif()
|
|||
|
||||
if(${MAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG})
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(magic_enum REQUIRED magic_enum)
|
||||
pkg_check_modules(magic_enum magic_enum)
|
||||
if(NOT magic_enum_FOUND)
|
||||
message(
|
||||
WARNING
|
||||
"magic_enum via pkgconfig is not found. \
|
||||
Next code will try check possible places for some platforms, \
|
||||
but there's no guarantee. \
|
||||
If you know where the magic_enum pkgconfig files (.pc) are, \
|
||||
then specify yourself variable \$\{CMAKE_PREFIX_PATH\} \
|
||||
with folder like /a/path/to/magic_enum (for POSIX-like pathes), \
|
||||
where in the folder exists share/pkgconfig/magic_enum.pc ."
|
||||
)
|
||||
if(UNIX AND EXISTS "/usr/local/share/pkgconfig/magic_enum.pc")
|
||||
message(DEBUG "\$\{CMAKE_PREFIX_PATH\} : ${CMAKE_PREFIX_PATH} ")
|
||||
set(CMAKE_PREFIX_PATH "/usr/local")
|
||||
message(DEBUG "\$\{CMAKE_PREFIX_PATH\} : ${CMAKE_PREFIX_PATH} ")
|
||||
pkg_check_modules(magic_enum magic_enum)
|
||||
endif()
|
||||
# code place for future workarounds for other platforms...
|
||||
if(NOT magic_enum_FOUND)
|
||||
message(FATAL_ERROR "Could not find magic_enum's config. Read a warning above.")
|
||||
endif()
|
||||
endif()
|
||||
message(DEBUG "magic_enum_FOUND : ${magic_enum_FOUND}")
|
||||
message(DEBUG "magic_enum_LIBRARIES: ${magic_enum_LIBRARIES}")
|
||||
message(DEBUG "magic_enum_LINK_LIBRARIES: ${magic_enum_LINK_LIBRARIES}")
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
#define MAGIC_ENUM_NO_CHECK_REFLECTED_ENUM
|
||||
#define MAGIC_ENUM_RANGE_MIN -120
|
||||
#define MAGIC_ENUM_RANGE_MAX 120
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_fuse.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum_utility.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_fuse.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum_utility.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
|
|
@ -1176,7 +1176,7 @@ TEST_CASE("multdimensional-switch-case") {
|
|||
|
||||
#if defined(__cpp_lib_format)
|
||||
|
||||
#include <magic_enum_format.hpp>
|
||||
#include <magic_enum/magic_enum_format.hpp>
|
||||
|
||||
TEST_CASE("format-base") {
|
||||
REQUIRE(std::format("{}", Color::RED) == "red");
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ constexpr bool operator==(MyStringView lhs, MyStringView rhs) {
|
|||
#define MAGIC_ENUM_USING_ALIAS_STRING using string = MyString;
|
||||
#define MAGIC_ENUM_USING_ALIAS_STRING_VIEW using string_view = MyStringView;
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_flags.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_flags.hpp>
|
||||
using namespace magic_enum;
|
||||
using namespace magic_enum::bitwise_operators;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <magic_enum_containers.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum_containers.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_flags.hpp>
|
||||
#include <magic_enum_fuse.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum_utility.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_flags.hpp>
|
||||
#include <magic_enum/magic_enum_fuse.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum_utility.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
|
|
@ -91,8 +91,8 @@ struct magic_enum::customize::enum_range<number> {
|
|||
static constexpr bool is_flags = true;
|
||||
};
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_fuse.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_fuse.hpp>
|
||||
|
||||
using namespace magic_enum;
|
||||
using namespace magic_enum::bitwise_operators;
|
||||
|
|
@ -720,7 +720,7 @@ TEST_CASE("constexpr_for") {
|
|||
|
||||
#if defined(__cpp_lib_format)
|
||||
|
||||
#include <magic_enum_format.hpp>
|
||||
#include <magic_enum/magic_enum_format.hpp>
|
||||
|
||||
TEST_CASE("format-base") {
|
||||
REQUIRE(std::format("Test-{:~^11}.", Color::RED | Color::GREEN) == "Test-~RED|GREEN~.");
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
#define MAGIC_ENUM_RANGE_MIN -120
|
||||
#undef MAGIC_ENUM_RANGE_MAX
|
||||
#define MAGIC_ENUM_RANGE_MAX 120
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_fuse.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_fuse.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
#define MAGIC_ENUM_USING_ALIAS_STRING_VIEW using string_view = std::wstring_view;
|
||||
#define MAGIC_ENUM_USING_ALIAS_STRING using string = std::wstring;
|
||||
#include <magic_enum.hpp>
|
||||
#include <magic_enum_iostream.hpp>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
#include <magic_enum/magic_enum_iostream.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
|
|
|
|||
13
test_installed_version.bash
Normal file
13
test_installed_version.bash
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
rm -rf ./build
|
||||
rm -rf ./build2
|
||||
rm -rf ./build3
|
||||
rm -rf ./install_dir/
|
||||
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release --log-level=DEBUG -DCMAKE_INSTALL_PREFIX=install_dir
|
||||
cmake --build ./build -j$(nproc)
|
||||
cmake --install ./build/ --prefix ./install_dir
|
||||
CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild2 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=1 --log-level=DEBUG
|
||||
cmake --build build2 --config Debug -j$(nproc) --verbose
|
||||
CMAKE_PREFIX_PATH="./install_dir" cmake -S. -Bbuild3 -DMAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG=1 --log-level=DEBUG
|
||||
cmake --build build3 --config Debug -j$(nproc) --verbose
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue