Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake jit_preprocess_files function only runs when needed #7872

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions cpp/cmake/Modules/JitifyPreprocessKernels.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
# limitations under the License.
#=============================================================================

cmake_minimum_required(VERSION 3.18)

file(MAKE_DIRECTORY "${CUDF_GENERATED_INCLUDE_DIR}/include/jit_preprocessed_files")

# Create `jitify_preprocess` executable
project(jitify_preprocess VERSION 2.0 LANGUAGES CXX CUDA)
add_executable(jitify_preprocess "${JITIFY_INCLUDE_DIR}/jitify2_preprocess.cpp")

target_link_libraries(jitify_preprocess CUDA::cudart ${CMAKE_DL_LIBS})
Expand All @@ -33,12 +28,14 @@ function(jit_preprocess_files)
)

foreach(ARG_FILE ${ARG_FILES})
set(ARG_OUTPUT ${CUDF_GENERATED_INCLUDE_DIR}/include/jit_preprocessed_files/${ARG_FILE}.jit)
set(ARG_OUTPUT ${CUDF_GENERATED_INCLUDE_DIR}/include/jit_preprocessed_files/${ARG_FILE}.jit.hpp)
get_filename_component(jit_output_directory "${ARG_OUTPUT}" DIRECTORY )
list(APPEND JIT_PREPROCESSED_FILES "${ARG_OUTPUT}")
add_custom_command(WORKING_DIRECTORY ${ARG_SOURCE_DIRECTORY}
DEPENDS jitify_preprocess
DEPENDS jitify_preprocess "${ARG_SOURCE_DIRECTORY}/${ARG_FILE}"
OUTPUT ${ARG_OUTPUT}
VERBATIM
COMMAND ${CMAKE_COMMAND} -E make_directory "${jit_output_directory}"
COMMAND jitify_preprocess ${ARG_FILE}
-o ${CUDF_GENERATED_INCLUDE_DIR}/include/jit_preprocessed_files
-v
Expand Down