1
# For more information, please see: http://software.sci.utah.edu
6
# Scientific Computing and Imaging Institute, University of Utah
8
# License for the specific language governing rights and limitations under
9
# Permission is hereby granted, free of charge, to any person obtaining a
10
# copy of this software and associated documentation files (the "Software"),
11
# to deal in the Software without restriction, including without limitation
12
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
# and/or sell copies of the Software, and to permit persons to whom the
14
# Software is furnished to do so, subject to the following conditions:
16
# The above copyright notice and this permission notice shall be included
17
# in all copies or substantial portions of the Software.
19
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
# DEALINGS IN THE SOFTWARE.
27
# .cubin Parsing CMake Script
29
# (c) 2007 Scientific Computing and Imaging Institute, University of Utah
31
file(READ ${input_file} file_text)
33
if (${file_text} MATCHES ".+")
35
# Remember, four backslashes is escaped to one backslash in the string.
36
string(REGEX REPLACE ";" "\\\\;" file_text ${file_text})
37
string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
39
list(LENGTH file_text len)
41
foreach(line ${file_text})
43
# Only look at "code { }" blocks.
44
if(line MATCHES "^code")
46
# Break into individual lines.
47
string(REGEX REPLACE "\n" ";" line ${line})
49
foreach(entry ${line})
51
# Extract kernel names.
52
if (${entry} MATCHES "[^g]name = ([^ ]+)")
53
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
55
# Check to see if the kernel name starts with "_"
57
# if (${entry} MATCHES "^_")
58
# Skip the rest of this block.
59
# message("Skipping ${entry}")
61
# else (${entry} MATCHES "^_")
62
message("Kernel: ${entry}")
63
# endif (${entry} MATCHES "^_")
65
endif(${entry} MATCHES "[^g]name = ([^ ]+)")
67
# Skip the rest of the block if necessary
71
if (${entry} MATCHES "reg = ([^ ]+)")
72
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
73
message("Registers: ${entry}")
74
endif(${entry} MATCHES "reg = ([^ ]+)")
77
if (${entry} MATCHES "lmem = ([^ ]+)")
78
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
79
message("Local: ${entry}")
80
endif(${entry} MATCHES "lmem = ([^ ]+)")
83
if (${entry} MATCHES "smem = ([^ ]+)")
84
string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
85
message("Shared: ${entry}")
86
endif(${entry} MATCHES "smem = ([^ ]+)")
88
if (${entry} MATCHES "^}")
90
endif(${entry} MATCHES "^}")
97
endif(line MATCHES "^code")
102
# message("FOUND NO DEPENDS")