[llvm-commits] [PATCH][CMake] Connect llvmc tool to the build.
Óscar Fuentes
ofv at wanadoo.es
Mon Jul 25 07:10:24 PDT 2011
arrowdodger <6yearold at gmail.com> writes:
> I've wrote this by looking on according Makefiles. I haven't done anything
> in doc/, since Makefiles do nothing there too.
>
> The only thing i'm unsure is how do determine LLVM{GCC,GXX}COMMAND, so i
> just hardcoded them to clang/clang++.
>
> Index: tools/llvmc/src/CMakeLists.txt
> ===================================================================
> --- tools/llvmc/src/CMakeLists.txt (revision 0)
> +++ tools/llvmc/src/CMakeLists.txt (revision 0)
> @@ -0,0 +1,25 @@
> +set(LLVMGCCCOMMAND ${CMAKE_BINARY_DIR}/bin/clang)
> +set(LLVMGXXCOMMAND ${CMAKE_BINARY_DIR}/bin/clang++)
The above will stop working once LLVM is installed and the build
directory removed, or when clang is not included in the build.
Maybe
set(LLVMGCCCOMMAND "${CMAKE_C_COMPILER}")
set(LLVMGCCCOMMAND "${CMAKE_CXX_COMPILER}")
?
> +configure_file(
> + ${CMAKE_CURRENT_SOURCE_DIR}/Base.td.in
> + ${CMAKE_CURRENT_BINARY_DIR}/Base.td
> + )
Please use the @ONLY option in that configure_file, just in case.
> +set(LLVM_TARGET_DEFINITIONS AutoGenerated.td)
> +
> +tablegen(AutoGenerated.inc -gen-llvmc)
> +
> +set(LLVM_USED_LIBS CompilerDriver)
> +set(LLVM_LINK_COMPONENTS support)
> +
> +add_llvm_tool(llvmc
> + Hooks.cpp
> + Main.cpp
> + )
The chunks of code like this:
> +add_custom_target(llvmc_gen ALL
> + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AutoGenerated.inc)
> +set_target_properties(llvmc_gen PROPERTIES FOLDER "Tablegenning")
> +
> +set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} llvmc_gen PARENT_SCOPE)
... are now unnecessary. I've just added support in add_llvm_executable
for automatically doing that.
> \ No newline at end of file
Please end the CMakeLists.txt files with a newline.
[snip]
> +set(LLVM_USED_LIBS CompilerDriver)
Why do you neeed CompilerDriver ?
[snip]
More information about the llvm-commits
mailing list