Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
c48da925
Commit
c48da925
authored
May 29, 2016
by
Wenzel Jakob
Browse files
Merge branch 'cygwin' of
https://github.com/BorisSchaeling/pybind11
into BorisSchaeling-cygwin
parents
7da7b674
20ee9352
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
7 deletions
+9
-7
.gitignore
.gitignore
+1
-0
CMakeLists.txt
CMakeLists.txt
+2
-2
README.md
README.md
+1
-0
example/example10.cpp
example/example10.cpp
+1
-1
example/example4.cpp
example/example4.cpp
+1
-1
include/pybind11/common.h
include/pybind11/common.h
+1
-1
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+2
-2
No files found.
.gitignore
View file @
c48da925
...
@@ -5,6 +5,7 @@ cmake_install.cmake
...
@@ -5,6 +5,7 @@ cmake_install.cmake
.DS_Store
.DS_Store
/example/example.so
/example/example.so
/example/example.pyd
/example/example.pyd
/example/example.dll
*.sln
*.sln
*.sdf
*.sdf
*.opensdf
*.opensdf
...
...
CMakeLists.txt
View file @
c48da925
...
@@ -92,7 +92,7 @@ function(pybind11_add_module target_name)
...
@@ -92,7 +92,7 @@ function(pybind11_add_module target_name)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
# Check for Link Time Optimization support (GCC/Clang)
# Check for Link Time Optimization support (GCC/Clang)
check_cxx_compiler_flag
(
"-flto"
HAS_LTO_FLAG
)
check_cxx_compiler_flag
(
"-flto"
HAS_LTO_FLAG
)
if
(
HAS_LTO_FLAG
)
if
(
HAS_LTO_FLAG
AND NOT CYGWIN
)
target_compile_options
(
${
target_name
}
PRIVATE -flto
)
target_compile_options
(
${
target_name
}
PRIVATE -flto
)
endif
()
endif
()
...
@@ -138,7 +138,7 @@ function(pybind11_enable_warnings target_name)
...
@@ -138,7 +138,7 @@ function(pybind11_enable_warnings target_name)
if
(
MSVC
)
if
(
MSVC
)
target_compile_options
(
${
target_name
}
PRIVATE /W4
)
target_compile_options
(
${
target_name
}
PRIVATE /W4
)
else
()
else
()
target_compile_options
(
${
target_name
}
PRIVATE -Wall -Wextra
)
target_compile_options
(
${
target_name
}
PRIVATE -Wall -Wextra
-Wconversion
)
endif
()
endif
()
endfunction
()
endfunction
()
...
...
README.md
View file @
c48da925
...
@@ -90,6 +90,7 @@ In addition to the core functionality, pybind11 provides some extra goodies:
...
@@ -90,6 +90,7 @@ In addition to the core functionality, pybind11 provides some extra goodies:
2.
GCC (any non-ancient version with C++11 support)
2.
GCC (any non-ancient version with C++11 support)
3.
Microsoft Visual Studio 2015 or newer
3.
Microsoft Visual Studio 2015 or newer
4.
Intel C++ compiler v15 or newer
4.
Intel C++ compiler v15 or newer
5.
Cygwin
## About
## About
...
...
example/example10.cpp
View file @
c48da925
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
double
my_func
(
int
x
,
float
y
,
double
z
)
{
double
my_func
(
int
x
,
float
y
,
double
z
)
{
std
::
cout
<<
"my_func(x:int="
<<
x
<<
", y:float="
<<
y
<<
", z:float="
<<
z
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"my_func(x:int="
<<
x
<<
", y:float="
<<
y
<<
", z:float="
<<
z
<<
")"
<<
std
::
endl
;
return
x
*
y
*
z
;
return
(
float
)
x
*
y
*
z
;
}
}
std
::
complex
<
double
>
my_func3
(
std
::
complex
<
double
>
c
)
{
std
::
complex
<
double
>
my_func3
(
std
::
complex
<
double
>
c
)
{
...
...
example/example4.cpp
View file @
c48da925
...
@@ -38,7 +38,7 @@ void test_function2(EMyEnumeration k) {
...
@@ -38,7 +38,7 @@ void test_function2(EMyEnumeration k) {
float
test_function3
(
int
i
)
{
float
test_function3
(
int
i
)
{
std
::
cout
<<
"test_function("
<<
i
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"test_function("
<<
i
<<
")"
<<
std
::
endl
;
return
i
/
2.
f
;
return
(
float
)
i
/
2.
f
;
}
}
py
::
bytes
return_bytes
()
{
py
::
bytes
return_bytes
()
{
...
...
include/pybind11/common.h
View file @
c48da925
...
@@ -262,7 +262,7 @@ struct internals {
...
@@ -262,7 +262,7 @@ struct internals {
std
::
unordered_map
<
const
void
*
,
void
*>
registered_instances
;
// void * -> PyObject*
std
::
unordered_map
<
const
void
*
,
void
*>
registered_instances
;
// void * -> PyObject*
std
::
unordered_set
<
std
::
pair
<
const
PyObject
*
,
const
char
*>
,
overload_hash
>
inactive_overload_cache
;
std
::
unordered_set
<
std
::
pair
<
const
PyObject
*
,
const
char
*>
,
overload_hash
>
inactive_overload_cache
;
#if defined(WITH_THREAD)
#if defined(WITH_THREAD)
int
tstate
=
0
;
decltype
(
PyThread_create_key
())
tstate
=
0
;
// Usually an int but a long on Cygwin64 with Python 3.x
PyInterpreterState
*
istate
=
nullptr
;
PyInterpreterState
*
istate
=
nullptr
;
#endif
#endif
};
};
...
...
include/pybind11/pybind11.h
View file @
c48da925
...
@@ -1156,7 +1156,7 @@ public:
...
@@ -1156,7 +1156,7 @@ public:
gil_scoped_release
(
bool
disassoc
=
false
)
:
disassoc
(
disassoc
)
{
gil_scoped_release
(
bool
disassoc
=
false
)
:
disassoc
(
disassoc
)
{
tstate
=
PyEval_SaveThread
();
tstate
=
PyEval_SaveThread
();
if
(
disassoc
)
{
if
(
disassoc
)
{
int
key
=
detail
::
get_internals
().
tstate
;
auto
key
=
detail
::
get_internals
().
tstate
;
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value
(
key
);
PyThread_delete_key_value
(
key
);
#else
#else
...
@@ -1169,7 +1169,7 @@ public:
...
@@ -1169,7 +1169,7 @@ public:
return
;
return
;
PyEval_RestoreThread
(
tstate
);
PyEval_RestoreThread
(
tstate
);
if
(
disassoc
)
{
if
(
disassoc
)
{
int
key
=
detail
::
get_internals
().
tstate
;
auto
key
=
detail
::
get_internals
().
tstate
;
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value
(
key
);
PyThread_delete_key_value
(
key
);
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment