Project

General

Profile

Feature #107 ยป top.CMakeLists.txt

Arnaud Degroote, 2017-03-22 17:41

 
1
# check arguments
2
if {[llength $argv] != 3} { error "expected argument: input idls lang" }
3
lassign $argv input idls lang
4

    
5
# generate copyright notice (if any)
6
if {![catch {dotgen input notice} text]} {
7
  puts #[join [split $text "\n"] "\n#"]
8
}
9
'>
10

    
11
cmake_minimum_required(VERSION 3.6)
12

    
13
project(<"[[lindex [dotgen components] 0] name]">)
14

    
15
include(FindPkgConfig)
16
pkg_check_modules(GENOM3 REQUIRED genom3)
17
pkg_get_variable(GENOM3_TOOL genom3 GENOM_TOOL)
18

    
19
<'set hlist [dict create]'>
20
<'foreach c [dotgen components] {'>
21
<'  set if [$c lang]'>
22
<'  set h [$c name]_${if}_types[fileext header]'>
23

    
24
add_custom_command(
25
    COMMAND ${GENOM3_TOOL} mappings --signature -l <"$if"> ${CMAKE_SOURCE_DIR}/<"$input"> > <"$h">
26
    DEPENDS ${CMAKE_SOURCE_DIR}/<"$input"> 
27
    OUTPUT <"$h">
28
    COMMENT "Generating mapping"
29
)
30

    
31
<'  dict set hlist $h $if'>
32
add_library(lib<"[$c name]">_codels STATIC
33
  <"$h">
34
  codels/<"[$c name]_codels[fileext]">
35
<'  foreach t [$c tasks] {'>
36
  codels/<"[$c name]_[$t name]_codels[fileext]">
37
<'  }'>
38
)
39

    
40
target_include_directories(lib<"[$c name]">_codels
41
    PRIVATE
42
        ${CMAKE_BINARY_DIR}
43
        ${GENOM3_INCLUDE_DIRS}
44
)
45

    
46
<'}'>
    (1-1/1)