rbind 0.0.26 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,523 +0,0 @@
1
-
2
- require 'rbind/clang/clang'
3
- require 'rbind'
4
- require 'pp'
5
- require 'hooks'
6
-
7
- module Rbind
8
- class ClangParser < RNamespace
9
- class ClangParserError < RuntimeError
10
- def initialize(message,cursor)
11
- @cursor = cursor
12
- super(message)
13
- end
14
-
15
- def context(before = 10)
16
- file,row,cloumn = @cursor.location
17
- f = File.open(file)
18
- lines = f.readlines[[0,row-before].max..row-1]
19
- f.close
20
- lines
21
- end
22
-
23
- def to_s
24
- location = @cursor.location
25
- con = context
26
- row = location[1] - con.size
27
- con = con.map do |line|
28
- row += 1
29
- "#{row}:\t> #{line}"
30
- end
31
- pos_width = @cursor.location_int-@cursor.extent[:begin_int_data]
32
- pos_start = [location[2]-pos_width,0].max
33
- con << " \t " + " "*pos_start + "."*pos_width
34
- "#{super}\n\n#{"#"*5}\nParsed File: #{location.join(":")}\n#{con.join()}\n#{"#"*5}\n\n"
35
- rescue => e
36
- pp e
37
- end
38
- end
39
-
40
- include Hooks
41
- extend ::Rbind::Logger
42
-
43
- def self.default_arguments
44
- @default_arguments || ["-xc++","-fno-rtti"]
45
- end
46
-
47
- def self.default_arguments=(args)
48
- if not args.kind_of?(Array)
49
- raise ArgumentError, "Clang::default_arguments require Array"
50
- end
51
- @default_arguments = args
52
- end
53
-
54
- def self.reset_default_arguments
55
- @default_arguments = []
56
- end
57
-
58
- def initialize(root=nil)
59
- super(nil,root)
60
- add_default_types if !root
61
- @clang = Clang::Clang.new
62
- end
63
-
64
- def parse(file_path, args = ClangParser.default_arguments)
65
- tu = @clang.translation_unit(file_path,args)
66
- process(tu.cursor)
67
- self
68
- end
69
-
70
- def normalize_accessor(accessor)
71
- case accessor
72
- when :x_public
73
- :public
74
- when :x_private
75
- :private
76
- when :x_protected
77
- :protected
78
- else
79
- raise "Cannot normalize accessor #{accessor}"
80
- end
81
- end
82
-
83
- #returns the real type and the pointer level
84
- # char** would be returned as [char,2]
85
- def pointee_type(clang_type)
86
- # count pointer level
87
- level = 0
88
- while(clang_type.kind == :pointer)
89
- clang_type = clang_type.pointee_type
90
- level += 1
91
- end
92
- [clang_type,level]
93
- end
94
-
95
- # if rbind_type is given only pointer/ref or qualifier are applied
96
- def to_rbind_type(parent,cursor,rbind_type=nil,type_getter = :type,canonical = true, use_fallback = true)
97
- ClangParser.log.debug "Parent: #{parent} --> cursor: #{cursor.expression}, spelling #{cursor.spelling}"
98
- clang_type = cursor.send(type_getter)
99
- return nil if clang_type.null?
100
- clang_type = clang_type.canonical_type if canonical
101
- clang_type,level = pointee_type(clang_type)
102
-
103
- t = if rbind_type
104
- rbind_type
105
- else
106
- name = clang_type.declaration.spelling
107
- name = if name.empty?
108
- if clang_type.kind != :unexposed
109
- if clang_type.kind == :l_value_reference
110
- clang_type.pointee_type.kind
111
- else
112
- clang_type.kind.to_s
113
- end
114
- else
115
- # fall back to cursor spelling
116
- cursor.spelling
117
- end
118
- else
119
- namespace = clang_type.declaration.namespace
120
- if namespace.empty?
121
- name
122
- else
123
- "#{namespace}::#{name}"
124
- end
125
-
126
- end
127
- t = parent.type(name,!canonical)
128
- end
129
-
130
- # try again without canonical when type could not be found or type is template
131
- if use_fallback
132
- if !t || t.template?
133
- return to_rbind_type(parent,cursor,rbind_type,type_getter,false, false)
134
- end
135
- end
136
-
137
- # add pointer level
138
- 1.upto(level) do
139
- t = t.to_ptr
140
- end
141
- t = if clang_type.kind == :l_value_reference
142
- if clang_type.pointee_type.const_qualified?
143
- t.to_ref.to_const
144
- else
145
- t.to_ref
146
- end
147
- else
148
- if clang_type.const_qualified?
149
- t.to_const
150
- else
151
- t
152
- end
153
- end
154
- end
155
-
156
- # entry call to parse a file
157
- def process(cursor, parent = self, access = :public)
158
- last_obj = nil
159
- cursor.visit_children(false) do |cu,cu_parent|
160
- ClangParser.log.debug "process ----->#{cu.kind} #{cu.spelling} #{cu.type.kind} #{cu.specialized_template.kind} ---> expr: #{cu.expression.join('|')} -- public: #{cu.public?} access: #{access}"
161
- begin
162
- last_obj = case cu.kind
163
- when :namespace
164
- process_namespace(cu,parent)
165
- when :enum_decl
166
- process_enum(cu,parent) if access == :public
167
- when :union_decl
168
- # puts "got union declaration #{cu.spelling}"
169
- when :struct_decl
170
- process_class(cu,parent,:public) if access == :public
171
- when :class_decl
172
- process_class(cu,parent, :private) if access == :public
173
- when :function_decl
174
- process_function(cu,parent) if access == :public
175
- when :macro_expansion # CV_WRAP ...
176
- # puts "got macro #{cu.spelling} #{cu.location}"
177
- when :function_template
178
- # puts "got template fuction #{cu.spelling} #{cu.location}"
179
- when :class_template
180
- process_class_template(cu,parent, access) if access == :public
181
- when :template_type_parameter
182
- if !cu.spelling.empty?
183
- parent.add_type(RTemplateParameter.new(cu.spelling))
184
- else
185
- ClangParser.log.info "no template parameter name"
186
- end
187
- when :x_access_specifier
188
- access = normalize_accessor(cu.cxx_access_specifier)
189
- when :x_base_specifier
190
- if access == :public
191
- next
192
- end
193
- local_access = normalize_accessor(cu.cxx_access_specifier)
194
- klass_name = cu.spelling
195
- if cu.spelling =~ /\s?([^\s]+$)/
196
- klass_name = $1
197
- end
198
- ClangParser.log.info "auto add parent class #{klass_name} if needed"
199
- p = parent.type(RClass.new(RBase.normalize(klass_name)), true)
200
- parent.add_parent p,local_access
201
- when :field_decl
202
- process_field(cu,parent) if access == :public
203
- when :constructor
204
- if access == :public
205
- f = process_function(cu,parent)
206
- f.return_type = nil if f
207
- f
208
- end
209
- when :x_method
210
- process_function(cu,parent) if access == :public
211
- when :typedef_decl
212
- if access != :public
213
- next
214
- end
215
- # rename object if parent has no name
216
- if last_obj && last_obj.respond_to?(:name) && last_obj.name =~ /no_name/
217
- ClangParser.log.info "rename #{last_obj.name} to #{cu.spelling}"
218
- last_obj.rename(cu.spelling)
219
- last_obj
220
- else
221
- process_typedef(cu, parent)
222
- end
223
- when :var_decl
224
- process_variable(cu,parent) if access == :public
225
- when :unexposed_decl
226
- process(cu) if access == :public
227
- else
228
- #puts "skip: #{cu.spelling}"
229
- end
230
- rescue => e
231
- ClangParser.log.debug "Parsing failed -- skipping"
232
- end
233
- raise ClangParserError.new("jjj",cu) if last_obj.is_a? Fixnum
234
-
235
-
236
- end
237
- end
238
-
239
- def process_namespace(cursor,parent)
240
- name = cursor.spelling
241
- ClangParser.log.info "processing namespace #{parent}::#{name}"
242
- ns = parent.add_namespace(name)
243
- process(cursor,ns)
244
- ns
245
- end
246
-
247
- def process_enum(cursor,parent)
248
- name = cursor.spelling
249
- name = if name.empty?
250
- n = 0.upto(10000) do |i|
251
- n = "no_name_enum_#{i}"
252
- break n if !parent.type(n,false,false)
253
- end
254
- raise "Cannot find unique enum name" unless n
255
- n
256
- else
257
- name
258
- end
259
- ClangParser.log.info "processing enum #{parent}::#{name}"
260
- enum = REnum.new(name)
261
- cursor.visit_children(false) do |cu,_|
262
- case cu.kind
263
- when :enum_constant_decl
264
- # for now there is no api to access these values from libclang
265
- expression = cu.expression
266
- expression.pop
267
- val = if expression.join(" ") =~ /=(.*)/
268
- $1.gsub(" ","")
269
- end
270
- enum.add_value(cu.spelling,val)
271
- end
272
- end
273
- parent.add_type(enum)
274
- enum
275
- end
276
-
277
- def process_variable(cursor,parent)
278
- name = cursor.spelling
279
- ClangParser.log.info "processing variable #{parent}::#{name}"
280
- var = process_parameter(cursor,parent)
281
- if var.type.const?
282
- parent.add_const(var)
283
- end
284
- var
285
- end
286
-
287
- def process_field(cursor,parent)
288
- name = cursor.spelling
289
- ClangParser.log.info "processing field #{parent}::#{name}"
290
- var = process_parameter(cursor,parent)
291
- # TODO check for read write access
292
- a = RAttribute.new(var.name,var.type).writeable!
293
- parent.add_attribute a
294
- a
295
- end
296
-
297
- def process_class_template(cursor,parent,access)
298
- class_name = cursor.spelling
299
- ClangParser.log.info "processing class template #{parent}::#{class_name}"
300
-
301
- klass = parent.type(class_name,false)
302
- klass = if(!klass)
303
- klass = RTemplateClass.new(class_name)
304
- parent.add_type(klass)
305
- klass
306
- else
307
- ClangParser.log.info " reopening existing class template #{klass}"
308
- klass
309
- end
310
- process(cursor,klass, access)
311
- klass
312
- end
313
-
314
- def process_class(cursor,parent,access)
315
- class_name = cursor.spelling
316
- class_name = if class_name.empty?
317
- "no_name_class"
318
- else
319
- class_name
320
- end
321
- if cursor.incomplete?
322
- ClangParser.log.info "skipping incomplete class #{parent}::#{class_name}"
323
- return
324
- else
325
- ClangParser.log.info "processing class #{parent}::#{class_name}"
326
- end
327
-
328
- klass = parent.type(class_name,false)
329
- klass = if(!klass)
330
- klass = RClass.new(class_name)
331
- parent.add_type(klass)
332
- klass
333
- else
334
- if klass.empty?
335
- ClangParser.log.info " reopening existing class #{klass}"
336
- klass
337
- elsif klass.template?
338
- ClangParser.log.info " skipping template #{name}"
339
- nil
340
- else
341
- ClangParser.log.warn " skipping non empty class #{name}"
342
- #raise "Cannot reopening existing class #{klass} which is non-empty!"
343
- nil
344
- end
345
- end
346
- #klass.extern_package_name = nil
347
- process(cursor,klass,access) if klass
348
- klass
349
- end
350
-
351
- def process_function(cursor,parent)
352
- name = cursor.spelling
353
- args = []
354
-
355
- cursor = if(cursor.specialized_template.kind == :function_template)
356
- cursor.specialized_template
357
- else
358
- cursor
359
- end
360
- cursor.visit_children() do |cu,_|
361
- case cu.kind
362
- when :parm_decl
363
- p = process_parameter(cu,parent)
364
- args << p
365
- end
366
- end
367
-
368
- # some default values are not parsed by clang
369
- # try to parse them from Tokens
370
- # and rename parameters with unknown name
371
- # to prevent name clashes
372
- expression = cursor.expression.join()
373
- args.each_with_index do |arg,idx|
374
- if(!arg.default_value && (expression =~ /#{arg.name}(=\w*)?[,)]/))
375
- if $1 and !$1.empty?
376
- arg.default_value = $1.sub("=","")
377
- end
378
- end
379
- arg.name = if(arg.name == "no_name_arg")
380
- arg.name + idx.to_s
381
- else
382
- arg.name
383
- end
384
- end
385
-
386
- result_type = if !cursor.result_type.null?
387
- process_parameter(cursor,parent,:result_type).type
388
- end
389
- op = ::Rbind::ROperation.new(name,result_type,*args)
390
- op = if cursor.static?
391
- op.to_static
392
- else
393
- op
394
- end
395
- ClangParser.log.info "add function #{op.signature}"
396
- parent.add_operation(op)
397
- op
398
- rescue RuntimeError => e
399
- ClangParser.log.info "skipping instance method #{parent.full_name}::#{name}: #{e}"
400
- nil
401
- end
402
-
403
- # type_getter is also used for :result_type
404
- def process_parameter(cursor,parent,type_getter = :type)
405
- ClangParser.log.debug "process_parameter: spelling: '#{cursor.spelling}' type: '#{cursor.type}' kind '#{cursor.type.kind} parent #{parent}"
406
- para_name = cursor.spelling
407
- para_name = if para_name.empty?
408
- "no_name_arg"
409
- else
410
- para_name
411
- end
412
- default_value = nil
413
- type_cursor = nil
414
- template_name = ""
415
- name_space = []
416
-
417
- cursor.visit_children do |cu,_|
418
- ClangParser.log.info "process parameter: cursor kind: #{cu.kind} #{cu.expression}"
419
- case cu.kind
420
- when :integer_literal
421
- exp = cu.expression
422
- exp.pop
423
- default_value = exp.join("")
424
- when :floating_literal
425
- exp = cu.expression
426
- exp.pop
427
- default_value = exp.join("")
428
- when :call_expr
429
- exp = cu.expression
430
- exp.shift
431
- exp.pop
432
- default_value = exp.join("")
433
- when :gnu_null_expr
434
- default_value = 0
435
- when :unexposed_expr
436
- exp = cu.expression
437
- exp.pop
438
- default_value = exp.join("")
439
- when :template_ref
440
- name_space << cu.spelling
441
- if !template_name.empty?
442
- template_name += "<#{name_space.join("::")}"
443
- else
444
- template_name = name_space.join("::")
445
- end
446
- name_space.clear
447
- when :namespace_ref
448
- name_space << cu.spelling
449
- when :type_ref
450
- type_cursor = cu
451
- when :compound_stmt
452
- when :parm_decl
453
- when :member_ref
454
- when :constant_array
455
- exp = cu.expression
456
- exp.pop
457
- default_value = exp.gsub("{","[")
458
- default_value = default_value.gsub("}","]")
459
- end
460
- end
461
- type = if template_name.empty?
462
- type = if type_cursor
463
- to_rbind_type(parent,type_cursor)
464
- end
465
- # just upgrade type to pointer / ref if type != nil
466
- to_rbind_type(parent,cursor,type,type_getter)
467
- else
468
- # parameter is a template type
469
- # TODO find better way to get inner type
470
- # we could use type_cursor here if given but this is
471
- # not the case for basic types and somehow the type
472
- # qualifier are not provided
473
- expression = cursor.expression.join(" ")
474
- inner_types = if expression =~ /<([ \w\*&,:]*)>/
475
- $1
476
- else
477
- raise RuntimeError,"Cannot parse template type parameter."
478
- end
479
-
480
- inner_types = inner_types.split(",").map do |inner_type|
481
- parent.type(inner_type)
482
- end
483
-
484
- templates = template_name.split("<")
485
- templates << inner_types.map(&:full_name).join(",")
486
-
487
- t = parent.type(templates.join("<")+">"*(templates.size-1),true)
488
- to_rbind_type(parent,cursor,t,type_getter)
489
- end
490
- RParameter.new(para_name,type,default_value)
491
- rescue RuntimeError => e
492
- raise ClangParserError.new(e.to_s,cursor)
493
- end
494
-
495
- def process_typedef(cu, parent)
496
- ClangParser.log.debug "process_typedef: #{cu}: expression: #{cu.expression} parent: #{parent}"
497
- exp = cu.expression.join(" ")
498
-
499
- # Remove typedef label and extract orig type and alias
500
- orig_and_alias = exp.sub("typedef","")
501
- orig_and_alias = orig_and_alias.sub(";","").strip
502
- orig_type = nil
503
- alias_type = nil
504
-
505
- if orig_and_alias =~ /(.*)\s+([^\s]+)/
506
- orig_type = $1
507
- alias_type = $2
508
- else
509
- raise RuntimeError,"Cannot parse typedef expression #{exp}"
510
- end
511
-
512
- begin
513
- t = parent.type(orig_type)
514
- ClangParser.log.debug "process_typedef: orig: '#{orig_type}' alias: #{alias_type}"
515
- parent.add_type_alias(t, alias_type)
516
- rescue RuntimeError => e
517
- ClangParser.log.warn "Cannot process typedef expression for orig: '#{orig_type}' alias: '#{alias_type}' : #{e}"
518
- end
519
- parent
520
- end
521
-
522
- end
523
- end
@@ -1,155 +0,0 @@
1
- # Author thomas.roehr@dfki.de
2
- #
3
- # Version 0.3 2013-07-02
4
- # - rely on `gem content` to find library and header
5
- # - introduce GEM_OS_PKG to allow search via pkgconfig
6
- # Version 0.2 2010-01-14
7
- # - add support for searching for multiple gems
8
- # Version 0.1 2010-12-15
9
- # - support basic search functionality
10
- # - tested to find rice
11
- #
12
- # OUTPUT:
13
- #
14
- # GEM_INCLUDE_DIRS After successful search contains the include directores
15
- #
16
- # GEM_LIBRARIES After successful search contains the full path of each found library
17
- #
18
- #
19
- # Usage:
20
- # set(GEM_DEBUG TRUE)
21
- # find_package(Gem COMPONENTS rice hoe)
22
- # include_directories(${GEM_INCLUDE_DIRS})
23
- # target_link_libraries(${GEM_LIBRARIES}
24
- #
25
- # in case pkg-config should be used to search for the os pkg, set GEM_OS_PKG, i.e.
26
- # set(GEM_OS_PKG TRUE)
27
- #
28
- # Check for how 'gem' should be called
29
- find_program(GEM_EXECUTABLE
30
- NAMES "gem${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
31
- "gem${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
32
- "gem-${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
33
- "gem-${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
34
- "gem${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}"
35
- "gem${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}"
36
- "gem-${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}"
37
- "gem-${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}"
38
- "gem")
39
-
40
- # Making backward compatible
41
- if(Gem_DEBUG)
42
- set(GEM_DEBUG TRUE)
43
- endif()
44
-
45
- if(NOT GEM_EXECUTABLE)
46
- MESSAGE(FATAL_ERROR "Could not find the gem executable - install 'gem' first")
47
- endif()
48
-
49
- if(NOT Gem_FIND_COMPONENTS)
50
- MESSAGE(FATAL_ERROR "If searching for a Gem you have to provide COMPONENTS with the name of the gem")
51
- endif()
52
-
53
- set(GEM_FOUND TRUE)
54
- foreach(Gem_NAME ${Gem_FIND_COMPONENTS})
55
- # If the gem is installed as a gem
56
- if(NOT GEM_OS_PKG)
57
- set(GEM_HOME ENV{GEM_HOME})
58
-
59
- # Use `gem content <gem-name>` to extract current information about installed gems
60
- # Store the information into ${GEM_LOCAL_INFO}
61
- EXECUTE_PROCESS(COMMAND ${GEM_EXECUTABLE} content ${Gem_NAME} OUTPUT_VARIABLE GEM_LOCAL_INFO)
62
-
63
- if("${GEM_LOCAL_INFO}" STREQUAL "")
64
- MESSAGE(FATAL_ERROR "No local gem found. Check your GEM_HOME setting!")
65
- else()
66
- set(_library_NAME_PATTERN lib${Gem_NAME}.a
67
- lib${Gem_NAME}.so
68
- lib${Gem_NAME}.dylib
69
- ${Gem_NAME}.a
70
- ${Gem_NAME}.so
71
- ${Gem_NAME}.dylib
72
- .*.a
73
- .*.so
74
- .*.dylib
75
- )
76
-
77
- set(_header_SUFFIX_PATTERN
78
- .h
79
- .hh
80
- .hpp
81
- )
82
-
83
- # Create a list from the output results of the gem command
84
- string(REPLACE "\n" ";" GEM_CONTENT_LIST ${GEM_LOCAL_INFO})
85
- foreach(_gem_CONTENT_PATH ${GEM_CONTENT_LIST})
86
-
87
- # Convert so that only '/' Unix path separator are being using
88
- # needed to do proper regex matching
89
- FILE(TO_CMAKE_PATH ${_gem_CONTENT_PATH} gem_CONTENT_PATH)
90
-
91
- # Identify library -- checking for a library in the gems 'lib' (sub)directory
92
- # Search for an existing library, but only within the gems folder
93
- foreach(_library_NAME ${_library_NAME_PATTERN})
94
- STRING(REGEX MATCH ".*${Gem_NAME}.*/lib/.*${_library_NAME}$" GEM_PATH_INFO "${gem_CONTENT_PATH}")
95
- if(NOT "${GEM_PATH_INFO}" STREQUAL "")
96
- list(APPEND GEM_LIBRARIES ${GEM_PATH_INFO})
97
- break()
98
- endif()
99
- endforeach()
100
-
101
- # Identify headers
102
- # Checking for available headers in an include directory
103
- foreach(_header_PATTERN ${_header_SUFFIX_PATTERN})
104
- STRING(REGEX MATCH ".*${Gem_NAME}.*/include/.*${_header_PATTERN}$" GEM_PATH_INFO "${gem_CONTENT_PATH}")
105
- if(NOT "${GEM_PATH_INFO}" STREQUAL "")
106
- STRING(REGEX REPLACE "(.*${Gem_NAME}.*/include/).*${_header_PATTERN}$" "\\1" GEM_PATH_INFO "${gem_CONTENT_PATH}")
107
- list(APPEND GEM_INCLUDE_DIRS ${GEM_PATH_INFO})
108
- break()
109
- endif()
110
- endforeach()
111
- endforeach()
112
-
113
- # Compact the lists
114
- if(DEFINED GEM_LIBRARIES)
115
- LIST(REMOVE_DUPLICATES GEM_LIBRARIES)
116
- endif()
117
- if(DEFINED GEM_INCLUDE_DIRS)
118
- LIST(REMOVE_DUPLICATES GEM_INCLUDE_DIRS)
119
- endif()
120
- endif()
121
- else(NOT GEM_OS_PKG)
122
- pkg_check_modules(GEM_PKG ${Gem_NAME})
123
- set(GEM_INCLUDE_DIRS ${GEM_PKG_INCLUDE_DIRS})
124
- set(GEM_LIBRARIES ${GEM_PKG_LIBRARIES} ${GEM_PKG_STATIC_LIBRARIES})
125
- list(APPEND GEM_LIBRARIES ${GEM_PKG_LDFLAGS} ${GEM_PKG_STATIC_LDFLAGS})
126
- list(APPEND GEM_LIBRARIES ${GEM_PKG_LDFLAGS_OTHER} ${GEM_PKG_STATIC_LDFLAGS_OTHER})
127
-
128
- if(GEM_DEBUG)
129
- message(STATUS "GEM_OS_PKG is defined")
130
- message(STATUS "GEM_INCLUDE_DIRS ${GEM_INCLUDE_DIRS}")
131
- message(STATUS "GEM_STATIC_LIBRARY_DIRS ${GEM_PKG_STATIC_LIBRARY_DIRS}")
132
- message(STATUS "GEM_LIBRARY_DIRS ${GEM_PKG_STATIC_LIBRARY_DIRS}")
133
- message(STATUS "GEM_STATIC_LIBRARIES ${GEM_PKG_STATIC_LIBRARIES}")
134
- message(STATUS "GEM_LIBRARIES ${GEM_LIBRARIES}")
135
- endif()
136
- endif()
137
-
138
- if("${GEM_LIBRARIES}" STREQUAL "")
139
- set(GEM_FOUND FALSE)
140
- else()
141
- MESSAGE(STATUS "Gem: ${Gem_NAME} found")
142
- endif()
143
-
144
- if(GEM_DEBUG)
145
- message(STATUS "${Gem_NAME} library dir: ${GEM_LIBRARIES}")
146
- message(STATUS "${Gem_NAME} include dir: ${GEM_INCLUDE_DIRS}")
147
- endif()
148
-
149
- if(Gem_FIND_REQUIRED)
150
- if(NOT GEM_FOUND)
151
- MESSAGE(FATAL_ERROR "Gem: ${Gem_NAME} could not be found")
152
- endif()
153
- endif()
154
- endforeach()
155
-
@@ -1,3 +0,0 @@
1
- find_package(Gem COMPONENTS REQUIRED <%= self.join(" ") %>)
2
- include_directories(${GEM_INCLUDE_DIRS})
3
-
@@ -1,11 +0,0 @@
1
- prefix=@CMAKE_INSTALL_PREFIX@
2
- exec_prefix=@CMAKE_INSTALL_PREFIX@
3
- libdir=${prefix}/lib
4
- includedir=${prefix}/include
5
-
6
- Name: @PROJECT_NAME@
7
- Description: @PROJECT_DESCRIPTION@
8
- Version: @PROJECT_VERSION@
9
- Requires: <%= pkg_config.join(" ") %>
10
- Libs: -L${libdir} -l@PROJECT_NAME@
11
- Cflags: -I${includedir}