1
1
2
2
include (CMakeParseArguments )
3
3
4
-
5
4
# Run a shell command and assign output to a variable or fail with an error.
6
5
# Example usage:
7
6
# runcmd(COMMAND "xcode-select" "-p"
@@ -20,7 +19,7 @@ function(runcmd)
20
19
set (${RUNCMD_VARIABLE} ${${RUNCMD_VARIABLE}} PARENT_SCOPE )
21
20
endfunction (runcmd )
22
21
23
- function (swift_benchmark_library objfile_out sibfile_out )
22
+ function (add_swift_benchmark_library objfile_out sibfile_out )
24
23
cmake_parse_arguments (BENCHLIB "" "MODULE_PATH;SOURCE_DIR;OBJECT_DIR" "SOURCES;LIBRARY_FLAGS" ${ARGN} )
25
24
26
25
precondition (BENCHLIB_MODULE_PATH )
@@ -127,56 +126,34 @@ function (swift_benchmark_compile_archopts)
127
126
128
127
set (objfile_out )
129
128
set (sibfile_out )
130
- swift_benchmark_library (objfile_out sibfile_out
129
+ add_swift_benchmark_library (objfile_out sibfile_out
131
130
MODULE_PATH "${module_name_path} "
132
131
SOURCE_DIR "${srcdir} "
133
132
OBJECT_DIR "${objdir} "
134
133
SOURCES ${sources}
135
134
LIBRARY_FLAGS ${common_options_driver} ${BENCH_DRIVER_LIBRARY_FLAGS} )
136
135
precondition (objfile_out )
137
136
list (APPEND bench_library_objects "${objfile_out} " )
138
- if (SWIFT_BENCHMARK_EMIT_SUB )
137
+ if (SWIFT_BENCHMARK_EMIT_SIB )
139
138
precondition (sibfile_out )
140
- list (APPEND bench_library_subfiles "${sibfile_out} " )
139
+ list (APPEND bench_library_sibfiles "${sibfile_out} " )
141
140
endif ()
142
141
endforeach ()
143
142
144
143
foreach (module_name_path ${BENCH_LIBRARY_MODULES} )
145
- get_filename_component ( module_name "${module_name_path} " NAME )
144
+ set ( sources "${srcdir} / ${ module_name_path}.swift" )
146
145
147
- set (objfile "${objdir} /${module_name} .o" )
148
- set (swiftmodule "${objdir} /${module_name} .swiftmodule" )
149
- set (source "${srcdir} /${module_name_path} .swift" )
150
- list (APPEND bench_library_objects "${objfile} " )
151
- add_custom_command (
152
- OUTPUT "${objfile} "
153
- DEPENDS
154
- ${stdlib_dependencies} "${srcdir} /${module_name_path} .swift"
155
- ${extra_sources}
156
- COMMAND "${SWIFT_EXEC} "
157
- ${common_options}
158
- "-force-single-frontend-invocation"
159
- "-parse-as-library"
160
- "-module-name" "${module_name} "
161
- "-emit-module" "-emit-module-path" "${swiftmodule} "
162
- "-o" "${objfile} "
163
- "${source} " ${extra_sources} )
146
+ add_swift_benchmark_library (objfile_out sibfile_out
147
+ MODULE_PATH "${module_name_path} "
148
+ SOURCE_DIR "${srcdir} "
149
+ OBJECT_DIR "${objdir} "
150
+ SOURCES ${sources}
151
+ LIBRARY_FLAGS ${common_options} )
152
+ precondition (objfile_out )
153
+ list (APPEND bench_library_objects "${objfile_out} " )
164
154
if (SWIFT_BENCHMARK_EMIT_SIB )
165
- set (sibfile "${objdir} /${module_name} .sib" )
166
- list (APPEND bench_library_sibfiles "${sibfile} " )
167
- add_custom_command (
168
- OUTPUT "${sibfile} "
169
- DEPENDS
170
- ${stdlib_dependencies} "${srcdir} /${module_name_path} .swift"
171
- ${extra_sources}
172
- COMMAND "${SWIFT_EXEC} "
173
- ${common_options}
174
- "-force-single-frontend-invocation"
175
- "-parse-as-library"
176
- "-module-name" "${module_name} "
177
- "-emit-sib"
178
- "-o" "${sibfile} "
179
- "${source} " ${extra_sources} )
155
+ precondition (sibfile_out )
156
+ list (APPEND bench_library_sibfiles "${sibfile_out} " )
180
157
endif ()
181
158
endforeach ()
182
159
0 commit comments