Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit701b312

Browse files
authored
Merge pull request#306 from JohanMabille/revert_find_numpy
Temporary revert to find_numpy to fix the feedstock
2 parentsa7c2005 +9b7cb5e commit701b312

File tree

2 files changed

+92
-2
lines changed

2 files changed

+92
-2
lines changed

‎CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ endif()
6464
# which is required under some circumstances (such as wasm, where
6565
# there is no real python executable)
6666
if(NOT NUMPY_INCLUDE_DIRS)
67-
find_package(Python REQUIRED COMPONENTS NumPy)
67+
find_package(NumPy REQUIRED)
6868
endif()
69+
message(STATUS"Found numpy:${NUMPY_INCLUDE_DIRS}")
6970

7071
# Build
7172
# =====
@@ -84,7 +85,7 @@ set(XTENSOR_PYTHON_HEADERS
8485

8586
add_library(xtensor-pythonINTERFACE)
8687
target_include_directories(xtensor-pythonINTERFACE
87-
"$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR};${pybind11_INCLUDE_DIRS};${Python_NumPy_INCLUDE_DIRS}>"
88+
"$<BUILD_INTERFACE:${XTENSOR_PYTHON_INCLUDE_DIR};${pybind11_INCLUDE_DIRS};${NUMPY_INCLUDE_DIRS}>"
8889
$<INSTALL_INTERFACE:include>)
8990
target_link_libraries(xtensor-pythonINTERFACE xtensor)
9091
get_target_property(inc_dir xtensor-pythonINTERFACE_INCLUDE_DIRECTORIES)

‎cmake/FindNumPy.cmake

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# - Find the NumPy libraries
2+
# This module finds if NumPy is installed, and sets the following variables
3+
# indicating where it is.
4+
#
5+
# TODO: Update to provide the libraries and paths for linking npymath lib.
6+
#
7+
# NUMPY_FOUND - was NumPy found
8+
# NUMPY_VERSION - the version of NumPy found as a string
9+
# NUMPY_VERSION_MAJOR - the major version number of NumPy
10+
# NUMPY_VERSION_MINOR - the minor version number of NumPy
11+
# NUMPY_VERSION_PATCH - the patch version number of NumPy
12+
# NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
13+
# NUMPY_INCLUDE_DIRS - path to the NumPy include files
14+
15+
#============================================================================
16+
# Copyright 2012 Continuum Analytics, Inc.
17+
#
18+
# MIT License
19+
#
20+
# Permission is hereby granted, free of charge, to any person obtaining
21+
# a copy of this software and associated documentation files
22+
# (the "Software"), to deal in the Software without restriction, including
23+
# without limitation the rights to use, copy, modify, merge, publish,
24+
# distribute, sublicense, and/or sell copies of the Software, and to permit
25+
# persons to whom the Software is furnished to do so, subject to
26+
# the following conditions:
27+
#
28+
# The above copyright notice and this permission notice shall be included
29+
# in all copies or substantial portions of the Software.
30+
#
31+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
34+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
35+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
36+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
37+
# OTHER DEALINGS IN THE SOFTWARE.
38+
#
39+
#============================================================================
40+
41+
# Finding NumPy involves calling the Python interpreter
42+
if(NumPy_FIND_REQUIRED)
43+
find_package(PythonInterp REQUIRED)
44+
else()
45+
find_package(PythonInterp)
46+
endif()
47+
48+
if(NOT PYTHONINTERP_FOUND)
49+
set(NUMPY_FOUNDFALSE)
50+
endif()
51+
52+
execute_process(COMMAND"${PYTHON_EXECUTABLE}""-c"
53+
"import numpy as n; print(n.__version__); print(n.get_include());"
54+
RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS
55+
OUTPUT_VARIABLE _NUMPY_VALUES
56+
ERROR_VARIABLE _NUMPY_ERROR_VALUE
57+
OUTPUT_STRIP_TRAILING_WHITESPACE)
58+
59+
if(NOT _NUMPY_SEARCH_SUCCESSMATCHES 0)
60+
if(NumPy_FIND_REQUIRED)
61+
message(FATAL_ERROR
62+
"NumPy import failure:\n${_NUMPY_ERROR_VALUE}")
63+
endif()
64+
set(NUMPY_FOUNDFALSE)
65+
endif()
66+
67+
# Convert the process output into a list
68+
string(REGEX REPLACE";""\\\\;" _NUMPY_VALUES${_NUMPY_VALUES})
69+
string(REGEX REPLACE"\n"";" _NUMPY_VALUES${_NUMPY_VALUES})
70+
list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
71+
list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)
72+
73+
# Make sure all directory separators are '/'
74+
string(REGEX REPLACE"\\\\""/" NUMPY_INCLUDE_DIRS${NUMPY_INCLUDE_DIRS})
75+
76+
# Get the major and minor version numbers
77+
string(REGEX REPLACE"\\."";" _NUMPY_VERSION_LIST${NUMPY_VERSION})
78+
list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR)
79+
list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR)
80+
list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH)
81+
string(REGEX MATCH"[0-9]*" NUMPY_VERSION_PATCH${NUMPY_VERSION_PATCH})
82+
math(EXPR NUMPY_VERSION_DECIMAL
83+
"(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) +${NUMPY_VERSION_PATCH}")
84+
85+
find_package_message(NUMPY
86+
"Found NumPy: version\"${NUMPY_VERSION}\"${NUMPY_INCLUDE_DIRS}"
87+
"${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}")
88+
89+
set(NUMPY_FOUNDTRUE)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp