Project

General

Profile

Feature #107 » top.CMakeLists.txt

Arnaud Degroote, 2017-03-22 17:41

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

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

cmake_minimum_required(VERSION 3.6)

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

include(FindPkgConfig)
pkg_check_modules(GENOM3 REQUIRED genom3)
pkg_get_variable(GENOM3_TOOL genom3 GENOM_TOOL)

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

add_custom_command(
COMMAND ${GENOM3_TOOL} mappings --signature -l <"$if"> ${CMAKE_SOURCE_DIR}/<"$input"> > <"$h">
DEPENDS ${CMAKE_SOURCE_DIR}/<"$input">
OUTPUT <"$h">
COMMENT "Generating mapping"
)

<' dict set hlist $h $if'>
add_library(lib<"[$c name]">_codels STATIC
<"$h">
codels/<"[$c name]_codels[fileext]">
<' foreach t [$c tasks] {'>
codels/<"[$c name]_[$t name]_codels[fileext]">
<' }'>
)

target_include_directories(lib<"[$c name]">_codels
PRIVATE
${CMAKE_BINARY_DIR}
${GENOM3_INCLUDE_DIRS}
)

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