forked from gemini3d/gemini3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.cmake
More file actions
66 lines (53 loc) · 1.3 KB
/
Copy pathpython.cmake
File metadata and controls
66 lines (53 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function(check_pygemini)
# Numpy conflicts are a general source of trouble
execute_process(COMMAND ${Python_EXECUTABLE} -c "import numpy"
RESULT_VARIABLE ret
OUTPUT_VARIABLE out
ERROR_VARIABLE err
)
if(NOT ret EQUAL 0)
message(VERBOSE "Problem with Python Numpy:
${ret}
${out}
${err}"
)
return()
endif()
# need h5py for Python tests
execute_process(COMMAND ${Python_EXECUTABLE} -c "import h5py,numpy,sys; print(f'Python {sys.version} Numpy {numpy.__version__} h5py {h5py.__version__}')"
RESULT_VARIABLE ret
OUTPUT_VARIABLE out
ERROR_VARIABLE err
)
if(ret EQUAL 0)
set(H5PY_FOUND true CACHE BOOL "Python h5py Found")
else()
message(VERBOSE "Problem with Python h5py:
${ret}
${out}
${err}"
)
return()
endif()
if(NOT python)
return()
endif()
execute_process(COMMAND ${Python_EXECUTABLE} -c "import gemini3d; print(gemini3d.__version__)"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} # help avoid Intel Windows false import error due to hdf5 .dll in build dir
RESULT_VARIABLE ret
OUTPUT_VARIABLE out
ERROR_VARIABLE err
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT ret EQUAL 0)
message(FATAL_ERROR "Failed to get PyGemini version:
${ret}
${out}
${err}"
)
endif()
endfunction()
find_package(Python COMPONENTS Interpreter)
if(Python_FOUND AND NOT DEFINED PYGEMINI_FOUND)
check_pygemini()
endif()