Browse Source

Some bugfixes and adjustments for contour/spy

Benno Evers 4 years ago
parent
commit
630ba843d5
3 changed files with 13 additions and 5 deletions
  1. 8 0
      CMakeLists.txt
  2. 5 4
      examples/spy.cpp
  3. 0 1
      matplotlibcpp.h

+ 8 - 0
CMakeLists.txt

@@ -16,6 +16,7 @@ target_include_directories(matplotlib_cpp
 target_compile_features(matplotlib_cpp INTERFACE
   cxx_std_11
 )
+# TODO: Use `Development.Embed` component when requiring cmake >= 3.18
 find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
 target_link_libraries(matplotlib_cpp INTERFACE
   Python3::Python
@@ -92,6 +93,13 @@ if(Python3_NumPy_FOUND)
   add_executable(colorbar examples/colorbar.cpp)
   target_link_libraries(colorbar PRIVATE matplotlib_cpp)
   set_target_properties(colorbar PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+  add_executable(contour examples/contour.cpp)
+  target_link_libraries(contour PRIVATE matplotlib_cpp)
+  set_target_properties(contour PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+
+  add_executable(spy examples/spy.cpp)
+  target_link_libraries(spy PRIVATE matplotlib_cpp)
+  set_target_properties(spy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
 endif()
 
 

+ 5 - 4
examples/spy.cpp

@@ -1,6 +1,7 @@
-#import <iostream>
-#import <vector>
-#import "../matplotlibcpp.h"
+#include "../matplotlibcpp.h"
+
+#include <iostream>
+#include <vector>
 
 namespace plt = matplotlibcpp;
 
@@ -26,4 +27,4 @@ int main()
     plt::show();
 
     return 0;
-}
+}

+ 0 - 1
matplotlibcpp.h

@@ -354,7 +354,6 @@ static_assert(sizeof(long long) == 8);
 template <> struct select_npy_type<long long> { const static NPY_TYPES type = NPY_INT64; };
 static_assert(sizeof(unsigned long long) == 8);
 template <> struct select_npy_type<unsigned long long> { const static NPY_TYPES type = NPY_UINT64; };
-TODO: add int, long, etc.
 
 template<typename Numeric>
 PyObject* get_array(const std::vector<Numeric>& v)