File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 13
13
14
14
__version__ = "0.0.1"
15
15
16
- # Windows strips quotes
17
- wrap = r'\"{}\"' if sys .platform .startswith ("win" ) else '"{}"'
18
-
19
16
# The main interface is through Pybind11Extension.
20
17
# * You can add cxx_std=11/14/17, and then build_ext can be removed.
21
18
# * You can set include_pybind11=false to add the include directory yourself,
29
26
Pybind11Extension ("python_example" ,
30
27
["src/main.cpp" ],
31
28
# Example: passing in the version to the compiled code
32
- define_macros = [('VERSION_INFO' , wrap . format ( __version__ ) )],
29
+ define_macros = [('VERSION_INFO' , __version__ )],
33
30
),
34
31
]
35
32
Original file line number Diff line number Diff line change 1
1
#include < pybind11/pybind11.h>
2
2
3
+ #define STRINGIFY (x ) #x
4
+ #define MACRO_STRINGIFY (x ) STRINGIFY(x)
5
+
3
6
int add (int i, int j) {
4
7
return i + j;
5
8
}
@@ -33,7 +36,7 @@ PYBIND11_MODULE(python_example, m) {
33
36
)pbdoc" );
34
37
35
38
#ifdef VERSION_INFO
36
- m.attr (" __version__" ) = VERSION_INFO;
39
+ m.attr (" __version__" ) = MACRO_STRINGIFY ( VERSION_INFO) ;
37
40
#else
38
41
m.attr (" __version__" ) = " dev" ;
39
42
#endif
You can’t perform that action at this time.
0 commit comments