Skip to content

Commit

Permalink
Merge branch 'DOR-482-pch-target' into 'master'
Browse files Browse the repository at this point in the history
[DOR-482] Split the PCH out into a separate target

Closes DOR-482

See merge request machine-learning/dorado!772
  • Loading branch information
blawrence-ont committed Dec 18, 2023
2 parents 55d09f9 + d526743 commit 786fe64
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
4 changes: 0 additions & 4 deletions dorado/basecall/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,4 @@ enable_warnings_as_errors(dorado_basecall)

if (DORADO_ENABLE_PCH)
target_precompile_headers(dorado_basecall REUSE_FROM dorado_utils)
# these are defined publicly by minimap2, which we're not using.
# we need to define them here so that the environment matches the one
# used when building the PCH
target_compile_definitions(dorado_basecall PRIVATE PTW32_CLEANUP_C PTW32_STATIC_LIB)
endif()
4 changes: 0 additions & 4 deletions dorado/modbase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,4 @@ enable_warnings_as_errors(dorado_modbase)

if (DORADO_ENABLE_PCH)
target_precompile_headers(dorado_modbase REUSE_FROM dorado_utils)
# these are defined publicly by minimap2, which we're not using.
# we need to define them here so that the environment matches the one
# used when building the PCH
target_compile_definitions(dorado_modbase PRIVATE PTW32_CLEANUP_C PTW32_STATIC_LIB)
endif()
13 changes: 6 additions & 7 deletions dorado/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ target_compile_definitions(dorado_utils
DORADO_GPU_BUILD=$<BOOL:${DORADO_GPU_BUILD}>
)

if (DORADO_ENABLE_PCH)
target_precompile_headers(dorado_utils
PRIVATE
"precompiled.h"
)
endif()

target_include_directories(dorado_utils
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/..
Expand All @@ -103,6 +96,12 @@ target_link_libraries(dorado_utils
htslib
)

if (DORADO_ENABLE_PCH)
add_subdirectory(pch)
target_link_libraries(dorado_utils PUBLIC dorado_pch)
target_precompile_headers(dorado_utils REUSE_FROM dorado_pch)
endif()

if(APPLE AND DORADO_GPU_BUILD)
add_dependencies(dorado_utils metal-lib)
target_link_libraries(
Expand Down
23 changes: 23 additions & 0 deletions dorado/utils/pch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
add_library(dorado_pch
precompiled.cpp
precompiled.h
)

target_precompile_headers(dorado_pch
PUBLIC
precompiled.h
)

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}
)

enable_warnings_as_errors(dorado_pch)
1 change: 1 addition & 0 deletions dorado/utils/pch/precompiled.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "precompiled.h"
File renamed without changes.

0 comments on commit 786fe64

Please sign in to comment.