Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matplotlibcpp17
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HKHLR
matplotlibcpp17
Commits
990c2568
Commit
990c2568
authored
Jun 26, 2022
by
soblin
Browse files
Options
Downloads
Patches
Plain Diff
v1.0.4
Signed-off-by:
soblin
<
hilo.soblin@gmail.com
>
parent
53d8a15d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMakeLists.txt
+70
-57
70 additions, 57 deletions
CMakeLists.txt
with
70 additions
and
57 deletions
CMakeLists.txt
+
70
−
57
View file @
990c2568
...
...
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
project
(
"matplotlibcpp17"
VERSION 1.0.
0
VERSION 1.0.
4
DESCRIPTION
"A C++ header-only plotting library based on pybind11 and matplotlib, featuring more flexibility than matplotlibcpp"
HOMEPAGE_URL
"https://soblin.github.io/matplotlibcpp17/"
)
...
...
@@ -13,13 +13,14 @@ find_package(
REQUIRED
)
find_package
(
pybind11 2.4.3 REQUIRED
)
# check matplotlib minor version
# ##############################################################################
# (1) check matplotlib minor version
# ##############################################################################
execute_process
(
COMMAND
${
Python3_EXECUTABLE
}
"-c"
"import matplotlib;
print(str(matplotlib.__version__), end='')"
RESULT_VARIABLE MATPLOTLIB_VERSION_CHECKING
OUTPUT_VARIABLE MATPLOTLIB_VERSION
)
if
(
NOT MATPLOTLIB_VERSION_CHECKING MATCHES 0
)
message
(
FATAL_ERROR
"Could not check matplotlib.__version__"
)
endif
()
...
...
@@ -32,55 +33,15 @@ else()
set
(
MATPLOTLIB_MINOR_VER_GTE_4 1
)
endif
()
# gallery
if
(
NOT DEFINED USE_GUI
)
set
(
USE_GUI 0
)
message
(
STATUS
"set USE_GUI = OFF"
)
endif
()
if
(
NOT DEFINED ADD_DEMO
)
set
(
ADD_DEMO 0
)
message
(
STATUS
"set ADD_DEMO = OFF"
)
endif
()
if
(
USE_GUI
)
message
(
STATUS
"USE_GUI = ON"
)
else
()
message
(
STATUS
"USE_GUI = OFF"
)
endif
()
if
(
ADD_DEMO
)
message
(
STATUS
"ADD_DEMO = ON"
)
else
()
message
(
STATUS
"ADD_DEMO = OFF"
)
endif
()
function
(
add_demo name path
)
add_executable
(
${
name
}
${
path
}
)
target_include_directories
(
${
name
}
PUBLIC
${
Python3_INCLUDE_DIRS
}
${
matplotlibcpp17_INCLUDE_DIRS
}
)
target_link_libraries
(
${
name
}
${
Python3_LIBRARIES
}
pybind11::embed xtensor
)
endfunction
()
if
(
${
ADD_DEMO
}
)
find_package
(
Python3
COMPONENTS NumPy
REQUIRED
)
find_package
(
xtensor 0.24.0 REQUIRED
)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_FLAGS
"-Wall -g -DUSE_GUI=
${
USE_GUI
}
-DMATPLOTLIB_MINOR_VER_GTE_4=
${
MATPLOTLIB_MINOR_VER_GTE_4
}
"
)
add_subdirectory
(
gallery/tests
)
add_subdirectory
(
gallery/lines_bars_and_markers
)
add_subdirectory
(
gallery/subplots_axes_and_figures
)
add_subdirectory
(
gallery/statistics
)
add_subdirectory
(
gallery/images_contours_and_fields
)
add_subdirectory
(
gallery/shapes_and_collections
)
add_subdirectory
(
gallery/artist_animation
)
add_subdirectory
(
gallery/mplot3d
)
add_subdirectory
(
gallery/scales
)
endif
()
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
target_compile_features
(
${
PROJECT_NAME
}
INTERFACE cxx_std_17
)
# for add_subdirectory
# ##############################################################################
# (2) for add_subdirectory
# ##############################################################################
add_library
(
matplotlibcpp17::matplotlibcpp17 INTERFACE IMPORTED GLOBAL
)
set_property
(
TARGET matplotlibcpp17::matplotlibcpp17
...
...
@@ -90,14 +51,13 @@ set_property(
TARGET matplotlibcpp17::matplotlibcpp17
PROPERTY INTERFACE_LINK_LIBRARIES
${
Python3_LIBRARIES
}
pybind11::embed
)
# install https://dominikberner.ch/cmake-interface-lib/
# ##############################################################################
# (3) install
# ##############################################################################
# https://dominikberner.ch/cmake-interface-lib/
include
(
GNUInstallDirs
)
# header-only library(INTERFACE)
add_library
(
${
PROJECT_NAME
}
INTERFACE
)
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
target_compile_features
(
${
PROJECT_NAME
}
INTERFACE cxx_std_17
)
install
(
TARGETS
${
PROJECT_NAME
}
EXPORT
${
PROJECT_NAME
}
_Targets
...
...
@@ -129,6 +89,9 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
# create .deb
include
(
"
${
PROJECT_SOURCE_DIR
}
/cmake/package.cmake"
)
# ##############################################################################
# (4) uninstall
# ##############################################################################
# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
if
(
NOT TARGET uninstall
)
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/uninstall.cmake.in"
...
...
@@ -137,3 +100,53 @@ if(NOT TARGET uninstall)
uninstall COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_BINARY_DIR
}
/uninstall.cmake
)
endif
()
# ##############################################################################
# (5) gallery
# ##############################################################################
if
(
NOT DEFINED USE_GUI
)
set
(
USE_GUI 0
)
message
(
STATUS
"set USE_GUI = OFF"
)
endif
()
if
(
NOT DEFINED ADD_DEMO
)
set
(
ADD_DEMO 0
)
message
(
STATUS
"set ADD_DEMO = OFF"
)
endif
()
if
(
USE_GUI
)
message
(
STATUS
"USE_GUI = ON"
)
else
()
message
(
STATUS
"USE_GUI = OFF"
)
endif
()
if
(
ADD_DEMO
)
message
(
STATUS
"ADD_DEMO = ON"
)
else
()
message
(
STATUS
"ADD_DEMO = OFF"
)
endif
()
function
(
add_demo name path
)
add_executable
(
${
name
}
${
path
}
)
target_include_directories
(
${
name
}
PUBLIC
${
Python3_INCLUDE_DIRS
}
${
matplotlibcpp17_INCLUDE_DIRS
}
)
target_link_libraries
(
${
name
}
${
Python3_LIBRARIES
}
pybind11::embed xtensor
)
endfunction
()
if
(
${
ADD_DEMO
}
)
find_package
(
Python3
COMPONENTS NumPy
REQUIRED
)
find_package
(
xtensor 0.24.0 REQUIRED
)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_FLAGS
"-Wall -g -DUSE_GUI=
${
USE_GUI
}
-DMATPLOTLIB_MINOR_VER_GTE_4=
${
MATPLOTLIB_MINOR_VER_GTE_4
}
"
)
add_subdirectory
(
gallery/tests
)
add_subdirectory
(
gallery/lines_bars_and_markers
)
add_subdirectory
(
gallery/subplots_axes_and_figures
)
add_subdirectory
(
gallery/statistics
)
add_subdirectory
(
gallery/images_contours_and_fields
)
add_subdirectory
(
gallery/shapes_and_collections
)
add_subdirectory
(
gallery/artist_animation
)
add_subdirectory
(
gallery/mplot3d
)
add_subdirectory
(
gallery/scales
)
endif
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment