Skip to content

Commit ee23ed1

Browse files
atassishunhoffe
andauthored
cmake: allow building the compiler standalone (AIE_INCLUDE_TESTS_AND_EXAMPLES) (#3319)
Co-authored-by: Erika Hunhoff <erika.hunhoff@amd.com>
1 parent 24197db commit ee23ed1

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,18 @@ endif()
344344

345345

346346
# Last because each of these has its own CMakeLists.txt which reloads/re-finds LLVM, thus resettings globals.
347-
add_subdirectory(programming_examples)
348-
add_subdirectory(programming_guide)
349-
add_subdirectory(test)
347+
# The test/example/tutorial subdirectories' check-* lit targets depend on AIEPythonModules, so they
348+
# require the Python bindings. Gate them behind an option that is forced OFF when the bindings are
349+
# off (mirroring how AIE_ENABLE_BINDINGS_PYTHON itself is defined above), so the compiler can be
350+
# configured and built standalone with a single -DAIE_ENABLE_BINDINGS_PYTHON=OFF.
351+
cmake_dependent_option(AIE_INCLUDE_TESTS_AND_EXAMPLES
352+
"Build the test/example/tutorial subdirectories (require the Python bindings)" ON
353+
"AIE_ENABLE_BINDINGS_PYTHON" OFF)
354+
if(AIE_INCLUDE_TESTS_AND_EXAMPLES)
355+
add_subdirectory(programming_examples)
356+
add_subdirectory(programming_guide)
357+
add_subdirectory(test)
358+
endif()
350359
add_subdirectory(cmake/modules)
351360

352361
get_filename_component(COMPILER_DIRECTORY ${CMAKE_CXX_COMPILER} DIRECTORY)

0 commit comments

Comments
 (0)