From 509a5799ff331a20a74ab7c17d1e7ef431b8e179 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 2 Jun 2012 16:49:47 +0200 Subject: [PATCH] =?UTF-8?q?Use=20hand-written=20.di=20files=20if=20present?= =?UTF-8?q?=20along=20the=20source=20=E2=80=93=20fixes=20issue=20#95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index af1d7cba..1efd4758 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -180,14 +180,22 @@ macro(dc INPUT_D OUTLIST_O OUTLIST_BC MOREFLAGS PATH SUFFIX) list(APPEND ${OUTLIST_BC} ${OUTPUT_BC}) list(FIND GENERATE_DI "${INPUT_D}" INDEX) - if (INDEX EQUAL -1) + if(INDEX EQUAL -1) set(DI_CMD "") - else (INDEX EQUAL -1) + else() string(REGEX REPLACE "src/ldc" "src/core" output ${output}) string(REGEX REPLACE "^src/" "" di_output ${output}) - set(DI_CMD -Hf=${CMAKE_BINARY_DIR}/import/${di_output}.di) + + # If a hand-written .di file exists along the source in src/, just copy + # it instead of running it through the compiler. + if(EXISTS "${INPUT_D}i") + configure_file("${INPUT_D}i" ${CMAKE_BINARY_DIR}/import/${di_output}.di COPYONLY) + else() + set(DI_CMD -Hf=${CMAKE_BINARY_DIR}/import/${di_output}.di) + endif() + list(REMOVE_AT GENERATE_DI ${INDEX}) - endif (INDEX EQUAL -1) + endif() # Compile add_custom_command(