view src/parallel_execution/CMakeLists.txt @ 280:2c2e4e597eb0

generate no compile errors
author mir3636
date Fri, 03 Feb 2017 17:47:27 +0900
parents 23767f714f4a
children fd470e090403
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)

# -DUSE_CUDA
#  add_definitions("-Wall -g -O")
add_definitions("-Wall -g")

set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
 
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}
            )
        else()
            set(j ${i})
        endif()
        list(APPEND _Gears_CSOURCES ${j})
    endforeach(i) 

    add_custom_command (
          OUTPUT    c/${_Gears_TARGET}-context.c 
          DEPENDS   ${_Gears_CSOURCES}
          COMMAND  "perl" "generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CSOURCES}
    )
    add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c)
endmacro()


GearsCommand(
  TARGET
      twice
  SOURCES 
    main.cbc RedBlackTree.cbc compare.c SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc
)

GearsCommand(
  TARGET
      queue_test
  SOURCES 
      test/queue_test.c SingleLinkedQueue.cbc
)

GearsCommand(
  TARGET
      stack_test
  SOURCES 
      test/stack_test.c SingleLinkedStack.cbc
)