Skip to content

Commit

Permalink
Move torch to its own target
Browse files Browse the repository at this point in the history
This is more cmake-y and will allow us to put torch in a link group for
koi.
  • Loading branch information
blawrence-ont committed Jul 10, 2024
1 parent 5f53469 commit 9a6f05c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ target_include_directories(dorado_lib
target_include_directories(dorado_lib
SYSTEM
PUBLIC
${TORCH_INCLUDE_DIRS}
${DORADO_3RD_PARTY_SOURCE}/HighFive/include
${DORADO_3RD_PARTY_SOURCE}/argparse
${DORADO_3RD_PARTY_SOURCE}/toml11
Expand All @@ -328,7 +327,7 @@ endif()

target_link_libraries(dorado_lib
PUBLIC
${TORCH_LIBRARIES}
torch_lib
htslib
edlib
dorado_utils
Expand Down
5 changes: 5 additions & 0 deletions cmake/Torch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,8 @@ if (USING_STATIC_TORCH_LIB)
endif()
endif()
endif()

# Create the target which other libraries can link to
add_library(torch_lib INTERFACE)
target_link_libraries(torch_lib INTERFACE ${TORCH_LIBRARIES})
target_include_directories(torch_lib SYSTEM INTERFACE ${TORCH_INCLUDE_DIRS})
2 changes: 1 addition & 1 deletion dorado/basecall/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ target_include_directories(dorado_basecall

target_link_libraries(dorado_basecall
PUBLIC
${TORCH_LIBRARIES}
torch_lib
dorado_utils
PRIVATE
${KOI_LIBRARIES}
Expand Down
2 changes: 1 addition & 1 deletion dorado/modbase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ target_include_directories(dorado_modbase

target_link_libraries(dorado_modbase
PUBLIC
${TORCH_LIBRARIES}
torch_lib
PRIVATE
dorado_utils
spdlog::spdlog
Expand Down
3 changes: 1 addition & 2 deletions dorado/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,14 @@ target_include_directories(dorado_utils
target_include_directories(dorado_utils
SYSTEM
PUBLIC
${TORCH_INCLUDE_DIRS}
${DORADO_3RD_PARTY_SOURCE}/NVTX/c/include
${DORADO_3RD_PARTY_DOWNLOAD}/metal-cpp/metal-cpp
${DORADO_3RD_PARTY_SOURCE}/toml11
)

target_link_libraries(dorado_utils
PUBLIC
${TORCH_LIBRARIES}
torch_lib
date::date
edlib
spdlog::spdlog
Expand Down
9 changes: 1 addition & 8 deletions dorado/utils/pch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ target_precompile_headers(dorado_pch

target_link_libraries(dorado_pch
PUBLIC
${TORCH_LIBRARIES}
)

# 3rdparty libs should be considered SYSTEM headers
target_include_directories(dorado_pch
SYSTEM
PUBLIC
${TORCH_INCLUDE_DIRS}
torch_lib
)

enable_warnings_as_errors(dorado_pch)

0 comments on commit 9a6f05c

Please sign in to comment.