Skip to content

Commit

Permalink
The library is the authority on include dir locations, not the consum…
Browse files Browse the repository at this point in the history
…ers (#16164)

### Ticket
#14001 

### Problem description
The tests are not delegating to the library to be informed of include
dirs. This hinders refactoring.

### What's changed
Have the tests get a list of include dirs from the library itself.
Still not ideal, but this will ease refactoring to improve matters
further.

### Checklist
- [x] Post commit CI passes
https://github.com/tenstorrent/tt-metal/actions/runs/12422615897
  • Loading branch information
afuller-TT authored Jan 7, 2025
1 parent 282a7b2 commit ebbdece
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 47 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
enable_testing()
include(GoogleTest)
add_library(test_common_libs INTERFACE)
target_include_directories(test_common_libs INTERFACE "$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>")
target_link_libraries(
test_common_libs
INTERFACE
Expand Down
7 changes: 1 addition & 6 deletions tests/tt_metal/distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ target_link_libraries(
test_common_libs
)

target_include_directories(
distributed_unit_tests
PRIVATE
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/distributed
)
target_include_directories(distributed_unit_tests PRIVATE "$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>")

set_target_properties(
distributed_unit_tests
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ foreach(TEST_SRC ${TT_METAL_TESTS_SRCS})
target_include_directories(
${TEST}
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${CMAKE_CURRENT_SOURCE_DIR}
)
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ target_link_libraries(
target_include_directories(
unit_tests_api
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/debug_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ target_link_libraries(unit_tests_debug_tools PRIVATE test_metal_common_libs)
target_include_directories(
unit_tests_debug_tools
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/device/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ target_link_libraries(unit_tests_device PUBLIC test_metal_common_libs)
target_include_directories(
unit_tests_device
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/dispatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ target_include_directories(
unit_tests_dispatch
PRIVATE
${UMD_HOME}
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ target_link_libraries(unit_tests_dispatch_buffer_o PRIVATE test_metal_common_lib
target_include_directories(
unit_tests_dispatch_buffer_o
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ target_link_libraries(unit_tests_dispatch_event_o PRIVATE test_metal_common_libs
target_include_directories(
unit_tests_dispatch_event_o
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ target_link_libraries(unit_tests_dispatch_program_o PRIVATE test_metal_common_li
target_include_directories(
unit_tests_dispatch_program_o
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ target_link_libraries(unit_tests_dispatch_trace_o PRIVATE test_metal_common_libs
target_include_directories(
unit_tests_dispatch_trace_o
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/dispatch
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/eth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ target_link_libraries(unit_tests_eth PUBLIC test_metal_common_libs)
target_include_directories(
unit_tests_eth
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ target_link_libraries(unit_tests_integration PUBLIC test_metal_common_libs)
target_include_directories(
unit_tests_integration
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/llk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ target_link_libraries(unit_tests_llk PUBLIC test_metal_common_libs)
target_include_directories(
unit_tests_llk
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/noc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ target_link_libraries(unit_tests_noc PUBLIC test_metal_common_libs)
target_include_directories(
unit_tests_noc
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/perf_microbenchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ foreach(TEST_SRC ${PERF_MICROBENCH_TESTS_SRCS})
target_include_directories(
${TEST_TARGET}
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/ttnn/cpp/ttnn/deprecated # this all should go away and be replaced with link to ttnn
${PROJECT_SOURCE_DIR}/tt_metal/common
${PROJECT_SOURCE_DIR}/tests
${CMAKE_CURRENT_SOURCE_DIR}
)
Expand Down
4 changes: 1 addition & 3 deletions tests/tt_metal/tt_metal/stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ target_link_libraries(unit_tests_stl PUBLIC test_metal_common_libs)
target_include_directories(
unit_tests_stl
PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/tt_metal
${PROJECT_SOURCE_DIR}/tt_metal/common
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tests/tt_metal/tt_metal/common
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
2 changes: 2 additions & 0 deletions tt_metal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ target_include_directories(
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
include
PRIVATE
common # FIXME: Clean up the tests and remove this
)
target_compile_options(tt_metal PUBLIC -Wno-int-to-pointer-cast)
add_dependencies(tt_metal hw_toolchain)
Expand Down

0 comments on commit ebbdece

Please sign in to comment.