diff options
author | Zhigang Gong <zhigang.gong@linux.intel.com> | 2012-12-18 16:45:36 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-04-10 14:51:29 +0800 |
commit | e2f07c15572653e7b403aed4ae5ba8daa617fc21 (patch) | |
tree | 8e95865a8641cfd4f939858dcf7ae3c702d6baa0 | |
parent | 8e8d5157cb587d7b4e12a00a65e5c3196679f638 (diff) | |
download | beignet-e2f07c15572653e7b403aed4ae5ba8daa617fc21.tar.gz |
Refine CMake to check llvm version.
This branch need llvm 3.3 or newer version. We need to modify the cmake to
check the version. This commit also fixed some minor bugs in the find_packages,
and removed those useless files.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | CMake/FindCPP.cmake | 25 | ||||
-rw-r--r-- | CMake/FindDRMIntel.cmake | 8 | ||||
-rw-r--r-- | CMake/FindFlex.cmake | 27 | ||||
-rw-r--r-- | CMake/FindLLVM.cmake | 20 | ||||
-rw-r--r-- | CMake/FindXLib.cmake | 34 | ||||
-rw-r--r-- | CMake/FindXext.cmake | 7 | ||||
-rw-r--r-- | CMake/FindXfixes.cmake | 7 | ||||
-rw-r--r-- | CMakeLists.txt | 30 |
8 files changed, 58 insertions, 100 deletions
diff --git a/CMake/FindCPP.cmake b/CMake/FindCPP.cmake deleted file mode 100644 index be05064e..00000000 --- a/CMake/FindCPP.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# Try to find c preprocessor -# Once done this will define -# -# CPP_FOUND -# CPP_PATH -# - -FIND_PROGRAM(CPP_PATH cpp - /bin/ - /usr/bin/ - /usr/local/bin - ~/bin - /opt/local/bin/ - DOC "The directory where cpp is") - -IF(CPP_PATH) - SET(CPP_FOUND 1 CACHE STRING "Set to 1 if CPP is found, 0 otherwise") -ELSE(CPP_PATH) - SET(CPP_FOUND 0 CACHE STRING "Set to 1 if CPP is found, 0 otherwise") -ENDIF(CPP_PATH) - -MARK_AS_ADVANCED(CPP_FOUND) - - diff --git a/CMake/FindDRMIntel.cmake b/CMake/FindDRMIntel.cmake index 05778824..2ab9c1fd 100644 --- a/CMake/FindDRMIntel.cmake +++ b/CMake/FindDRMIntel.cmake @@ -6,6 +6,14 @@ # DRM_INTEL_INCLUDE_PATH # +FIND_PATH(DRM_INTEL_INCLUDE_PATH intel_bufmgr.h + ~/include/libdrm/ + /usr/include/libdrm/ + /usr/local/include/libdrm/ + /sw/include/libdrm/ + /opt/local/include/libdrm/ + DOC "The directory where intel_bufmgr.h resides") + FIND_LIBRARY(DRM_INTEL_LIBRARY NAMES DRM_INTEL drm_intel PATHS diff --git a/CMake/FindFlex.cmake b/CMake/FindFlex.cmake deleted file mode 100644 index f7972ebe..00000000 --- a/CMake/FindFlex.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# -# Try to find X library and include path. -# Once done this will define -# -# FLEX_FOUND -# FLEX_LIBRARY -# - -FIND_LIBRARY(FLEX_LIBRARY - NAMES FLEX fl - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - DOC "The FLEX library") - -IF(FLEX_INCLUDE_PATH) - SET(FLEX_FOUND 1 CACHE STRING "Set to 1 if FLEX is found, 0 otherwise") -ELSE(FLEX_INCLUDE_PATH) - SET(FLEX_FOUND 0 CACHE STRING "Set to 1 if FLEX is found, 0 otherwise") -ENDIF(FLEX_INCLUDE_PATH) - -MARK_AS_ADVANCED(FLEX_FOUND) - diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake index 4fa10a53..f5a74b48 100644 --- a/CMake/FindLLVM.cmake +++ b/CMake/FindLLVM.cmake @@ -6,8 +6,7 @@ # LLVM_LFLAGS - llvm linker flags # LLVM_MODULE_LIBS - list of llvm libs for working with modules. # LLVM_FOUND - True if llvm found. - -find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config DOC "llvm-config executable") +find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config llvm-config-32 llvm-config-3.0 DOC "llvm-config executable") if (LLVM_CONFIG_EXECUTABLE) message(STATUS "LLVM llvm-config found at: ${LLVM_CONFIG_EXECUTABLE}") @@ -15,6 +14,23 @@ else (LLVM_CONFIG_EXECUTABLE) message(FATAL_ERROR "Could NOT find LLVM executable") endif (LLVM_CONFIG_EXECUTABLE) +if (LLVM_FIND_VERSION_MAJOR AND LLVM_FIND_VERSION_MINOR) + SET(LLVM_FIND_VERSION_NODOT "${LLVM_FIND_VERSION_MAJOR}${LLVM_FIND_VERSION_MINOR}") + + execute_process( + COMMAND ${LLVM_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE LLVM_VERSION + ) + + string(REGEX REPLACE "([0-9]*)\\.([0-9]*)[^0-9]*" "\\1\\2 " LLVM_VERSION_NODOT ${LLVM_VERSION}) + if (LLVM_VERSION_NODOT VERSION_LESS LLVM_FIND_VERSION_NODOT) + message(FATAL_ERROR "imcompatible LLVM version ${LLVM_VERSION_NODOT} required ${LLVM_FIND_VERSION}") + endif (LLVM_VERSION_NODOT VERSION_LESS LLVM_FIND_VERSION_NODOT) + +endif (LLVM_FIND_VERSION_MAJOR AND LLVM_FIND_VERSION_MINOR) + + + execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIR diff --git a/CMake/FindXLib.cmake b/CMake/FindXLib.cmake deleted file mode 100644 index 5047a0f3..00000000 --- a/CMake/FindXLib.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# -# Try to find X library and include path. -# Once done this will define -# -# XLIB_FOUND -# XLIB_INCLUDE_PATH -# XLIB_LIBRARY -# - -FIND_PATH(XLIB_INCLUDE_PATH X11/Xlib.h - /usr/include - /usr/local/include - /sw/include - /opt/local/include - DOC "The directory where X11/Xlib.h resides") -FIND_LIBRARY(XLIB_LIBRARY - NAMES XLIB X11 - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - DOC "The XLIB library") - -IF(XLIB_INCLUDE_PATH) - SET(XLIB_FOUND 1 CACHE STRING "Set to 1 if XLIB is found, 0 otherwise") -ELSE(XLIB_INCLUDE_PATH) - SET(XLIB_FOUND 0 CACHE STRING "Set to 1 if XLIB is found, 0 otherwise") -ENDIF(XLIB_INCLUDE_PATH) - -MARK_AS_ADVANCED(XLIB_FOUND) - diff --git a/CMake/FindXext.cmake b/CMake/FindXext.cmake index 3f913706..3025da8f 100644 --- a/CMake/FindXext.cmake +++ b/CMake/FindXext.cmake @@ -6,6 +6,13 @@ # XEXT_LIBRARY # +FIND_PATH(XEXT_INCLUDE_PATH X11/extensions/Xext.h + /usr/include + /usr/local/include + /sw/include + /opt/local/include + DOC "The directory where Xext.h resides") + FIND_LIBRARY(XEXT_LIBRARY NAMES XEXT Xext PATHS diff --git a/CMake/FindXfixes.cmake b/CMake/FindXfixes.cmake index 8bce1d60..182e479f 100644 --- a/CMake/FindXfixes.cmake +++ b/CMake/FindXfixes.cmake @@ -6,6 +6,13 @@ # XFIXES_LIBRARY # +FIND_PATH(XFIXES_INCLUDE_PATH X11/extensions/Xfixes.h + /usr/include + /usr/local/include + /sw/include + /opt/local/include + DOC "The directory where Xfixes.h resides") + FIND_LIBRARY(XFIXES_LIBRARY NAMES XFIXES Xfixes PATHS diff --git a/CMakeLists.txt b/CMakeLists.txt index 41307e58..5c7764f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ PROJECT(OCL) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) SET(CMAKE_VERBOSE_MAKEFILE "false") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/") SET(EMULATE_IVB false CACHE BOOL "To emulate IVB") SET(EMULATE_SNB false CACHE BOOL "To emulate SNB") SET(EMULATE_HSW false CACHE BOOL "To emulate HSW") @@ -24,6 +25,10 @@ endif (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "assure config" FORCE) message(STATUS "Building mode: " ${CMAKE_BUILD_TYPE}) +SET(CMAKE_BUILD_TYPE DEBUGO0) +SET(CMAKE_CXX_FLAGS_DEBUGO0 "-O0 -g") +SET(CMAKE_C_FLAGS_DEBUGO0 "-O0 -g") + IF (EMULATE_HSW) SET (USE_FULSIM "true") ADD_DEFINITIONS(-DEMULATE_GEN=75) @@ -48,18 +53,19 @@ SET(CMAKE_CXX_FLAGS "-Wall -Wno-invalid-offsetof -mfpmath=sse --no-rtti -Wcast-a SET(CMAKE_C_FLAGS "-Wall -mfpmath=sse -msse2 -Wcast-align -msse2 -msse3 -mssse3 -msse4.1 ") # Front end stuff we need -INCLUDE(CMake/FindLLVM.cmake) +#INCLUDE(CMake/FindLLVM.cmake) +Find_Package(LLVM 3.3) # XLib -INCLUDE(CMake/FindXLib.cmake) -IF(XLIB_FOUND) +Find_Package(X11) +IF(X11_FOUND) MESSAGE(STATUS "Looking for XLib - found") -ELSE(XLIB_FOUND) +ELSE(X11_FOUND) MESSAGE(STATUS "Looking for XLib - not found") -ENDIF(XLIB_FOUND) +ENDIF(X11_FOUND) # DRM -INCLUDE(CMake/FindDRM.cmake) +Find_Package(DRM) IF(DRM_FOUND) MESSAGE(STATUS "Looking for DRM - found") ELSE(DRM_FOUND) @@ -67,11 +73,11 @@ ELSE(DRM_FOUND) ENDIF(DRM_FOUND) # OpenGL -find_package(OpenGL) +Find_Package(OpenGL) # Threads -find_package(Threads) +Find_Package(Threads) # DRM Intel -INCLUDE(CMake/FindDRMIntel.cmake) +Find_Package(DRMIntel) IF(DRM_INTEL_FOUND) MESSAGE(STATUS "Looking for DRM Intel - found") ELSE(DRM_INTEL_FOUND) @@ -79,7 +85,7 @@ ELSE(DRM_INTEL_FOUND) ENDIF(DRM_INTEL_FOUND) # Xext -INCLUDE(CMake/FindXext.cmake) +Find_Package(Xext) IF(XEXT_FOUND) MESSAGE(STATUS "Looking for Xext - found") ELSE(XEXT_FOUND) @@ -87,7 +93,7 @@ ELSE(XEXT_FOUND) ENDIF(XEXT_FOUND) # Xfixes -INCLUDE(CMake/FindXfixes.cmake) +Find_Package(Xfixes) IF(XFIXES_FOUND) MESSAGE(STATUS "Looking for Xfixes - found") ELSE(XFIXES_FOUND) @@ -95,7 +101,7 @@ ELSE(XFIXES_FOUND) ENDIF(XFIXES_FOUND) # Gen-backend (compiler) -INCLUDE(CMake/FindGBE.cmake) +Find_Package(GBE) IF(GBE_FOUND) MESSAGE(STATUS "Looking for Gen-Backend - found") ELSE(GBE_FOUND) |