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
71e8a796
Commit
71e8a796
authored
Dec 17, 2016
by
Dean Moldovan
Committed by
Wenzel Jakob
Dec 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename target from pybind11::pybind11 to pybind11::module
Makes room for an eventual pybind11::embedded target.
parent
0cbec5c9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
19 deletions
+19
-19
CMakeLists.txt
+7
-7
docs/compiling.rst
+2
-2
tests/test_cmake_build/installed_target/CMakeLists.txt
+1
-1
tests/test_cmake_build/subdirectory_target/CMakeLists.txt
+1
-1
tools/pybind11Config.cmake.in
+8
-8
No files found.
CMakeLists.txt
View file @
71e8a796
...
@@ -89,18 +89,18 @@ message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}")
...
@@ -89,18 +89,18 @@ message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}")
if
(
NOT
(
CMAKE_VERSION VERSION_LESS 3.0
))
# CMake >= 3.0
if
(
NOT
(
CMAKE_VERSION VERSION_LESS 3.0
))
# CMake >= 3.0
# Build an interface library target:
# Build an interface library target:
add_library
(
pybind11
INTERFACE
)
add_library
(
module
INTERFACE
)
target_include_directories
(
pybind11
INTERFACE $<BUILD_INTERFACE:
${
PYBIND11_INCLUDE_DIR
}
>
target_include_directories
(
module
INTERFACE $<BUILD_INTERFACE:
${
PYBIND11_INCLUDE_DIR
}
>
$<BUILD_INTERFACE:
${
PYTHON_INCLUDE_DIRS
}
>
$<BUILD_INTERFACE:
${
PYTHON_INCLUDE_DIRS
}
>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
if
(
WIN32 OR CYGWIN
)
if
(
WIN32 OR CYGWIN
)
target_link_libraries
(
pybind11
INTERFACE $<BUILD_INTERFACE:
${
PYTHON_LIBRARIES
}
>
)
target_link_libraries
(
module
INTERFACE $<BUILD_INTERFACE:
${
PYTHON_LIBRARIES
}
>
)
elseif
(
APPLE
)
elseif
(
APPLE
)
target_link_libraries
(
pybind11
INTERFACE
"-undefined dynamic_lookup"
)
target_link_libraries
(
module
INTERFACE
"-undefined dynamic_lookup"
)
endif
()
endif
()
target_compile_options
(
pybind11
INTERFACE $<BUILD_INTERFACE:
${
PYBIND11_CPP_STANDARD
}
>
)
target_compile_options
(
module
INTERFACE $<BUILD_INTERFACE:
${
PYBIND11_CPP_STANDARD
}
>
)
add_library
(
pybind11::
pybind11 ALIAS pybind11
)
# to match exported target
add_library
(
pybind11::
module ALIAS module
)
# to match exported target
endif
()
endif
()
if
(
PYBIND11_INSTALL
)
if
(
PYBIND11_INSTALL
)
...
@@ -122,7 +122,7 @@ if (PYBIND11_INSTALL)
...
@@ -122,7 +122,7 @@ if (PYBIND11_INSTALL)
DESTINATION
${
PYBIND11_CMAKECONFIG_INSTALL_DIR
}
)
DESTINATION
${
PYBIND11_CMAKECONFIG_INSTALL_DIR
}
)
if
(
NOT
(
CMAKE_VERSION VERSION_LESS 3.0
))
if
(
NOT
(
CMAKE_VERSION VERSION_LESS 3.0
))
install
(
TARGETS
pybind11
install
(
TARGETS
module
EXPORT
"
${
PROJECT_NAME
}
Targets"
)
EXPORT
"
${
PROJECT_NAME
}
Targets"
)
install
(
EXPORT
"
${
PROJECT_NAME
}
Targets"
install
(
EXPORT
"
${
PROJECT_NAME
}
Targets"
NAMESPACE
"
${
PROJECT_NAME
}
::"
NAMESPACE
"
${
PROJECT_NAME
}
::"
...
...
docs/compiling.rst
View file @
71e8a796
...
@@ -142,7 +142,7 @@ Advanced: interface library target
...
@@ -142,7 +142,7 @@ Advanced: interface library target
----------------------------------
----------------------------------
When using a version of CMake greater than 3.0, pybind11 can additionally
When using a version of CMake greater than 3.0, pybind11 can additionally
be used as a special *interface library* . The target ``pybind11::
pybind11
``
be used as a special *interface library* . The target ``pybind11::
module
``
is available with pybind11 headers, Python headers and libraries as needed,
is available with pybind11 headers, Python headers and libraries as needed,
and C++ compile definitions attached. This target is suitable for linking
and C++ compile definitions attached. This target is suitable for linking
to an independently constructed (through ``add_library``, not
to an independently constructed (through ``add_library``, not
...
@@ -156,7 +156,7 @@ to an independently constructed (through ``add_library``, not
...
@@ -156,7 +156,7 @@ to an independently constructed (through ``add_library``, not
find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
add_library(example MODULE main.cpp)
add_library(example MODULE main.cpp)
target_link_libraries(example PRIVATE pybind11::
pybind11
)
target_link_libraries(example PRIVATE pybind11::
module
)
set_target_properties(example PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
set_target_properties(example PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
SUFFIX "${PYTHON_MODULE_EXTENSION}")
...
...
tests/test_cmake_build/installed_target/CMakeLists.txt
View file @
71e8a796
...
@@ -8,7 +8,7 @@ message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
...
@@ -8,7 +8,7 @@ message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
add_library
(
test_cmake_build MODULE ../main.cpp
)
add_library
(
test_cmake_build MODULE ../main.cpp
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::
pybind11
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::
module
)
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
set_target_properties
(
test_cmake_build PROPERTIES PREFIX
"
${
PYTHON_MODULE_PREFIX
}
"
set_target_properties
(
test_cmake_build PROPERTIES PREFIX
"
${
PYTHON_MODULE_PREFIX
}
"
...
...
tests/test_cmake_build/subdirectory_target/CMakeLists.txt
View file @
71e8a796
...
@@ -5,7 +5,7 @@ add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
...
@@ -5,7 +5,7 @@ add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
add_library
(
test_cmake_build MODULE ../main.cpp
)
add_library
(
test_cmake_build MODULE ../main.cpp
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::
pybind11
)
target_link_libraries
(
test_cmake_build PRIVATE pybind11::
module
)
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
set_target_properties
(
test_cmake_build PROPERTIES PREFIX
"
${
PYTHON_MODULE_PREFIX
}
"
set_target_properties
(
test_cmake_build PROPERTIES PREFIX
"
${
PYTHON_MODULE_PREFIX
}
"
...
...
tools/pybind11Config.cmake.in
View file @
71e8a796
...
@@ -26,12 +26,12 @@
...
@@ -26,12 +26,12 @@
# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
# influence standard setting. ::
# influence standard setting. ::
#
#
# pybind11::
pybind11 - the main pybind11 interface library
(i.e., headers)
# pybind11::
module - the main pybind11 interface library for extension modules
(i.e., headers)
#
#
# find_package(pybind11 CONFIG REQUIRED)
# find_package(pybind11 CONFIG REQUIRED)
# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION} & Py${PYTHON_VERSION_STRING})")
# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION} & Py${PYTHON_VERSION_STRING})")
# add_library(mylib MODULE main.cpp)
# add_library(mylib MODULE main.cpp)
# target_link_libraries(mylib pybind11::
pybind11
)
# target_link_libraries(mylib pybind11::
module
)
#
#
# Suggested usage::
# Suggested usage::
#
#
...
@@ -75,17 +75,17 @@ if(NOT TARGET ${PN}::pybind11)
...
@@ -75,17 +75,17 @@ if(NOT TARGET ${PN}::pybind11)
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
set_property(TARGET ${PN}::
pybind11
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
set_property(TARGET ${PN}::
module
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
if(WIN32 OR CYGWIN)
if(WIN32 OR CYGWIN)
set_property(TARGET ${PN}::
pybind11
APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
set_property(TARGET ${PN}::
module
APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
endif()
endif()
select_cxx_standard()
select_cxx_standard()
set_property(TARGET ${PN}::
pybind11
APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
set_property(TARGET ${PN}::
module
APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
get_property(_iid TARGET ${PN}::
pybind11
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(_iid TARGET ${PN}::
module
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(_ill TARGET ${PN}::
pybind11
PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(_ill TARGET ${PN}::
module
PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(_ico TARGET ${PN}::
pybind11
PROPERTY INTERFACE_COMPILE_OPTIONS)
get_property(_ico TARGET ${PN}::
module
PROPERTY INTERFACE_COMPILE_OPTIONS)
set(${PN}_INCLUDE_DIRS ${_iid})
set(${PN}_INCLUDE_DIRS ${_iid})
set(${PN}_LIBRARIES ${_ico} ${_ill})
set(${PN}_LIBRARIES ${_ico} ${_ill})
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