Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change every instance of CMAKE_SOURCE_DIR to PROJECT_SOURCE DIR #66

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMake/add_intg_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ macro(add_muriscv_nn_intg_test TEST_NAME)
if(NOT ${TOOLCHAIN} STREQUAL "x86")
if(${SIMULATOR} STREQUAL "OVPsim")
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/OVPsim/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN} 1
COMMAND ${PROJECT_SOURCE_DIR}/Sim/OVPsim/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN} 1
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(${SIMULATOR} STREQUAL "Spike")
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/Spike/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN}
COMMAND ${PROJECT_SOURCE_DIR}/Sim/Spike/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(${SIMULATOR} STREQUAL "ETISS")
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/ETISS/run.sh ./${TEST_NAME}
COMMAND ${PROJECT_SOURCE_DIR}/Sim/ETISS/run.sh ./${TEST_NAME}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(${SIMULATOR} STREQUAL "Vicuna")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T ${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lld_link.ld")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T ${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lld_link.ld")
target_link_options(${TEST_NAME} PRIVATE "-nostartfiles")
target_link_libraries(${TEST_NAME} PRIVATE vicuna_crt)

Expand All @@ -51,7 +51,7 @@ macro(add_muriscv_nn_intg_test TEST_NAME)
"$<TARGET_FILE:${TEST_NAME}>.path" VERBATIM)

add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/Vicuna/run.sh "$<TARGET_FILE:${TEST_NAME}>.path"
COMMAND ${PROJECT_SOURCE_DIR}/Sim/Vicuna/run.sh "$<TARGET_FILE:${TEST_NAME}>.path"
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else()
message(FATAL_ERROR "Could not add test for specified simulator ${SIMULATOR}!")
Expand Down
14 changes: 7 additions & 7 deletions CMake/add_unit_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ macro(add_muriscv_nn_unit_test TEST_NAME)
# Create test executable
if(${SIMULATOR} STREQUAL "ETISS")
ADD_EXECUTABLE_PULPINO(${TEST_NAME}
${CMAKE_SOURCE_DIR}/Tests/TestCases/${TEST_FILE_NAME}/${TEST_FILE_NAME}.c)
${PROJECT_SOURCE_DIR}/Tests/TestCases/${TEST_FILE_NAME}/${TEST_FILE_NAME}.c)
else()
add_executable(${TEST_NAME}
${CMAKE_SOURCE_DIR}/Tests/TestCases/${TEST_FILE_NAME}/${TEST_FILE_NAME}.c)
${PROJECT_SOURCE_DIR}/Tests/TestCases/${TEST_FILE_NAME}/${TEST_FILE_NAME}.c)
endif()

target_link_libraries(${TEST_NAME} PUBLIC ${MURISCVNN_LIB}
Expand All @@ -40,18 +40,18 @@ macro(add_muriscv_nn_unit_test TEST_NAME)
if(NOT ${TOOLCHAIN} STREQUAL "x86")
if(${SIMULATOR} STREQUAL "OVPsim")
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/OVPsim/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN} 1
COMMAND ${PROJECT_SOURCE_DIR}/Sim/OVPsim/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN} 1
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(${SIMULATOR} STREQUAL "Spike")
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/Spike/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN}
COMMAND ${PROJECT_SOURCE_DIR}/Sim/Spike/run.sh ./${TEST_NAME}.elf ${RISCV_ARCH} ${VLEN} ${ELEN}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(${SIMULATOR} STREQUAL "ETISS")
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/ETISS/run.sh ./${TEST_NAME}
COMMAND ${PROJECT_SOURCE_DIR}/Sim/ETISS/run.sh ./${TEST_NAME}
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
elseif(${SIMULATOR} STREQUAL "Vicuna")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T ${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lld_link.ld")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T ${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lld_link.ld")
target_link_options(${TEST_NAME} PRIVATE "-nostartfiles")
target_link_libraries(${TEST_NAME} PRIVATE vicuna_crt)

Expand All @@ -68,7 +68,7 @@ macro(add_muriscv_nn_unit_test TEST_NAME)
"$<TARGET_FILE:${TEST_NAME}>.path" VERBATIM)

add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/Sim/Vicuna/run.sh "$<TARGET_FILE:${TEST_NAME}>.path"
COMMAND ${PROJECT_SOURCE_DIR}/Sim/Vicuna/run.sh "$<TARGET_FILE:${TEST_NAME}>.path"
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
else()
message(FATAL_ERROR "Could not add test for specified simulator ${SIMULATOR}!")
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ endif()
project(muriscvnn LANGUAGES C CXX ASM DESCRIPTION "muRISCV-NN, a CMSIS-NN port for RISC-V.")

# This is the main library we are building, resolves to project name
set(MURISCVNN_LIB ${CMAKE_PROJECT_NAME})
set(MURISCVNN_LIB ${PROJECT_NAME})

# See whats going in CMake while getting the build process up and running
set(CMAKE_VERBOSE_MAKEFILE ON)
Expand Down
4 changes: 2 additions & 2 deletions Integration/tflm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ target_include_directories(tflm PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/third_party/kissfft
${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers
${CMAKE_CURRENT_SOURCE_DIR}/third_party/flatbuffers/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN
)

if(${TOOLCHAIN} STREQUAL "LLVM")
Expand Down
20 changes: 10 additions & 10 deletions Integration/tvm/aww/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ if(${SIMULATOR} STREQUAL "Vicuna")
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include

${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt
)

target_sources(${TEST_NAME}_tvm PRIVATE
Expand All @@ -54,19 +54,19 @@ if(${SIMULATOR} STREQUAL "Vicuna")
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}_data/${TEST_NAME}_output_data_ref.cc
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}_data/${TEST_NAME}_output_data_ref.h

${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.h
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.h

${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.h
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.h
)
else()
target_include_directories(${TEST_NAME}_tvm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include
)

target_sources(${TEST_NAME}_tvm PRIVATE
Expand Down
20 changes: 10 additions & 10 deletions Integration/tvm/ic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ if(${SIMULATOR} STREQUAL "Vicuna")
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include

${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt

)

Expand All @@ -54,19 +54,19 @@ if(${SIMULATOR} STREQUAL "Vicuna")
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}_data/${TEST_NAME}_output_data_ref.cc
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}_data/${TEST_NAME}_output_data_ref.h

${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.h
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.h

${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.h
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.h
)
else()
target_include_directories(${TEST_NAME}_tvm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include
)

target_sources(${TEST_NAME}_tvm PRIVATE
Expand Down
20 changes: 10 additions & 10 deletions Integration/tvm/toy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ if(${SIMULATOR} STREQUAL "Vicuna")
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include

${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt
)

target_sources(${TEST_NAME}_tvm PRIVATE
Expand All @@ -53,19 +53,19 @@ if(${SIMULATOR} STREQUAL "Vicuna")
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}_data/${TEST_NAME}_output_data_ref.cc
${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}_data/${TEST_NAME}_output_data_ref.h

${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.h
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.h

${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.h
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.h
)
else()
target_include_directories(${TEST_NAME}_tvm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include
)

target_sources(${TEST_NAME}_tvm PRIVATE
Expand Down
4 changes: 2 additions & 2 deletions Integration/tvm/vww/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ target_include_directories(${TEST_NAME}_tvm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/runtime/include
${CMAKE_CURRENT_SOURCE_DIR}/${MLF_DIR}/codegen/host/include
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include
)

target_sources(${TEST_NAME}_tvm PRIVATE
Expand Down
10 changes: 5 additions & 5 deletions Sim/Vicuna/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
# Builds the vicuna C runtime
add_library(vicuna_crt STATIC)

target_include_directories(vicuna_crt PUBLIC ${CMAKE_SOURCE_DIR}/Sim/Vicuna)
target_include_directories(vicuna_crt PUBLIC ${PROJECT_SOURCE_DIR}/Sim/Vicuna)
target_sources(vicuna_crt PRIVATE
${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/runtime.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/crt0.S
${CMAKE_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/runtime.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/vicuna/sw/lib/uart.c
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/crt0.S
${PROJECT_SOURCE_DIR}/Sim/Vicuna/crt/vicuna_crt.c
)
6 changes: 3 additions & 3 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ option(LSTM "LSTM Support" ON)
add_library(${MURISCVNN_LIB} STATIC)

target_include_directories(${MURISCVNN_LIB} PUBLIC
${CMAKE_SOURCE_DIR}/Include
${CMAKE_SOURCE_DIR}/Include/CMSIS/NN/Include)
${PROJECT_SOURCE_DIR}/Include
${PROJECT_SOURCE_DIR}/Include/CMSIS/NN/Include)

# TODO(fabianpedd): We currently need to include the Vicuna headers in order to redirect printf
if(${SIMULATOR} STREQUAL "Vicuna")
target_include_directories(${MURISCVNN_LIB} PUBLIC ${CMAKE_SOURCE_DIR}/Sim/Vicuna)
target_include_directories(${MURISCVNN_LIB} PUBLIC ${PROJECT_SOURCE_DIR}/Sim/Vicuna)
endif()

if(BASICMATHSNN)
Expand Down
6 changes: 3 additions & 3 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ FetchContent_Declare(
)
add_definitions(-DUNITY_INCLUDE_CONFIG_H)
FetchContent_MakeAvailable(unity)
target_include_directories(unity PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Tests/TestData>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Tests/Utils>
target_include_directories(unity PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Tests/TestData>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Tests/Utils>
$<BUILD_INTERFACE:${unity_SOURCE_DIR}/src>)

if(${SIMULATOR} STREQUAL "Vicuna")
target_include_directories(unity PRIVATE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Sim/Vicuna>)
target_include_directories(unity PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Sim/Vicuna>)
endif()

add_subdirectory(TestCases)
Loading