Mercurial > hg > Members > Moririn
view src/parallel_execution/CMakeLists.txt @ 401:408b4aab7610
Supported par goto iterate statement for perl script
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Aug 2017 21:50:57 +0900 |
parents | b81492c74d2b |
children | e958a409943c |
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") 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) target_link_libraries(${_Gears_TARGET} m pthread) endmacro() GearsCommand( TARGET twice SOURCES examples/twice/twice.cbc CPUWorker.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc TimeImpl.cbc ) GearsCommand( TARGET calc SOURCES examples/calc/calc.cbc examples/calc/add.cbc examples/calc/mult.cbc examples/calc/initIntegerDataGears.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc ) GearsCommand( TARGET bitonicSort SOURCES examples/bitonicSort/bitonicSort.cbc examples/bitonicSort/swap.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc OneDimIterator.cbc TimeImpl.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/twice/CUDAtwice.cbc examples/twice/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 oneDimIterator_test SOURCES test/oneDimIterator_test.cbc test/printIterator.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc OneDimIterator.cbc TimeImpl.cbc ) GearsCommand( TARGET sort SOURCES examples/bitonicSort/sort.cbc )