Mercurial > hg > Members > Moririn
view src/parallel_execution/CMakeLists.txt @ 365:51b7e4eb9ade
Revert perl script
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 29 Jun 2017 18:33:02 +0900 |
parents | a0a3301bac4d |
children | fb50cf8aa615 |
line wrap: on
line source
cmake_minimum_required(VERSION 2.8) set(USE_CUDA,0) # -DUSE_CUDA # add_definitions("-Wall -g -O") set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) add_definitions("-Wall -g") set(CMAKE_C_FLAGS "-lpthread") if (${USE_CUDA}) include_directories("/usr/local/cuda/include") set(NVCCFLAG "-std=c++11" "-g" "-O0" ) set(CUDA_LINK_FLAGS "-framework CUDA -lc++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Developer/NVIDIA/CUDA-8.0/lib/libcudart_static.a -Wl,-rpath,/usr/local/cuda/lib") find_package(CUDA REQUIRED) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" ) endif() 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) 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 examples/twice.cbc CPUWorker.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc TimeImpl.cbc ) GearsCommand( TARGET calc SOURCES examples/calc.cbc examples/Add.cbc examples/Mult.cbc examples/InitIntegerDataGears.cbc CPUWorker.cbc time.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc ) if (${USE_CUDA}) GearsCommand( TARGET CUDAtwice SOURCES main.cbc RedBlackTree.cbc compare.c SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc CUDAWorker.cbc examples/CUDAtwice.cbc examples/CUDAtwice.cu cuda.c ) set_target_properties(CUDAtwice PROPERTIES COMPILE_FLAGS "-Wall -g -DUSE_CUDAWorker=1 -DUSE_CUDA_MAIN_THREAD") endif() GearsCommand( TARGET queue_test SOURCES test/queue_test.cbc SingleLinkedQueue.cbc ) GearsCommand( TARGET stack_test SOURCES test/stack_test.cbc SingleLinkedStack.cbc ) GearsCommand( TARGET sort SOURCES examples/sort.cbc )