[opengtl-commits] [724] add a test wether llvm was build with PIC

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 724
Author:   cyrille
Date:     2009-04-11 18:43:40 +0200 (Sat, 11 Apr 2009)

Log Message:
-----------
add a test wether llvm was build with PIC

Modified Paths:
--------------
    trunk/OpenGTL/CMakeLists.txt
    trunk/OpenGTL/cmake/modules/FindLLVM.cmake


Modified: trunk/OpenGTL/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/CMakeLists.txt	2009-04-11 15:29:25 UTC (rev 723)
+++ trunk/OpenGTL/CMakeLists.txt	2009-04-11 16:43:40 UTC (rev 724)
@@ -39,12 +39,20 @@
   message(STATUS "OpenGTL detected that you use a 32 bit processor.")
   set(OPENGTL_TESTS_DATA_RESULTS_DIR results32)
   option(OPENGTL_ENABLE_SIMD "Enable SIMD (SSE/MMX/...) instructions" OFF)
+  
+  if(LLVM_COMPILED_WITH_PIC)
+    message(FATAL_ERROR "llvm was build with PIC enabled, this is not surported on 32bits.")
+  endif(LLVM_COMPILED_WITH_PIC)
+  
 else(CMAKE_SIZEOF_VOID_P EQUAL 4)
   # 32 bits
   message(STATUS "OpenGTL detected that you use a 64 bit processor.")
   set(OPENGTL_TESTS_DATA_RESULTS_DIR results64)
   option(OPENGTL_ENABLE_SIMD "Enable SIMD (SSE/MMX/...) instructions" ON)
   # TODO check that llvm was build with -fPIC
+  if(NOT LLVM_COMPILED_WITH_PIC)
+    message(FATAL_ERROR "llvm wasn't build with PIC enabled, this is not surported on 64bits.")
+  endif(NOT LLVM_COMPILED_WITH_PIC)
 endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/OpenGTL ${CMAKE_CURRENT_BINARY_DIR}
 )

Modified: trunk/OpenGTL/cmake/modules/FindLLVM.cmake
===================================================================
--- trunk/OpenGTL/cmake/modules/FindLLVM.cmake	2009-04-11 15:29:25 UTC (rev 723)
+++ trunk/OpenGTL/cmake/modules/FindLLVM.cmake	2009-04-11 16:43:40 UTC (rev 724)
@@ -31,6 +31,16 @@
   
   
   exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --cxxflags  OUTPUT_VARIABLE LLVM_COMPILE_FLAGS )
+  
+  STRING(REGEX MATCH "pic" LLVM_COMPILE_FLAGS_PIC ${LLVM_COMPILE_FLAGS} )
+  
+  if(LLVM_COMPILE_FLAGS_PIC)
+    message(STATUS "llvm was compiled with pic")
+    set(LLVM_COMPILED_WITH_PIC TRUE)
+  else(LLVM_COMPILE_FLAGS_PIC)
+    set(LLVM_COMPILED_WITH_PIC FALSE)
+  endif(LLVM_COMPILE_FLAGS_PIC)
+  
   exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --ldflags   OUTPUT_VARIABLE LLVM_LDFLAGS )
   exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --libs core OUTPUT_VARIABLE LLVM_LIBS_CORE )
   exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --version OUTPUT_VARIABLE LLVM_VERSION )


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/