File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,25 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8
8
include_directories (numpy/include )
9
9
include_directories (pocketpy/include )
10
10
11
+ option (SHOW_XTENSOR_WARNINGS "Show warnings from xtensor" OFF )
12
+
11
13
add_subdirectory (pocketpy )
12
14
13
15
if (MSVC )
14
16
add_compile_options (/wd4018 /wd4172 /wd4819 )
15
17
add_compile_options (/bigobj )
16
18
endif ()
17
19
20
+ # Suppress xtensor warnings if SHOW_XTENSOR_WARNINGS is OFF
21
+ if (NOT SHOW_XTENSOR_WARNINGS )
22
+ add_compile_definitions (SUPPRESS_XTENSOR_WARNINGS )
23
+ if (MSVC )
24
+ add_compile_options (/wd4244 /wd4267 /wd4018 )
25
+ else ()
26
+ add_compile_options (-Wno-sign-compare -Wno-conversion -Wno-unused-variable -Wno-unused-parameter )
27
+ endif ()
28
+ endif ()
29
+
18
30
add_executable (${PROJECT_NAME} test_main.cpp numpy/src/numpy.cpp )
19
31
20
32
set_property (TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY CMAKE_CURRENT_LIST_DIR )
Original file line number Diff line number Diff line change 12
12
#include < utility>
13
13
#include < vector>
14
14
15
+ // Suppress xtensor warnings if SUPPRESS_XTENSOR_WARNINGS is set
16
+ #ifdef SUPPRESS_XTENSOR_WARNINGS
17
+ #ifdef _MSC_VER
18
+ #pragma warning(push, 0)
19
+ #else
20
+ #pragma GCC diagnostic push
21
+ #pragma GCC diagnostic ignored "-Wall"
22
+ #pragma GCC diagnostic ignored "-Wextra"
23
+ #pragma GCC system_header
24
+ #endif
25
+ #endif
26
+
15
27
#include < xtensor/xarray.hpp>
16
28
#include < xtensor/xio.hpp>
17
29
#include < xtensor/xmath.hpp>
18
30
#include < xtensor/xrandom.hpp>
19
31
#include < xtensor/xsort.hpp>
20
32
#include < xtensor/xview.hpp>
21
33
34
+ #ifdef SUPPRESS_XTENSOR_WARNINGS
35
+ #ifdef _MSC_VER
36
+ #pragma warning(pop)
37
+ #else
38
+ #pragma GCC diagnostic pop
39
+ #endif
40
+ #endif
41
+
22
42
namespace pkpy {
23
43
24
44
// Type aliases
You can’t perform that action at this time.
0 commit comments