Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
89656445
Commit
89656445
authored
May 26, 2016
by
Boris Schäling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make examples build and run on Cygwin
parent
bd986fe5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
.gitignore
+1
-0
CMakeLists.txt
+13
-8
include/pybind11/common.h
+1
-1
No files found.
.gitignore
View file @
89656445
...
@@ -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 @
89656445
...
@@ -59,7 +59,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
...
@@ -59,7 +59,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
# Check for Link Time Optimization support
# Check for Link Time Optimization support
# (GCC/Clang)
# (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
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto"
)
endif
()
endif
()
...
@@ -149,6 +149,9 @@ add_library(example SHARED
...
@@ -149,6 +149,9 @@ add_library(example SHARED
${
PYBIND11_EXAMPLES
}
${
PYBIND11_EXAMPLES
}
)
)
# Link against the Python shared library
target_link_libraries
(
example
${
PYTHON_LIBRARY
}
)
# Don't add a 'lib' prefix to the shared library
# Don't add a 'lib' prefix to the shared library
set_target_properties
(
example PROPERTIES PREFIX
""
)
set_target_properties
(
example PROPERTIES PREFIX
""
)
...
@@ -182,9 +185,6 @@ if (WIN32)
...
@@ -182,9 +185,6 @@ if (WIN32)
# .PYD file extension on Windows
# .PYD file extension on Windows
set_target_properties
(
example PROPERTIES SUFFIX
".pyd"
)
set_target_properties
(
example PROPERTIES SUFFIX
".pyd"
)
# Link against the Python shared library
target_link_libraries
(
example
${
PYTHON_LIBRARY
}
)
elseif
(
UNIX
)
elseif
(
UNIX
)
# It's quite common to have multiple copies of the same Python version
# It's quite common to have multiple copies of the same Python version
# installed on one's system. E.g.: one copy from the OS and another copy
# installed on one's system. E.g.: one copy from the OS and another copy
...
@@ -200,8 +200,13 @@ elseif (UNIX)
...
@@ -200,8 +200,13 @@ elseif (UNIX)
# missing symbols, but that's perfectly fine -- they will be resolved at
# missing symbols, but that's perfectly fine -- they will be resolved at
# import time.
# import time.
# .SO file extension on Linux/Mac OS
# .DLL file extension on Cygwin, .SO file extension on Linux/Mac OS
set_target_properties
(
example PROPERTIES SUFFIX
".so"
)
if
(
CYGWIN
)
set
(
SUFFIX
".dll"
)
else
()
set
(
SUFFIX
".so"
)
endif
()
set_target_properties
(
example PROPERTIES SUFFIX
${
SUFFIX
}
)
# Optimize for a small binary size
# Optimize for a small binary size
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
...
@@ -213,11 +218,11 @@ elseif (UNIX)
...
@@ -213,11 +218,11 @@ elseif (UNIX)
set_target_properties
(
example PROPERTIES MACOSX_RPATH
"."
)
set_target_properties
(
example PROPERTIES MACOSX_RPATH
"."
)
set_target_properties
(
example PROPERTIES LINK_FLAGS
"-undefined dynamic_lookup "
)
set_target_properties
(
example PROPERTIES LINK_FLAGS
"-undefined dynamic_lookup "
)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
add_custom_command
(
TARGET example POST_BUILD COMMAND strip -u -r
${
PROJECT_SOURCE_DIR
}
/example/example
.so
)
add_custom_command
(
TARGET example POST_BUILD COMMAND strip -u -r
${
PROJECT_SOURCE_DIR
}
/example/example
${
SUFFIX
}
)
endif
()
endif
()
else
()
else
()
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
if
(
NOT
${
U_CMAKE_BUILD_TYPE
}
MATCHES DEBUG
)
add_custom_command
(
TARGET example POST_BUILD COMMAND strip
${
PROJECT_SOURCE_DIR
}
/example/example
.so
)
add_custom_command
(
TARGET example POST_BUILD COMMAND strip
${
PROJECT_SOURCE_DIR
}
/example/example
${
SUFFIX
}
)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
()
...
...
include/pybind11/common.h
View file @
89656445
...
@@ -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
;
long
tstate
=
0
;
PyInterpreterState
*
istate
=
nullptr
;
PyInterpreterState
*
istate
=
nullptr
;
#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