Skip to content

Commit ab31797

Browse files
committed
Merge branch 'master' of github.com:halide/Halide
2 parents 720856d + 22b3f7c commit ab31797

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ foreach (i ${RUNTIME_BC} )
186186
list(APPEND INITIAL_MODULES "${INITMOD}")
187187
endforeach()
188188

189-
add_library(InitialModules STATIC
190-
${INITIAL_MODULES})
191-
192-
add_dependencies(InitialModules
193-
bitcode2cpp)
194189

195190
set(HEADER_FILES
196191
AddImageChecks.h
@@ -433,6 +428,7 @@ add_library(Halide ${HALIDE_LIBRARY_TYPE}
433428
${BITWRITER_FILES}
434429
"${CMAKE_BINARY_DIR}/include/Halide.h"
435430
${HEADER_FILES}
431+
${INITIAL_MODULES}
436432
)
437433

438434
# List of LLVM Components required
@@ -525,7 +521,12 @@ else()
525521
string(REPLACE " " ";" LIBS "${LIBS_SPACES}")
526522
endif()
527523

528-
target_link_libraries(Halide PUBLIC InitialModules ${LIBS})
524+
# When building a shared library the LLVM libraries will be
525+
# embedded in the Halide library. When building a static library
526+
# LLVM is not embedded but CMake knows that when building an executable
527+
# against the Halide static library that it needs to link LLVM too so
528+
# PRIVATE scope is the correct choice here.
529+
target_link_libraries(Halide PRIVATE ${LIBS})
529530

530531
if (NOT WIN32)
531532
if (${LLVM_VERSION} GREATER 34)
@@ -541,6 +542,6 @@ if (NOT WIN32)
541542
endif()
542543

543544
add_dependencies(Halide
544-
InitialModules
545+
bitcode2cpp
545546
build_halide_h
546547
)

0 commit comments

Comments
 (0)