File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 8
8
)
9
9
10
10
find_package (Python3 COMPONENTS Interpreter Development REQUIRED )
11
- find_package (pybind11 REQUIRED )
11
+ find_package (pybind11 2.4.3 REQUIRED )
12
12
13
13
set (matplotlibcpp17_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR} /include" )
14
14
@@ -25,9 +25,8 @@ function(add_demo name path)
25
25
target_include_directories (${name} PUBLIC
26
26
${Python3_INCLUDE_DIRS}
27
27
${matplotlibcpp17_INCLUDE_DIRS}
28
- ${xtensor_INCLUDE_DIRS}
29
28
)
30
- target_link_libraries (${name} ${Python3_LIBRARIES} pybind11::embed )
29
+ target_link_libraries (${name} ${Python3_LIBRARIES} pybind11::embed xtensor )
31
30
endfunction ()
32
31
33
32
if (${ADD_DEMO} )
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ $ (make uninstall)
29
29
30
30
For using matplotlibcpp17 from CMakeLists.txt, see [ hello_world] ( https://github.com/soblin/matplotlibcpp17/tree/master/hello_world ) example.
31
31
32
+ ``` bash
33
+ find_package(matplotlibcpp17)
34
+ ...
35
+ target_link_libraries(a.out matplotlibcpp17::matplotlibcpp17)
36
+ ```
37
+
32
38
Or you could just add include path to ` include ` directory and compile your codes as descibed in [ minimal example] ( #minimal-example ) .
33
39
34
40
## Syntax
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ add_library(test_shared_lib SHARED
3
3
test_lib.cpp
4
4
)
5
5
target_compile_options (test_shared_lib PUBLIC "-fPIC" )
6
- target_include_directories (test_shared_lib PUBLIC ${pybind11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS } ${matplotlibcpp17_INCLUDE_DIRS} )
7
- target_link_libraries (test_shared_lib ${PYTHON_LIBRARY } pybind11::embed )
6
+ target_include_directories (test_shared_lib PUBLIC ${Python3_INCLUDE_DIRS } ${matplotlibcpp17_INCLUDE_DIRS} )
7
+ target_link_libraries (test_shared_lib ${Python3_LIBRARIES } pybind11::embed )
8
8
# link it
9
9
add_executable (test_lib_main test_lib_main.cpp )
10
- target_link_libraries (test_lib_main ${PYTHON_LIBRARY} pybind11::embed test_shared_lib )
10
+ target_link_libraries (test_lib_main test_shared_lib )
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ add_library(test_static_lib STATIC
3
3
test_lib.cpp
4
4
)
5
5
target_compile_options (test_static_lib PUBLIC "-fPIC" )
6
- target_include_directories (test_static_lib PUBLIC ${pybind11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS } ${matplotlibcpp17_INCLUDE_DIRS} )
7
- target_link_libraries (test_static_lib ${PYTHON_LIBRARY } pybind11::embed )
6
+ target_include_directories (test_static_lib PUBLIC ${Python3_INCLUDE_DIRS } ${matplotlibcpp17_INCLUDE_DIRS} )
7
+ target_link_libraries (test_static_lib ${Python3_LIBRARIES } pybind11::embed )
8
8
# link it
9
9
add_executable (test_lib_static_main test_lib_main.cpp )
10
- target_link_libraries (test_lib_static_main ${PYTHON_LIBRARY} pybind11::embed test_static_lib )
10
+ target_link_libraries (test_lib_static_main test_static_lib )
You can’t perform that action at this time.
0 commit comments