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
918d4481
Unverified
Commit
918d4481
authored
May 20, 2022
by
Henry Schreiner
Committed by
GitHub
May 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(cmake): support cross-compiles with classic Python (#3959)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
parent
1e4bd22b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
tools/FindPythonLibsNew.cmake
+21
-11
No files found.
tools/FindPythonLibsNew.cmake
View file @
918d4481
...
@@ -151,26 +151,36 @@ if(NOT _PYTHON_SUCCESS MATCHES 0)
...
@@ -151,26 +151,36 @@ if(NOT _PYTHON_SUCCESS MATCHES 0)
return
()
return
()
endif
()
endif
()
# Can manually set values when cross-compiling
macro
(
_PYBIND11_GET_IF_UNDEF lst index name
)
if
(
NOT DEFINED
"
${
name
}
"
)
list
(
GET
"
${
lst
}
"
"
${
index
}
"
"
${
name
}
"
)
endif
()
endmacro
()
# Convert the process output into a list
# Convert the process output into a list
if
(
WIN32
)
if
(
WIN32
)
string
(
REGEX REPLACE
"
\\\\
"
"/"
_PYTHON_VALUES
${
_PYTHON_VALUES
}
)
string
(
REGEX REPLACE
"
\\\\
"
"/"
_PYTHON_VALUES
${
_PYTHON_VALUES
}
)
endif
()
endif
()
string
(
REGEX REPLACE
";"
"
\\\\
;"
_PYTHON_VALUES
${
_PYTHON_VALUES
}
)
string
(
REGEX REPLACE
";"
"
\\\\
;"
_PYTHON_VALUES
${
_PYTHON_VALUES
}
)
string
(
REGEX REPLACE
"
\n
"
";"
_PYTHON_VALUES
${
_PYTHON_VALUES
}
)
string
(
REGEX REPLACE
"
\n
"
";"
_PYTHON_VALUES
${
_PYTHON_VALUES
}
)
list
(
GET
_PYTHON_VALUES 0 _PYTHON_VERSION_LIST
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 0 _PYTHON_VERSION_LIST
)
list
(
GET
_PYTHON_VALUES 1 PYTHON_PREFIX
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 1 PYTHON_PREFIX
)
list
(
GET
_PYTHON_VALUES 2 PYTHON_INCLUDE_DIR
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 2 PYTHON_INCLUDE_DIR
)
list
(
GET
_PYTHON_VALUES 3 PYTHON_SITE_PACKAGES
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 3 PYTHON_SITE_PACKAGES
)
list
(
GET
_PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION
)
list
(
GET
_PYTHON_VALUES 5 PYTHON_IS_DEBUG
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 5 PYTHON_IS_DEBUG
)
list
(
GET
_PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P
)
list
(
GET
_PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX
)
list
(
GET
_PYTHON_VALUES 8 PYTHON_LIBDIR
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 8 PYTHON_LIBDIR
)
list
(
GET
_PYTHON_VALUES 9 PYTHON_MULTIARCH
)
_pybind11_get_if_undef
(
_PYTHON_VALUES 9 PYTHON_MULTIARCH
)
# Make sure the Python has the same pointer-size as the chosen compiler
# Make sure the Python has the same pointer-size as the chosen compiler
# Skip if CMAKE_SIZEOF_VOID_P is not defined
# Skip if CMAKE_SIZEOF_VOID_P is not defined
if
(
CMAKE_SIZEOF_VOID_P
AND
(
NOT
"
${
PYTHON_SIZEOF_VOID_P
}
"
STREQUAL
"
${
CMAKE_SIZEOF_VOID_P
}
"
))
# This should be skipped for (non-Apple) cross-compiles (like EMSCRIPTEN)
if
(
NOT CMAKE_CROSSCOMPILING
AND CMAKE_SIZEOF_VOID_P
AND
(
NOT
"
${
PYTHON_SIZEOF_VOID_P
}
"
STREQUAL
"
${
CMAKE_SIZEOF_VOID_P
}
"
))
if
(
PythonLibsNew_FIND_REQUIRED
)
if
(
PythonLibsNew_FIND_REQUIRED
)
math
(
EXPR _PYTHON_BITS
"
${
PYTHON_SIZEOF_VOID_P
}
* 8"
)
math
(
EXPR _PYTHON_BITS
"
${
PYTHON_SIZEOF_VOID_P
}
* 8"
)
math
(
EXPR _CMAKE_BITS
"
${
CMAKE_SIZEOF_VOID_P
}
* 8"
)
math
(
EXPR _CMAKE_BITS
"
${
CMAKE_SIZEOF_VOID_P
}
* 8"
)
...
...
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