Skip to content

Commit

Permalink
Merge pull request #103 from JohanMabille/xtl
Browse files Browse the repository at this point in the history
Xtl
  • Loading branch information
JohanMabille authored May 31, 2024
2 parents ddf6118 + 569a726 commit 3657f9e
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 37 deletions.
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ option(XLEAFLET_BUILD_TESTS "xleaflet test suite" OFF)
# Dependencies
# ============

set(xtl_REQUIRED_VERSION 0.7.0)
set(xproperty_REQUIRED_VERSION 0.11.0)
set(xwidgets_REQUIRED_VERSION 0.27.0)

if (NOT TARGET xtl)
find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
endif ()
set(xproperty_REQUIRED_VERSION 0.12.0)
set(xwidgets_REQUIRED_VERSION 0.29.0)

if (NOT TARGET xproperty)
find_package(xproperty ${xproperty_REQUIRED_VERSION} REQUIRED)
Expand Down Expand Up @@ -173,7 +168,6 @@ target_include_directories(xleaflet PUBLIC $<BUILD_INTERFACE:${XLEAFLET_INCLUDE_
$<INSTALL_INTERFACE:include>)

target_link_libraries(xleaflet
PUBLIC xtl
PUBLIC xproperty
PUBLIC xwidgets)

Expand All @@ -195,7 +189,7 @@ set_target_properties(xleaflet PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED 14)

target_compile_features(xleaflet PRIVATE cxx_std_14)
target_compile_features(xleaflet PRIVATE cxx_std_17)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
target_compile_options(xleaflet PUBLIC -Wunused-parameter -Wextra -Wreorder)
Expand Down
4 changes: 2 additions & 2 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ dependencies:
- ninja
# Host dependencies
- cppzmq
- xproperty=0.11.0
- xwidgets=0.27.1
- xproperty=0.12.0
- xwidgets=0.29.0
- xtensor=0.24.3
# Test dependencies
- doctest
Expand Down
15 changes: 7 additions & 8 deletions include/xleaflet/xicon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
#define XLEAFLET_ICON_HPP

#include <array>
#include <optional>
#include <string>

#include "xtl/xoptional.hpp"

#include "xwidgets/xmaterialize.hpp"
#include "xwidgets/xwidget.hpp"

Expand Down Expand Up @@ -41,12 +40,12 @@ namespace xlf
void apply_patch(const nl::json&, const xeus::buffer_sequence&);

XPROPERTY(std::string, derived_type, icon_url, "");
XPROPERTY(xtl::xoptional<std::string>, derived_type, shadow_url);
XPROPERTY(xtl::xoptional<size_type>, derived_type, icon_size);
XPROPERTY(xtl::xoptional<size_type>, derived_type, shadow_size);
XPROPERTY(xtl::xoptional<size_type>, derived_type, icon_anchor);
XPROPERTY(xtl::xoptional<size_type>, derived_type, shadow_anchor);
XPROPERTY(xtl::xoptional<size_type>, derived_type, popup_anchor);
XPROPERTY(std::optional<std::string>, derived_type, shadow_url);
XPROPERTY(std::optional<size_type>, derived_type, icon_size);
XPROPERTY(std::optional<size_type>, derived_type, shadow_size);
XPROPERTY(std::optional<size_type>, derived_type, icon_anchor);
XPROPERTY(std::optional<size_type>, derived_type, shadow_anchor);
XPROPERTY(std::optional<size_type>, derived_type, popup_anchor);

protected:

Expand Down
3 changes: 2 additions & 1 deletion include/xleaflet/xlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef XLEAFLET_LAYER_HPP
#define XLEAFLET_LAYER_HPP

#include <optional>
#include <string>
#include <vector>

Expand Down Expand Up @@ -41,7 +42,7 @@ namespace xlf
XPROPERTY(std::string, derived_type, name, "");
XPROPERTY(bool, derived_type, base, true);
XPROPERTY(bool, derived_type, bottom, true);
XPROPERTY(xtl::xoptional<widget_type>, derived_type, popup);
XPROPERTY(std::optional<widget_type>, derived_type, popup);
XPROPERTY(std::vector<std::string>, derived_type, options);

protected:
Expand Down
2 changes: 0 additions & 2 deletions include/xleaflet/xmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include <utility>
#include <vector>

#include "xtl/xoptional.hpp"

#include "xwidgets/xcolor.hpp"
#include "xwidgets/xeither.hpp"
#include "xwidgets/xholder.hpp"
Expand Down
5 changes: 2 additions & 3 deletions include/xleaflet/xmarker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
#include <array>
#include <functional>
#include <list>
#include <optional>
#include <string>

#include "xtl/xoptional.hpp"

#include "xwidgets/xmaterialize.hpp"
#include "xwidgets/xholder.hpp"
#include "xwidgets/xwidget.hpp"
Expand Down Expand Up @@ -61,7 +60,7 @@ namespace xlf
// TODO: bounded between 0.0 and 1.0
XPROPERTY(double, derived_type, opacity, 1.0);
XPROPERTY(bool, derived_type, visible, true);
XPROPERTY(xtl::xoptional<icon_type>, derived_type, icon);
XPROPERTY(std::optional<icon_type>, derived_type, icon);
XPROPERTY(double, derived_type, rotation_angle, 0.);
XPROPERTY(std::string, derived_type, rotation_origin, "");
XPROPERTY(int, derived_type, rise_offset, 250);
Expand Down
5 changes: 3 additions & 2 deletions include/xleaflet/xmeasure_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef XLEAFLET_MEASURE_CONTROL_HPP
#define XLEAFLET_MEASURE_CONTROL_HPP

#include <optional>
#include <string>

#include "xwidgets/xcolor.hpp"
Expand Down Expand Up @@ -44,9 +45,9 @@ namespace xlf

XPROPERTY(std::string, derived_type, position, "topright", XEITHER("topright", "topleft", "bottomright", "bottomleft"));
XPROPERTY(std::string, derived_type, primary_length_unit, "feet", XEITHER("feet", "meters", "miles", "kilometers"));
XPROPERTY(xtl::xoptional<std::string>, derived_type, secondary_length_unit, {}, XEITHER_OPTIONAL("feet", "meters", "miles", "kilometers"));
XPROPERTY(std::optional<std::string>, derived_type, secondary_length_unit, {}, XEITHER_OPTIONAL("feet", "meters", "miles", "kilometers"));
XPROPERTY(std::string, derived_type, primary_area_unit, "acres", XEITHER("acres", "hectares", "sqfeet", "sqmeters", "sqmiles"));
XPROPERTY(xtl::xoptional<std::string>, derived_type, secondary_area_unit, {}, XEITHER_OPTIONAL("acres", "hectares", "sqfeet", "sqmeters", "sqmiles"));
XPROPERTY(std::optional<std::string>, derived_type, secondary_area_unit, {}, XEITHER_OPTIONAL("acres", "hectares", "sqfeet", "sqmeters", "sqmiles"));
XPROPERTY(xw::html_color, derived_type, active_color, "#ABE67E");
XPROPERTY(xw::html_color, derived_type, completed_color, "#C8F2BE");
XPROPERTY(nl::json, derived_type, popup_options, R"({
Expand Down
3 changes: 2 additions & 1 deletion include/xleaflet/xpopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define XLEAFLET_POPUP_HPP

#include <array>
#include <optional>
#include <string>

#include "xwidgets/xholder.hpp"
Expand Down Expand Up @@ -43,7 +44,7 @@ namespace xlf
void apply_patch(const nl::json&, const xeus::buffer_sequence&);

XPROPERTY(point_type, derived_type, location);
XPROPERTY(xtl::xoptional<widget_type>, derived_type, child);
XPROPERTY(std::optional<widget_type>, derived_type, child);
XPROPERTY(int, derived_type, max_width, 300);
XPROPERTY(int, derived_type, min_width, 50);
XPROPERTY(int, derived_type, max_height);
Expand Down
9 changes: 5 additions & 4 deletions include/xleaflet/xwidget_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef XLEAFLET_WIDGET_CONTROL_HPP
#define XLEAFLET_WIDGET_CONTROL_HPP

#include <optional>
#include <string>

#include "xwidgets/xholder.hpp"
Expand Down Expand Up @@ -40,10 +41,10 @@ namespace xlf
void apply_patch(const nl::json&, const xeus::buffer_sequence&);

XPROPERTY(widget_type, derived_type, widget);
XPROPERTY(xtl::xoptional<int>, derived_type, max_width);
XPROPERTY(xtl::xoptional<int>, derived_type, min_width);
XPROPERTY(xtl::xoptional<int>, derived_type, max_height);
XPROPERTY(xtl::xoptional<int>, derived_type, min_height);
XPROPERTY(std::optional<int>, derived_type, max_width);
XPROPERTY(std::optional<int>, derived_type, min_width);
XPROPERTY(std::optional<int>, derived_type, max_height);
XPROPERTY(std::optional<int>, derived_type, min_height);

protected:

Expand Down
3 changes: 2 additions & 1 deletion include/xleaflet/xzoom_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef XLEAFLET_ZOOM_CONTROL_HPP
#define XLEAFLET_ZOOM_CONTROL_HPP

#include <optional>
#include <string>

#include "xwidgets/xcolor.hpp"
Expand Down Expand Up @@ -41,7 +42,7 @@ namespace xlf

XPROPERTY(std::string, derived_type, zoom_in_text, "+");
XPROPERTY(std::string, derived_type, zoom_in_title, "Zoom in");
XPROPERTY(xtl::xoptional<std::string>, derived_type, zoom_out_text, "-");
XPROPERTY(std::optional<std::string>, derived_type, zoom_out_text, "-");
XPROPERTY(std::string, derived_type, zoom_out_title, "Zoom out");

protected:
Expand Down
1 change: 0 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ include_directories(${pybind11_INCLUDE_DIRS})
target_compile_features(test_xleaflet PRIVATE cxx_std_14)

target_link_libraries(test_xleaflet
PUBLIC xtl
PUBLIC xeus
PUBLIC xwidgets
PUBLIC xleaflet
Expand Down
5 changes: 2 additions & 3 deletions xleafletConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
@XLEAFLET_CONFIG_CODE@

include(CMakeFindDependencyMacro)
find_dependency(xtl @xtl_REQUIRED_VERSION@)
find_dependency(xproperty @xeus_REQUIRED_VERSION@)
find_dependency(xwidgets @xeus_REQUIRED_VERSION@)
find_dependency(xproperty @xproperty_REQUIRED_VERSION@)
find_dependency(xwidgets @xwidgets_REQUIRED_VERSION@)

if (NOT TARGET xleaflet)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
Expand Down

0 comments on commit 3657f9e

Please sign in to comment.