Mercurial > hg > CbC > CbC_xv6
diff src/CMakeLists.txt @ 69:f236eba62a76
off-the-shelf cmakefile
author | anatofuz |
---|---|
date | Sun, 28 Jul 2019 20:03:15 +0900 |
parents | 101b229f182d |
children | 1e1c6feb7d83 |
line wrap: on
line diff
--- a/src/CMakeLists.txt Fri Jul 26 19:41:26 2019 +0900 +++ b/src/CMakeLists.txt Sun Jul 28 20:03:15 2019 +0900 @@ -22,6 +22,7 @@ if (${USE_CUDA}) include_directories("/usr/local/cuda/include") + include_directories(${CMAKE_SOURCE_DIR}) set(NVCCFLAG "-std=c++11" "-g" "-O0" ) if (UNIX AND NOT APPLE) # LINUX set(CUDA_LINK_FLAGS "-L/usr/local/cuda/lib64 -lcuda -lcudart") @@ -44,6 +45,7 @@ set( _ONE_VALUE_ARGS TARGET ) set( _MULTI_VALUE_ARGS SOURCES ) cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) + set(CMAKE_KERNEL_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_Gears_TARGET}.dir") set (_Gears_CBC_SOURCES) set (_Gears_CSOURCES) @@ -51,15 +53,16 @@ if (${i} MATCHES "\\.cbc") string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) add_custom_command ( - OUTPUT ${j} + OUTPUT ${CMAKE_KERNEL_OUTPUT_DIR}/${j} DEPENDS ${i} - COMMAND "perl" "gearsTools/generate_stub.pl" "-o" ${j} ${i} + COMMAND "perl" "${CMAKE_SOURCE_DIR}/gearsTools/generate_stub.pl" "-o" ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_Gears_TARGET}.dir/${j} ${CMAKE_SOURCE_DIR}/${i} ) + # list(APPEND _Gears_CBC_SOURCES "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_Gears_TARGET}.dir/${j}") list(APPEND _Gears_CBC_SOURCES ${j}) elseif (${i} MATCHES "\\.cu") string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) add_custom_command ( - OUTPUT ${j} + OUTPUT ${CMAKE_KERNEL_OUTPUT_DIR}/${j} DEPENDS ${i} COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i} ) @@ -72,9 +75,9 @@ #target_link_libraries(syslib) add_custom_command ( - OUTPUT c/${_Gears_TARGET}-context.c + OUTPUT ${CMAKE_KERNEL_OUTPUT_DIR}/c/${_Gears_TARGET}-context.c DEPENDS ${_Gears_CBC_SOURCES} fs.img initcode - COMMAND "perl" "gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CBC_SOURCES} + COMMAND "perl" "${CMAKE_SOURCE_DIR}/gearsTools/generate_context.pl" "-o" ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_Gears_TARGET} ${_Gears_CBC_SOURCES} ) add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c ) # target_link_libraries(${_Gears_TARGET} m pthread) @@ -87,7 +90,7 @@ add_custom_command( OUTPUT initcode DEPENDS initcode.o - COMMAND "arm-none-eabi-objcopy" "-S" "-O" "binary" "--prefix-symbols=\"_binary_build/initcode\"" "initcode.o" "initcode" + COMMAND "arm-none-eabi-objcopy" "-S" "-O" "binary" "--prefix-symbols=\"_binary_build/initcode\"" "${CMAKE_BINARY_DIR}/initcode.o" "${CMAKE_BINARY_DIR}/initcode" ) GearsCommand ( @@ -98,4 +101,3 @@ start.c swtch.S syscall.cbc sysfile.cbc sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c entry.S ) -