Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed dependency on xtl #67

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ set(${PROJECT_NAME}_VERSION
${XPROPERTY_VERSION_MAJOR}.${XPROPERTY_VERSION_MINOR}.${XPROPERTY_VERSION_PATCH})
message(STATUS "xproperty v${${PROJECT_NAME}_VERSION}")

# Dependencies
# ============

set(xtl_REQUIRED_VERSION 0.7.0)
find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
message(STATUS "Found xtl: ${xtl_INCLUDE_DIRS}/xtl")

# Build
# =====

Expand All @@ -45,8 +38,6 @@ set(XPROPERTY_HEADERS
add_library(xproperty INTERFACE)
target_include_directories(xproperty INTERFACE $<BUILD_INTERFACE:${XPROPERTY_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)
target_link_libraries(xproperty INTERFACE xtl)

OPTION(BUILD_TESTS "xproperty test suite" OFF)

if(BUILD_TESTS)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ http://xproperty.readthedocs.io/

## Dependencies

`xproperty` depends on the [xtl](https://github.com/xtensor-stack/xtl) library.
`xproperty` depends on [nlohmann_json](https://github.com/nlohmann/json).

Versions prior to 0.12.0, also depend on the [xtl](https://github.com/xtensor-stack/xtl) library.

| `xproperty` | `xtl` |
|-------------|---------------|
| master | >=0.7.0,<0.8 |
| 0.11.0 | >=0.7.0,<0.8 |
| 0.10.4 | >=0.6.11,<0.7 |
| 0.10.3 | >=0.6.11,<0.7 |
Expand Down
1 change: 0 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies:
- cxx-compiler
- ninja
# Host dependencies
- xtl=0.7.0
- nlohmann_json
- doctest

7 changes: 3 additions & 4 deletions include/xproperty/xobserved.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
#ifndef XOBSERVED_HPP
#define XOBSERVED_HPP

#include <any>
#include <cstddef>
#include <functional>
#include <type_traits>
#include <map>
#include <vector>

#include "xtl/xany.hpp"

#include "xproperty.hpp"

namespace xp
Expand Down Expand Up @@ -97,7 +96,7 @@ namespace xp

private:

std::map<const char*, std::tuple<std::vector<xtl::any>, std::vector<std::function<void(derived_type&)>>>> m_accesses;
std::map<const char*, std::tuple<std::vector<std::any>, std::vector<std::function<void(derived_type&)>>>> m_accesses;

template <class X, class Y>
friend class xproperty;
Expand Down Expand Up @@ -179,7 +178,7 @@ namespace xp

for(auto& validator : std::get<0>(m_accesses[name]))
{
xtl::any_cast<std::function<void(derived_type&, value_type&)>>(validator)(derived_cast(), value);
std::any_cast<std::function<void(derived_type&, value_type&)>>(validator)(derived_cast(), value);
}

return value;
Expand Down
2 changes: 0 additions & 2 deletions include/xproperty/xproperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <type_traits>
#include <utility>

#include "xtl/xfunctional.hpp"

namespace xp
{

Expand Down
24 changes: 2 additions & 22 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
project(xproperty-test)

find_package(xproperty REQUIRED CONFIG)
find_package(xtl REQUIRED CONFIG)
set(XPROPERTY_INCLUDE_DIR ${xproperty_INCLUDE_DIRS})
endif ()

Expand All @@ -23,26 +22,6 @@ include(CheckCXXCompilerFlag)

string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wunused-variable")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion")
CHECK_CXX_COMPILER_FLAG("-std=c++14" HAS_CPP14_FLAG)
CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP17_FLAG)

if (CPP17 AND HAS_CPP17_FLAG)
set(CMAKE_CXX_STANDARD 17)
message(STATUS "Building with -std=c++17")
elseif (HAS_CPP14_FLAG)
set(CMAKE_CXX_STANDARD 14)
message(STATUS "Building with -std=c++14")
else()
message(FATAL_ERROR "Unsupported compiler -- xproperty requires C++14 support!")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
Expand All @@ -62,7 +41,8 @@ set(XPROPERTY_TESTS
)

add_executable(test_xproperty ${XPROPERTY_TESTS} ${XPROPERTY_HEADERS})
target_compile_features(test_xproperty PRIVATE cxx_std_17)
target_include_directories(test_xproperty PRIVATE ${XPROPERTY_INCLUDE_DIR})
target_link_libraries(test_xproperty PRIVATE xtl doctest::doctest Threads::Threads)
target_link_libraries(test_xproperty PRIVATE doctest::doctest Threads::Threads)

add_custom_target(xtest COMMAND test_xproperty DEPENDS test_xproperty)
3 changes: 0 additions & 3 deletions xpropertyConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(xtl @xtl_REQUIRED_VERSION@)

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
get_target_property(@PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@ INTERFACE_INCLUDE_DIRECTORIES)
Expand Down