Skip to content

Commit

Permalink
[CMAKE] Automatically detect newly added source files (apache#9611)
Browse files Browse the repository at this point in the history
* [CMAKE] Automatically detect newly added source files

Before this commit, newly added or removed source files were not
detected by cmake. This manifested either as file not found errors from
the compiler (when files were deleted) or packedfuncs not being found
(when files were added). This commit uses the CONFIGURE_DEPENDS option
of cmake's `file(GLOB)` function to ask the build system to check for
new files on every rebuild. Checking for new files adds a slight but
negligible overhead to each build, but is better than unexpected errors.

* remove unnessesary configure_depends
  • Loading branch information
Tristan Konolige authored and ylc committed Jan 7, 2022
1 parent ed60463 commit 78206d1
Show file tree
Hide file tree
Showing 37 changed files with 118 additions and 100 deletions.
38 changes: 19 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ if(BUILD_FOR_ANDROID)
endif()

# add source group
FILE(GLOB_RECURSE GROUP_SOURCE "src/*.cc")
FILE(GLOB_RECURSE GROUP_INCLUDE "src/*.h" "include/*.h")
tvm_file_glob(GLOB_RECURSE GROUP_SOURCE "src/*.cc")
tvm_file_glob(GLOB_RECURSE GROUP_INCLUDE "src/*.h" "include/*.h")
assign_source_group("Source" ${GROUP_SOURCE})
assign_source_group("Include" ${GROUP_INCLUDE})

# Source file lists
file(GLOB_RECURSE COMPILER_SRCS
tvm_file_glob(GLOB_RECURSE COMPILER_SRCS
src/auto_scheduler/*.cc
src/meta_schedule/*.cc
src/node/*.cc
Expand All @@ -278,29 +278,29 @@ file(GLOB_RECURSE COMPILER_SRCS
src/support/*.cc
)

file(GLOB CODEGEN_SRCS
tvm_file_glob(GLOB CODEGEN_SRCS
src/target/*.cc
src/target/source/*.cc
)

list(APPEND COMPILER_SRCS ${CODEGEN_SRCS})

file(GLOB_RECURSE RELAY_OP_SRCS
tvm_file_glob(GLOB_RECURSE RELAY_OP_SRCS
src/relay/op/*.cc
)
file(GLOB_RECURSE RELAY_PASS_SRCS
tvm_file_glob(GLOB_RECURSE RELAY_PASS_SRCS
src/relay/analysis/*.cc
src/relay/transforms/*.cc
src/relay/quantize/*.cc
)
file(GLOB RELAY_BACKEND_SRCS
tvm_file_glob(GLOB RELAY_BACKEND_SRCS
src/relay/backend/*.cc
src/relay/backend/vm/*.cc
)
file(GLOB_RECURSE RELAY_IR_SRCS
tvm_file_glob(GLOB_RECURSE RELAY_IR_SRCS
src/relay/ir/*.cc
)
file(GLOB_RECURSE RELAY_QNN_SRCS
tvm_file_glob(GLOB_RECURSE RELAY_QNN_SRCS
src/relay/qnn/*.cc
)
list(APPEND COMPILER_SRCS ${RELAY_OP_SRCS})
Expand All @@ -309,11 +309,11 @@ list(APPEND COMPILER_SRCS ${RELAY_BACKEND_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_IR_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_QNN_SRCS})

file(GLOB DATATYPE_SRCS src/target/datatype/*.cc)
tvm_file_glob(GLOB DATATYPE_SRCS src/target/datatype/*.cc)
list(APPEND COMPILER_SRCS ${DATATYPE_SRCS})
list(APPEND COMPILER_SRCS "src/target/datatype/myfloat/myfloat.cc")

file(GLOB RUNTIME_SRCS
tvm_file_glob(GLOB RUNTIME_SRCS
src/runtime/*.cc
src/runtime/vm/*.cc
)
Expand Down Expand Up @@ -349,12 +349,12 @@ endif()

if(USE_RPC)
message(STATUS "Build with RPC support...")
file(GLOB RUNTIME_RPC_SRCS src/runtime/rpc/*.cc)
tvm_file_glob(GLOB RUNTIME_RPC_SRCS src/runtime/rpc/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_RPC_SRCS})
endif(USE_RPC)

file(GLOB STACKVM_RUNTIME_SRCS src/runtime/stackvm/*.cc)
file(GLOB STACKVM_CODEGEN_SRCS src/target/stackvm/*.cc)
tvm_file_glob(GLOB STACKVM_RUNTIME_SRCS src/runtime/stackvm/*.cc)
tvm_file_glob(GLOB STACKVM_CODEGEN_SRCS src/target/stackvm/*.cc)
list(APPEND COMPILER_SRCS ${STACKVM_CODEGEN_SRCS})
if(USE_STACKVM_RUNTIME)
message(STATUS "Build with stackvm support in runtime...")
Expand All @@ -379,7 +379,7 @@ endif(USE_GRAPH_RUNTIME_DEBUG AND NOT DEFINED USE_PROFILER)

if(USE_GRAPH_EXECUTOR)
message(STATUS "Build with Graph Executor support...")
file(GLOB RUNTIME_GRAPH_EXECUTOR_SRCS src/runtime/graph_executor/*.cc)
tvm_file_glob(GLOB RUNTIME_GRAPH_EXECUTOR_SRCS src/runtime/graph_executor/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_GRAPH_EXECUTOR_SRCS})

endif(USE_GRAPH_EXECUTOR)
Expand All @@ -399,12 +399,12 @@ endif()
if(USE_PROFILER)
message(STATUS "Build with profiler...")

file(GLOB RUNTIME_GRAPH_EXECUTOR_DEBUG_SRCS src/runtime/graph_executor/debug/*.cc)
tvm_file_glob(GLOB RUNTIME_GRAPH_EXECUTOR_DEBUG_SRCS src/runtime/graph_executor/debug/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_GRAPH_EXECUTOR_DEBUG_SRCS})
set_source_files_properties(${RUNTIME_GRAPH_EXECUTOR_SRCS}
PROPERTIES COMPILE_DEFINITIONS "TVM_GRAPH_EXECUTOR_DEBUG")

file(GLOB RUNTIME_VM_PROFILER_SRCS src/runtime/vm/profiler/*.cc)
tvm_file_glob(GLOB RUNTIME_VM_PROFILER_SRCS src/runtime/vm/profiler/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_VM_PROFILER_SRCS})
endif(USE_PROFILER)

Expand All @@ -429,7 +429,7 @@ endif()

if(USE_PIPELINE_EXECUTOR)
message(STATUS "Build with Pipeline Executor support...")
file(GLOB RUNTIME_PIPELINE_SRCS src/runtime/pipeline/*.cc)
tvm_file_glob(GLOB RUNTIME_PIPELINE_SRCS src/runtime/pipeline/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
endif(USE_PIPELINE_EXECUTOR)

Expand Down Expand Up @@ -630,7 +630,7 @@ endif()
# Create the `cpptest` target if we can find GTest. If not, we create dummy
# targets that give the user an informative error message.
if(GTEST_FOUND)
file(GLOB_RECURSE TEST_SRCS tests/cpp/*.cc)
tvm_file_glob(GLOB_RECURSE TEST_SRCS tests/cpp/*.cc)
add_executable(cpptest ${TEST_SRCS})
# include runtime files for unit testing
target_include_directories(cpptest PUBLIC "src/runtime")
Expand Down
2 changes: 1 addition & 1 deletion cmake/libs/Libbacktrace.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ExternalProject_Add(project_libbacktrace
)

# Custom step to rebuild libbacktrace if any of the source files change
file(GLOB LIBBACKTRACE_SRCS "${CMAKE_CURRENT_LIST_DIR}/../../3rdparty/libbacktrace/*.c")
tvm_file_glob(GLOB LIBBACKTRACE_SRCS "${CMAKE_CURRENT_LIST_DIR}/../../3rdparty/libbacktrace/*.c")
ExternalProject_Add_Step(project_libbacktrace checkout
DEPENDERS configure
DEPENDEES download
Expand Down
10 changes: 5 additions & 5 deletions cmake/modules/CUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(USE_CUDA)
message(FATAL_ERROR "Cannot find CUDA, USE_CUDA=" ${USE_CUDA})
endif()
message(STATUS "Build with CUDA ${CUDA_VERSION} support")
file(GLOB RUNTIME_CUDA_SRCS src/runtime/cuda/*.cc)
tvm_file_glob(GLOB RUNTIME_CUDA_SRCS src/runtime/cuda/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_CUDA_SRCS})
list(APPEND COMPILER_SRCS src/target/opt/build_cuda_on.cc)

Expand All @@ -41,15 +41,15 @@ if(USE_CUDA)
if(USE_CUDNN)
message(STATUS "Build with cuDNN support")
include_directories(SYSTEM ${CUDA_CUDNN_INCLUDE_DIRS})
file(GLOB CONTRIB_CUDNN_SRCS src/runtime/contrib/cudnn/*.cc)
tvm_file_glob(GLOB CONTRIB_CUDNN_SRCS src/runtime/contrib/cudnn/*.cc)
list(APPEND RUNTIME_SRCS ${CONTRIB_CUDNN_SRCS})
list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_CUDNN_LIBRARY})
include_directories(${USE_CUDNN}/include)
endif(USE_CUDNN)

if(USE_CUBLAS)
message(STATUS "Build with cuBLAS support")
file(GLOB CONTRIB_CUBLAS_SRCS src/runtime/contrib/cublas/*.cc)
tvm_file_glob(GLOB CONTRIB_CUBLAS_SRCS src/runtime/contrib/cublas/*.cc)
list(APPEND RUNTIME_SRCS ${CONTRIB_CUBLAS_SRCS})
list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_CUBLAS_LIBRARY})
if(NOT CUDA_CUBLASLT_LIBRARY STREQUAL "CUDA_CUBLASLT_LIBRARY-NOTFOUND")
Expand All @@ -62,7 +62,7 @@ if(USE_CUDA)
cmake_minimum_required(VERSION 3.13) # to compile CUDA code
enable_language(CUDA)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda")
file(GLOB CONTRIB_THRUST_SRC src/runtime/contrib/thrust/*.cu)
tvm_file_glob(GLOB CONTRIB_THRUST_SRC src/runtime/contrib/thrust/*.cu)
list(APPEND RUNTIME_SRCS ${CONTRIB_THRUST_SRC})
endif(USE_THRUST)

Expand All @@ -74,7 +74,7 @@ if(USE_CUDA)
message(FATAL_ERROR "CUDA Graph requires CUDA 10 or above, got=" ${CUDAToolkit_VERSION})
endif()
message(STATUS "Build with Graph executor with CUDA Graph support...")
file(GLOB RUNTIME_CUDA_GRAPH_SRCS src/runtime/graph_executor/cuda_graph/*.cc)
tvm_file_glob(GLOB RUNTIME_CUDA_GRAPH_SRCS src/runtime/graph_executor/cuda_graph/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_CUDA_GRAPH_SRCS})
endif()
else(USE_CUDA)
Expand Down
12 changes: 6 additions & 6 deletions cmake/modules/Hexagon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function(find_hexagon_toolchain)
set(TRY_PATH "${USE_HEXAGON_SDK}")
endif()
message(STATUS "Looking for Hexagon toolchain in ${TRY_PATH}")
file(GLOB_RECURSE HEXAGON_CLANG "${TRY_PATH}/*/hexagon-clang++")
tvm_file_glob(GLOB_RECURSE HEXAGON_CLANG "${TRY_PATH}/*/hexagon-clang++")
if(HEXAGON_CLANG)
# The path is ${HEXAGON_TOOLCHAIN}/bin/hexagon-clang++.
get_filename_component(HEXAGON_TMP0 "${HEXAGON_CLANG}" DIRECTORY)
Expand Down Expand Up @@ -309,7 +309,7 @@ endif()
if(USE_HEXAGON_DEVICE STREQUAL "${PICK_SIM}")
find_hexagon_toolchain()
message(STATUS "Hexagon toolchain: ${HEXAGON_TOOLCHAIN}")
file(GLOB RUNTIME_HEXAGON_SIM_SRCS src/runtime/hexagon/android/sim/*.cc)
tvm_file_glob(GLOB RUNTIME_HEXAGON_SIM_SRCS src/runtime/hexagon/android/sim/*.cc)
include_directories(SYSTEM "${HEXAGON_TOOLCHAIN}/include/iss")
link_directories("${HEXAGON_TOOLCHAIN}/lib/iss")
list(APPEND TVM_RUNTIME_LINKER_LIBS "-lwrapper")
Expand All @@ -324,7 +324,7 @@ if(USE_HEXAGON_DEVICE STREQUAL "${PICK_SIM}")
elseif(USE_HEXAGON_DEVICE STREQUAL "${PICK_HW}")
find_hexagon_sdk_root("${USE_HEXAGON_SDK}" "${USE_HEXAGON_ARCH}")
find_hexagon_toolchain()
file(GLOB RUNTIME_HEXAGON_DEVICE_SRCS src/runtime/hexagon/android/target/*.cc)
tvm_file_glob(GLOB RUNTIME_HEXAGON_DEVICE_SRCS src/runtime/hexagon/android/target/*.cc)

include_directories(SYSTEM
${HEXAGON_SDK_INCLUDES}
Expand All @@ -342,14 +342,14 @@ endif()
set(RUNTIME_HEXAGON_COMMON_SRCS src/runtime/hexagon/hexagon_module.cc)
if (USE_HEXAGON_DEVICE STREQUAL "${PICK_NONE}")
if(BUILD_FOR_HEXAGON)
file(GLOB RUNTIME_HEXAGON_SRCS src/runtime/hexagon/hexagon/*.cc)
tvm_file_glob(GLOB RUNTIME_HEXAGON_SRCS src/runtime/hexagon/hexagon/*.cc)
elseif(BUILD_FOR_ANDROID AND HEXAGON_SDK_PATH_DEFINED)
list(APPEND RUNTIME_HEXAGON_SRCS src/runtime/hexagon/proxy_rpc/device_api.cc)
else()
file(GLOB RUNTIME_HEXAGON_SRCS src/runtime/hexagon/host/*.cc)
tvm_file_glob(GLOB RUNTIME_HEXAGON_SRCS src/runtime/hexagon/host/*.cc)
endif()
else()
file(GLOB RUNTIME_HEXAGON_SRCS src/runtime/hexagon/android/*.cc)
tvm_file_glob(GLOB RUNTIME_HEXAGON_SRCS src/runtime/hexagon/android/*.cc)
endif()

if(USE_HEXAGON_RPC)
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/HexagonSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function(find_hexagon_sdk_root HEXAGON_SDK_PATH HEXAGON_ARCH)

# Initial verification of the Hexagon SDK.
message(STATUS "Checking Hexagon SDK root: ${HEXAGON_SDK_PATH}")
file(GLOB_RECURSE VERSION_HEADERS "${HEXAGON_SDK_PATH}/*/version.h")
tvm_file_glob(GLOB_RECURSE VERSION_HEADERS "${HEXAGON_SDK_PATH}/*/version.h")
if(VERSION_HEADERS)
foreach(HEADER IN LISTS VERSION_HEADERS)
if(HEADER MATCHES "incs/version.h$")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/LLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if(NOT ${USE_LLVM} MATCHES ${IS_FALSE_PATTERN})
message(STATUS "Set TVM_LLVM_VERSION=" ${TVM_LLVM_VERSION})
# Set flags that are only needed for LLVM target
add_definitions(-DTVM_LLVM_VERSION=${TVM_LLVM_VERSION})
file(GLOB COMPILER_LLVM_SRCS src/target/llvm/*.cc)
tvm_file_glob(GLOB COMPILER_LLVM_SRCS src/target/llvm/*.cc)
list(APPEND TVM_LINKER_LIBS ${LLVM_LIBS})
list(APPEND COMPILER_SRCS ${COMPILER_LLVM_SRCS})
if(NOT MSVC)
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/Metal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ if(USE_METAL)
message(STATUS "Build with Metal support")
find_library(METAL_LIB Metal)
find_library(FOUNDATION_LIB Foundation)
file(GLOB RUNTIME_METAL_SRCS src/runtime/metal/*.mm)
tvm_file_glob(GLOB RUNTIME_METAL_SRCS src/runtime/metal/*.mm)
list(APPEND TVM_RUNTIME_LINKER_LIBS ${METAL_LIB} ${FOUNDATION_LIB})
list(APPEND RUNTIME_SRCS ${RUNTIME_METAL_SRCS})

if(USE_MPS)
file(GLOB MPS_CONTRIB_SRC src/runtime/contrib/mps/*.mm)
tvm_file_glob(GLOB MPS_CONTRIB_SRC src/runtime/contrib/mps/*.mm)
list(APPEND RUNTIME_SRCS ${MPS_CONTRIB_SRC})
find_library(MPS_CONTRIB_LIB MetalPerformanceShaders)
list(APPEND TVM_RUNTIME_LINKER_LIBS ${MPS_CONTRIB_LIB})
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Micro.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

if(USE_MICRO)
message(STATUS "Build with Micro support")
file(GLOB RUNTIME_MICRO_SRCS src/runtime/micro/*.cc)
tvm_file_glob(GLOB RUNTIME_MICRO_SRCS src/runtime/micro/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_MICRO_SRCS})
endif(USE_MICRO)
6 changes: 3 additions & 3 deletions cmake/modules/OpenCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif(OpenCL_FOUND)

if(USE_SDACCEL)
message(STATUS "Build with SDAccel support")
file(GLOB RUNTIME_SDACCEL_SRCS src/runtime/opencl/sdaccel/*.cc)
tvm_file_glob(GLOB RUNTIME_SDACCEL_SRCS src/runtime/opencl/sdaccel/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_SDACCEL_SRCS})
if(NOT USE_OPENCL)
message(STATUS "Enable OpenCL support required for SDAccel")
Expand All @@ -38,7 +38,7 @@ endif(USE_SDACCEL)

if(USE_AOCL)
message(STATUS "Build with Intel FPGA SDK for OpenCL support")
file(GLOB RUNTIME_AOCL_SRCS src/runtime/opencl/aocl/*.cc)
tvm_file_glob(GLOB RUNTIME_AOCL_SRCS src/runtime/opencl/aocl/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_AOCL_SRCS})
if(NOT USE_OPENCL)
message(STATUS "Enable OpenCL support required for Intel FPGA SDK for OpenCL")
Expand All @@ -53,7 +53,7 @@ if(USE_OPENCL)
find_package(OpenCL REQUIRED)
endif()
message(STATUS "Build with OpenCL support")
file(GLOB RUNTIME_OPENCL_SRCS src/runtime/opencl/*.cc)
tvm_file_glob(GLOB RUNTIME_OPENCL_SRCS src/runtime/opencl/*.cc)
list(APPEND TVM_RUNTIME_LINKER_LIBS ${OpenCL_LIBRARIES})
list(APPEND RUNTIME_SRCS ${RUNTIME_OPENCL_SRCS})
else()
Expand Down
6 changes: 3 additions & 3 deletions cmake/modules/ROCM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(USE_ROCM)
message(FATAL_ERROR "Cannot find ROCM, USE_ROCM=" ${USE_ROCM})
endif()
message(STATUS "Build with ROCM support")
file(GLOB RUNTIME_ROCM_SRCS src/runtime/rocm/*.cc)
tvm_file_glob(GLOB RUNTIME_ROCM_SRCS src/runtime/rocm/*.cc)
list(APPEND RUNTIME_SRCS ${RUNTIME_ROCM_SRCS})
list(APPEND TVM_RUNTIME_LINKER_LIBS ${ROCM_HIPHCC_LIBRARY})
if (ROCM_HSA_LIBRARY)
Expand All @@ -40,14 +40,14 @@ if(USE_ROCM)

if(USE_MIOPEN)
message(STATUS "Build with MIOpen support")
file(GLOB MIOPEN_CONTRIB_SRCS src/runtime/contrib/miopen/*.cc)
tvm_file_glob(GLOB MIOPEN_CONTRIB_SRCS src/runtime/contrib/miopen/*.cc)
list(APPEND RUNTIME_SRCS ${MIOPEN_CONTRIB_SRCS})
list(APPEND TVM_RUNTIME_LINKER_LIBS ${ROCM_MIOPEN_LIBRARY})
endif(USE_MIOPEN)

if(USE_ROCBLAS)
message(STATUS "Build with RocBLAS support")
file(GLOB ROCBLAS_CONTRIB_SRCS src/runtime/contrib/rocblas/*.cc)
tvm_file_glob(GLOB ROCBLAS_CONTRIB_SRCS src/runtime/contrib/rocblas/*.cc)
list(APPEND RUNTIME_SRCS ${ROCBLAS_CONTRIB_SRCS})
list(APPEND TVM_RUNTIME_LINKER_LIBS ${ROCM_ROCBLAS_LIBRARY})
endif(USE_ROCBLAS)
Expand Down
6 changes: 3 additions & 3 deletions cmake/modules/StandaloneCrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

if(USE_MICRO)
message(STATUS "Build standalone CRT for microTVM")
file(GLOB crt_srcs src/runtime/crt/**)
tvm_file_glob(GLOB crt_srcs src/runtime/crt/**)

function(tvm_crt_define_targets)
# Build an isolated build directory, separate from the TVM tree.
Expand Down Expand Up @@ -63,7 +63,7 @@ if(USE_MICRO)
math(EXPR copy_dest_index "${copy_pattern_index} + 2")
list(GET job_spec ${copy_dest_index} copy_dest)

file(GLOB_RECURSE copy_files
tvm_file_glob(GLOB_RECURSE copy_files
RELATIVE "${job_src_base}"
"${job_src_base}/${copy_pattern}")
list(LENGTH copy_files copy_files_length)
Expand Down Expand Up @@ -124,7 +124,7 @@ if(USE_MICRO)
# Create the `crttest` target if we can find GTest. If not, we create dummy
# targets that give the user an informative error message.
if(GTEST_FOUND)
file(GLOB TEST_SRCS ${CMAKE_SOURCE_DIR}/tests/crt/*.cc)
tvm_file_glob(GLOB TEST_SRCS ${CMAKE_SOURCE_DIR}/tests/crt/*.cc)
add_executable(crttest ${TEST_SRCS})
target_include_directories(crttest SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/standalone_crt/include ${CMAKE_SOURCE_DIR}/src/runtime/micro)
target_link_libraries(crttest PRIVATE ${cmake_crt_libraries} GTest::GTest GTest::Main pthread dl)
Expand Down
16 changes: 8 additions & 8 deletions cmake/modules/VTA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ elseif(PYTHON)
# Fast simulator driver build
if(USE_VTA_FSIM)
# Add fsim driver sources
file(GLOB FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
file(GLOB FSIM_RUNTIME_SRCS vta/runtime/*.cc)
tvm_file_glob(GLOB FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
tvm_file_glob(GLOB FSIM_RUNTIME_SRCS vta/runtime/*.cc)
list(APPEND FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/sim/sim_driver.cc)
list(APPEND FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/sim/sim_tlpp.cc)
list(APPEND FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc)
Expand Down Expand Up @@ -85,8 +85,8 @@ elseif(PYTHON)
message(FATAL_ERROR "Cannot find Verilator, VERILATOR_INC_DIR is not defined")
endif()
# Add tsim driver sources
file(GLOB TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
file(GLOB TSIM_RUNTIME_SRCS vta/runtime/*.cc)
tvm_file_glob(GLOB TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
tvm_file_glob(GLOB TSIM_RUNTIME_SRCS vta/runtime/*.cc)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/tsim/tsim_driver.cc)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/dpi/module.cc)
list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc)
Expand All @@ -105,19 +105,19 @@ elseif(PYTHON)

# VTA FPGA driver sources
if(USE_VTA_FPGA)
file(GLOB FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
file(GLOB FPGA_RUNTIME_SRCS vta/runtime/*.cc)
tvm_file_glob(GLOB FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/*.cc)
tvm_file_glob(GLOB FPGA_RUNTIME_SRCS vta/runtime/*.cc)
# Rules for Zynq-class FPGAs with pynq OS support (see pynq.io)
if(${VTA_TARGET} STREQUAL "pynq" OR
${VTA_TARGET} STREQUAL "ultra96")
list(APPEND FPGA_RUNTIME_SRCS ${VTA_HW_PATH}/src/pynq/pynq_driver.cc)
# Rules for Pynq v2.4
find_library(__cma_lib NAMES cma PATH /usr/lib)
elseif(${VTA_TARGET} STREQUAL "de10nano") # DE10-Nano rules
file(GLOB DE10_FPGA_RUNTIME_SRCS ${VTA_HW_PATH}/src/de10nano/*.cc ${VTA_HW_PATH}/src/*.cc)
tvm_file_glob(GLOB DE10_FPGA_RUNTIME_SRCS ${VTA_HW_PATH}/src/de10nano/*.cc ${VTA_HW_PATH}/src/*.cc)
list(APPEND FPGA_RUNTIME_SRCS ${DE10_FPGA_RUNTIME_SRCS})
elseif(${VTA_TARGET} STREQUAL "intelfocl") # Intel OpenCL for FPGA rules
file(GLOB FOCL_SRC ${VTA_HW_PATH}/src/oclfpga/*.cc)
tvm_file_glob(GLOB FOCL_SRC ${VTA_HW_PATH}/src/oclfpga/*.cc)
list(APPEND FPGA_RUNTIME_SRCS ${FOCL_SRC})
list(APPEND FPGA_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc ${VTA_HW_PATH}/src/vmem/virtual_memory.h)
endif()
Expand Down
Loading

0 comments on commit 78206d1

Please sign in to comment.