Locate Intrinsics.td in CMakeLists.txt.

The LLVM_INCLUDE_DIR is not always defined (e.g. missing in Windows). We simply locate the file and pass the folder path to the tool.
This commit is contained in:
kai 2012-10-18 07:12:13 +02:00
parent 7674e4292f
commit add8e91653
2 changed files with 12 additions and 3 deletions

View file

@ -306,6 +306,16 @@ get_target_property(LDC_LOC ${LDC_EXE} LOCATION)
#
# Intrinsics module generation tools.
#
# The LLVM_INCLUDE_DIR definition is not always set, e.g. on Windows.
find_path(LLVM_INTRINSIC_TD_PATH "llvm/Intrinsics.td" PATHS ${LLVM_INCLUDE_DIRS} NO_DEFAULT_PATH)
if (${LLVM_INTRINSIC_TD_PATH} STREQUAL "LLVM_INTRINSIC_TD_PATH-NOTFOUND")
message(SEND_ERROR "File llvm/Intrinsics.td not found")
else()
message(STATUS "Using path for llvm/Intrinsics.td: ${LLVM_INTRINSIC_TD_PATH}")
endif()
add_definitions(-DLLVM_INTRINSIC_TD_PATH="${LLVM_INTRINSIC_TD_PATH}")
add_executable(gen_gccbuiltins utils/gen_gccbuiltins.cpp)
# Prior to LLVM 3.2, TableGen still uses RTTI, contrary to the rest of LLVM.

View file

@ -6,7 +6,6 @@
#include <string.h>
#include <assert.h>
#include <llvm/Config/llvm-config.h>
#include <llvm/TableGen/Main.h>
#if LDC_LLVM_VER < 302
#include <llvm/TableGen/TableGenAction.h>
@ -148,11 +147,11 @@ int main(int argc, char** argv)
return 1;
}
sys::Path file(LLVM_INCLUDEDIR);
sys::Path file(LLVM_INTRINSIC_TD_PATH);
file.appendComponent("llvm");
file.appendComponent("Intrinsics.td");
string iStr = string("-I=") + string(LLVM_INCLUDEDIR);
string iStr = string("-I=") + string(LLVM_INTRINSIC_TD_PATH);
string oStr = string("-o=") + argv[1];
vector<char*> args2(argv, argv + 1);