Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 48ec08e

Browse files
author
Sven Verdoolaege
committed
generate templated isl types
1 parent 8abca14 commit 48ec08e

File tree

4 files changed

+822
-1
lines changed

4 files changed

+822
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ message(STATUS "Found ATen.so file: ${ATEN_LIBRARIES}")
225225
################################################################################
226226
# use locally generated C++ bindings
227227
include_directories(AFTER ${PROJECT_SOURCE_DIR}/isl_interface/include)
228+
include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/isl_interface/include)
228229
include_directories(AFTER ${PROJECT_SOURCE_DIR}/third-party/islpp/include)
229230
include_directories(AFTER ${CMAKE_CURRENT_BINARY_DIR}/third-party/islpp/include)
230231
add_subdirectory(external/isl)

isl_interface/CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@ add_custom_command(
106106
COMMAND cat ${ISL_DIR}/cpp/cpp.h.bot >> ${ISL_CPP_H} || exit 1
107107
DEPENDS extract_isl_interface
108108
)
109+
110+
add_executable(generate_template_isl generate_template_isl.cc)
111+
112+
find_program(CLANG_FORMAT_BIN clang-format PATHS ${CLANG_PREFIX}
113+
PATH_SUFFIXES bin
114+
NO_DEFAULT_PATH)
115+
116+
SET(ISL_TEMPLATE_CPP_H "${CMAKE_CURRENT_BINARY_DIR}/include/isl/template_cpp.h")
117+
add_custom_command(
118+
OUTPUT ${ISL_TEMPLATE_CPP_H}
119+
DEPENDS ${ISL_CPP_H}
120+
DEPENDS generate_template_isl
121+
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include/isl
122+
COMMAND generate_template_isl < ${ISL_CPP_H} > ${ISL_TEMPLATE_CPP_H}
123+
COMMAND ${CLANG_FORMAT_BIN} -i ${ISL_TEMPLATE_CPP_H}
124+
)
125+
109126
# generate_isl_cpp_h is the dependency that should be used
110127
# by code that depends on the isl C++ bindings.
111-
add_custom_target(generate_isl_cpp_h DEPENDS ${ISL_CPP_H})
128+
add_custom_target(generate_isl_cpp_h DEPENDS ${ISL_CPP_H} ${ISL_TEMPLATE_CPP_H})

0 commit comments

Comments
 (0)