Modify the cmake build system so that if it doesn't find bison, it will use the prege...
authorCedric Venet <cedric.venet@laposte.net>
Fri, 24 Oct 2008 11:24:33 +0000 (11:24 +0000)
committerCedric Venet <cedric.venet@laposte.net>
Fri, 24 Oct 2008 11:24:33 +0000 (11:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58090 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/config-w32.cmake
lib/AsmParser/CMakeLists.txt

index 208e77628cab983d04cc4cf9471f2f15b9346daf..d971d2a13705d58d96d199a796579d0b53ce743e 100755 (executable)
@@ -1,9 +1,9 @@
 # tbi: Configurar ficheros.
-configure_file(${llvm_include_path}/llvm/ADT/hash_map.h.in ${llvm_builded_incs_dir}/ADT/hash_map.h)
-configure_file(${llvm_include_path}/llvm/ADT/hash_set.h.in ${llvm_builded_incs_dir}/ADT/hash_set.h)
-configure_file(${llvm_include_path}/llvm/ADT/iterator.h.in ${llvm_builded_incs_dir}/ADT/iterator.h)
-configure_file(${llvm_include_path}/llvm/Support/DataTypes.h.in ${llvm_builded_incs_dir}/Support/DataTypes.h)
-configure_file(${llvm_include_path}/llvm/Config/config.h.in ${llvm_builded_incs_dir}/Config/config.h)
+configure_file(${llvm_include_path}/llvm/ADT/hash_map.h.in ${llvm_builded_incs_dir}/ADT/hash_map.h COPYONLY)
+configure_file(${llvm_include_path}/llvm/ADT/hash_set.h.in ${llvm_builded_incs_dir}/ADT/hash_set.h COPYONLY)
+configure_file(${llvm_include_path}/llvm/ADT/iterator.h.in ${llvm_builded_incs_dir}/ADT/iterator.h COPYONLY)
+configure_file(${llvm_include_path}/llvm/Support/DataTypes.h.in ${llvm_builded_incs_dir}/Support/DataTypes.h COPYONLY)
+configure_file(${llvm_include_path}/llvm/Config/config.h.in ${llvm_builded_incs_dir}/Config/config.h COPYONLY)
 
 file(READ ${llvm_include_path}/../win32/config.h vc_config_text)
 file(APPEND ${llvm_builded_incs_dir}/Config/config.h ${vc_config_text})
index c12f414d8ed7132be4c2d8328ae9d9944f91571b..b8283c5d8a735274d85bcf30af3bfc9273e2f934 100644 (file)
@@ -1,15 +1,39 @@
 # AsmParser, with a Bison generated parser:
 include(FindBison)
 find_bison()
+
+IF(BISON_EXECUTABLE)
 bison_generator(
   "llvmAsm"
   "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.y"
   "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h"
   "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp"
   )
+ELSE(BISON_EXECUTABLE)
+  MESSAGE(STATUS "Bison not found, the pregenerated files will be used")
+
+  IF(WIN32)
+    FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} WIN_SOURCE_DIR)
+
+    ADD_CUSTOM_COMMAND(
+      OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp"
+      DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp.cvs"
+      COMMAND copy \"${WIN_SOURCE_DIR}\\llvmAsmParser.cpp.cvs\" \"${WIN_SOURCE_DIR}\\llvmAsmParser.cpp\"
+    )
+    ADD_CUSTOM_COMMAND(
+      OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h"
+      DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h.cvs"
+      COMMAND copy \"${WIN_SOURCE_DIR}\\llvmAsmParser.h.cvs\" \"${WIN_SOURCE_DIR}\\llvmAsmParser.h\"
+    )
+  ELSE(WIN32)
+    MESSAGE(SEND_ERROR "Not implemented")
+    # fixme do the same with cp instead of copy
+  ENDIF(WIN32)
+ENDIF(BISON_EXECUTABLE)
 
 add_llvm_library(LLVMAsmParser
-  llvmAsmParser.cpp  # Generated from llvmAsmParser.y
+  llvmAsmParser.cpp  # Generated from llvmAsmParser.y or copyied from corresponding .cvs
+  llvmAsmParser.h    # needed for the associated custom command to work
   LLLexer.cpp
   Parser.cpp
   )