1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
############################################################################
# © 2012,2014 Advanced Micro Devices, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################
# Locate an BOLT implementation.
#
# Defines the following variables:
#
# BOLT_FOUND - Found an Bolt imlementation
#
# Also defines the library variables below as normal
# variables.
#
# BOLT_LIBRARIES - These contain debug/optimized keywords when a debugging library is found
# BOLT_INCLUDE_DIRS - All relevant Bolt include directories
#
# Accepts the following variables as input:
#
# BOLT_ROOT - (as a CMake or environment variable)
# The root directory of an BOLT installation
#
# FIND_LIBRARY_USE_LIB64_PATHS - Global property that controls whether FindBOLT should search for
# 64bit or 32bit libs
#
#-----------------------
# Example Usage:
#
# find_package(BOLT REQUIRED)
# include_directories(${BOLT_INCLUDE_DIRS})
#
# add_executable(foo foo.cc)
# target_link_libraries(foo ${BOLT_LIBRARIES})
#
#-----------------------
# This module helps to use BOLT_FIND_COMPONENTS, BOLT_FIND_REQUIRED, BOLT_FIND_QUIETLY
include( FindPackageHandleStandardArgs )
# Search for 64bit libs if FIND_LIBRARY_USE_LIB64_PATHS is set to true in the global environment, 32bit libs else
get_property( LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS )
# Debug print statements
#message( "BOLT_LIBRARY_PATH_SUFFIXES: ${BOLT_LIBRARY_PATH_SUFFIXES}" )
#message( "ENV{BOLT_ROOT}: $ENV{BOLT_ROOT}" )
#message( "BOLT_FIND_COMPONENTS: ${BOLT_FIND_COMPONENTS}" )
#message( "BOLT_FIND_REQUIRED: ${BOLT_FIND_REQUIRED}" )
# Set the component to find if the user does not specify explicitely
if( NOT BOLT_FIND_COMPONENTS )
set( BOLT_FIND_COMPONENTS CL )
endif( )
if(WIN32)
if( MSVC_VERSION VERSION_LESS 1600 )
set( myMSVCVer "vc90" )
elseif( MSVC_VERSION VERSION_LESS 1700 )
set( myMSVCVer "vc100" )
elseif( MSVC_VERSION VERSION_LESS 1800 )
set( myMSVCVer "vc110" )
else()
set( myMSVCVer "vc120" )
endif( )
else()
set( myMSVCVer "gcc" )
endif()
if(WIN32)
set( BoltLibName "clBolt.runtime.${myMSVCVer}")
set( LIB_EXT "lib")
else()
set( BoltLibName "libclBolt.runtime.${myMSVCVer}")
set( LIB_EXT "a")
endif()
# Eventually, Bolt may support multiple backends, but for now it only supports CL
list( FIND BOLT_FIND_COMPONENTS CL find_CL )
if( NOT find_CL EQUAL -1 )
set( BOLT_LIBNAME_BASE ${BoltLibName} )
endif( )
if( NOT find_CL EQUAL -1 )
# Find and set the location of main BOLT static lib file
find_library( BOLT_LIBRARY_STATIC_RELEASE
NAMES ${BOLT_LIBNAME_BASE}.${LIB_EXT}
HINTS
${BOLT_ROOT}
ENV BOLT_ROOT
DOC "BOLT static library path"
PATH_SUFFIXES lib
)
mark_as_advanced( BOLT_LIBRARY_STATIC_RELEASE )
# Find and set the location of main BOLT static lib file
find_library( BOLT_LIBRARY_STATIC_DEBUG
NAMES ${BOLT_LIBNAME_BASE}.debug.${LIB_EXT}
HINTS
${BOLT_ROOT}
ENV BOLT_ROOT
DOC "BOLT static library path"
PATH_SUFFIXES lib
)
mark_as_advanced( BOLT_LIBRARY_STATIC_DEBUG )
if( BOLT_LIBRARY_STATIC_RELEASE )
set( BOLT_LIBRARY_STATIC optimized ${BOLT_LIBRARY_STATIC_RELEASE} )
else( )
set( BOLT_LIBRARY_STATIC "" )
message( "${BOLT_LIBNAME_BASE}.${LIB_EXT}: Release static bolt library not found" )
endif( )
if( BOLT_LIBRARY_STATIC_DEBUG )
set( BOLT_LIBRARY_STATIC ${BOLT_LIBRARY_STATIC} debug ${BOLT_LIBRARY_STATIC_DEBUG} )
else( )
message( "${BOLT_LIBNAME_BASE}.debug.${LIB_EXT}: Debug static bolt library not found" )
endif( )
find_path( BOLT_INCLUDE_DIRS
NAMES bolt/cl/bolt.h
HINTS
${BOLT_ROOT}
ENV BOLT_ROOT
DOC "BOLT header file path"
PATH_SUFFIXES include
)
mark_as_advanced( BOLT_INCLUDE_DIRS )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( BOLT DEFAULT_MSG BOLT_LIBRARY_STATIC BOLT_INCLUDE_DIRS )
endif( )
if( BOLT_FOUND )
list( APPEND BOLT_LIBRARIES ${BOLT_LIBRARY_STATIC} )
else( )
if( NOT BOLT_FIND_QUIETLY )
message( WARNING "FindBOLT could not find the BOLT library" )
message( STATUS "Did you remember to set the BOLT_ROOT environment variable?" )
endif( )
endif()
|