1
1
function (find_pybind11)
2
2
if (TARGET pybind11::module)
3
3
message (STATUS "pybind11::module target already imported" )
4
- elseif (pyAMReX_pybind11_src)
5
- message (STATUS "Compiling local pybind11 ..." )
6
- message (STATUS "pybind11 source path: ${pyAMReX_pybind11_src} " )
7
- if (NOT IS_DIRECTORY ${pyAMReX_pybind11_src} )
8
- message (FATAL_ERROR "Specified directory pyAMReX_pybind11_src='${pyAMReX_pybind11_src} ' does not exist!" )
9
- endif ()
10
4
elseif (pyAMReX_pybind11_internal)
11
- message (STATUS "Downloading pybind11 ..." )
12
- message (STATUS "pybind11 repository: ${pyAMReX_pybind11_repo} (${pyAMReX_pybind11_branch} )" )
13
- include (FetchContent)
5
+ if (pyAMReX_pybind11_src)
6
+ message (STATUS "Compiling local pybind11 ..." )
7
+ message (STATUS "pybind11 source path: ${pyAMReX_pybind11_src} " )
8
+ if (NOT IS_DIRECTORY ${pyAMReX_pybind11_src} )
9
+ message (FATAL_ERROR "Specified directory pyAMReX_pybind11_src='${pyAMReX_pybind11_src} ' does not exist!" )
10
+ endif ()
11
+ elseif (pyAMReX_pybind11_tar)
12
+ message (STATUS "Downloading pybind11 ..." )
13
+ message (STATUS "pybind11 source: ${pyAMReX_pybind11_tar} " )
14
+ elseif (pyAMReX_pybind11_branch)
15
+ message (STATUS "Downloading pybind11 ..." )
16
+ message (STATUS "pybind11 repository: ${pyAMReX_pybind11_repo} (${pyAMReX_pybind11_branch} )" )
17
+ include (FetchContent)
18
+ endif ()
14
19
endif ()
15
20
if (TARGET pybind11::module)
16
21
# nothing to do, target already exists in the superbuild
17
- elseif (pyAMReX_pybind11_internal OR pyAMReX_pybind11_src )
22
+ elseif (pyAMReX_pybind11_internal)
18
23
set (CMAKE_POLICY_DEFAULT_CMP0077 NEW)
19
24
20
25
if (pyAMReX_pybind11_src)
21
26
add_subdirectory (${pyAMReX_pybind11_src} _deps/localpybind11-build /)
22
27
else ()
23
- FetchContent_Declare(fetchedpybind11
24
- GIT_REPOSITORY ${pyAMReX_pybind11_repo}
25
- GIT_TAG ${pyAMReX_pybind11_branch}
26
- BUILD_IN_SOURCE 0
27
- )
28
+ include (FetchContent)
29
+ if (pyAMReX_pybind11_tar)
30
+ FetchContent_Declare(fetchedpybind11
31
+ URL ${pyAMReX_pybind11_tar}
32
+ URL_HASH ${pyAMReX_pybind11_tar_hash}
33
+ BUILD_IN_SOURCE OFF
34
+ )
35
+ else ()
36
+ FetchContent_Declare(fetchedpybind11
37
+ GIT_REPOSITORY ${pyAMReX_pybind11_repo}
38
+ GIT_TAG ${pyAMReX_pybind11_branch}
39
+ BUILD_IN_SOURCE 0
40
+ )
41
+ endif ()
28
42
FetchContent_MakeAvailable(fetchedpybind11)
29
43
30
44
# advanced fetch options
@@ -41,13 +55,22 @@ function(find_pybind11)
41
55
endif ()
42
56
endfunction ()
43
57
58
+ option (pyAMReX_pybind11_internal "Download & build pybind11" ${pyAMReX_SUPERBUILD} )
59
+
44
60
# local source-tree
45
61
set (pyAMReX_pybind11_src ""
46
62
CACHE PATH
47
63
"Local path to pybind11 source directory (preferred if set)" )
48
64
65
+ # tarball fetcher
66
+ set (pyAMReX_pybind11_tar "https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.tar.gz"
67
+ CACHE STRING
68
+ "Remote tarball link to pull and build pybind11 from if(pyAMReX_pybind11_internal)" )
69
+ set (pyAMReX_pybind11_tar_hash "SHA256=e08cb87f4773da97fa7b5f035de8763abc656d87d5773e62f6da0587d1f0ec20"
70
+ CACHE STRING
71
+ "Hash checksum of the tarball of pybind11 if(pyAMReX_pybind11_internal)" )
72
+
49
73
# Git fetcher
50
- option (pyAMReX_pybind11_internal "Download & build pybind11" ON )
51
74
set (pyAMReX_pybind11_repo "https://github.com/pybind/pybind11.git"
52
75
CACHE STRING
53
76
"Repository URI to pull and build pybind11 from if(pyAMReX_pybind11_internal)" )
0 commit comments