view paper/src/cmakefile.1.txt @ 34:fad87973f26a

add gears flow
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 31 Jan 2021 17:37:28 +0900
parents
children
line wrap: on
line source

macro( GearsCommand )
    set( _OPTIONS_ARGS )
    set( _ONE_VALUE_ARGS TARGET )
    set( _MULTI_VALUE_ARGS SOURCES )
    cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )

    set (_Gears_CSOURCES)
    foreach(i ${_Gears_SOURCES})
        if (${i} MATCHES "\\.cbc")
            string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i})
            add_custom_command (
                OUTPUT    ${j}
                DEPENDS   ${i}
                COMMAND  "perl" "generate_stub.pl" "-o" ${j} ${i}
            )
        elseif (${i} MATCHES "\\.cu")
            string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i})
            add_custom_command (
                OUTPUT    ${j}
                DEPENDS   ${i}
                COMMAND  nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i}
            )
        else()
            set(j ${i})
        endif()
        list(APPEND _Gears_CSOURCES ${j})
    endforeach(i)