From 90242e3680f52190d70c64246142cb4127469741 Mon Sep 17 00:00:00 2001 From: The Coriolis Project Date: Thu, 21 Aug 2008 16:42:09 +0000 Subject: [PATCH] OPENACCESS macro --- hurricane/cmake_modules/FindOPENACCESS.cmake | 197 ++++++++++++++----- 1 file changed, 150 insertions(+), 47 deletions(-) diff --git a/hurricane/cmake_modules/FindOPENACCESS.cmake b/hurricane/cmake_modules/FindOPENACCESS.cmake index a8238277..5a565865 100644 --- a/hurricane/cmake_modules/FindOPENACCESS.cmake +++ b/hurricane/cmake_modules/FindOPENACCESS.cmake @@ -1,70 +1,173 @@ # - Find the OpenAccess includes and libraries. -# The following variables are set if OpenAccess is found. If OPENACCESS is not -# found, OPENACCESS_FOUND is set to false. -# OPENACCESS_FOUND - True when the OpenAccess include directory is found. -# OPENACCESS_INCLUDE_DIR - the path to where the OpenAccess include files are. -# OPENACCESS_LIBRARIES - The path to where the OpenAccess library files are. +# The following variables are set if OpenAccess is found. If OpenAccess is not +# found, OA_FOUND is set to false. +# OA_FOUND - True when OpenAccess is found. +# OA_INCLUDE_DIR - the path to where the OpenAccess include files are. +# OA_LIBRARIES - The path to where the OpenAccess library files are. +# +# The OpenAccess oaCommon library: OA_COMMON_LIBRARY +# OA_COMMON_LIBRARY_RELEASE +# OA_COMMON_DEBUG +# +# The OpenAccess oaBase library: OA_BASE_LIBRARY +# OA_BASE_LIBRARY_RELEASE +# OA_BASE_DEBUG +# +# The OpenAccess oaDM library: OA_DM_LIBRARY +# OA_DM_LIBRARY_RELEASE +# OA_DM_DEBUG +# +# The OpenAccess oaTech library: OA_TECH_LIBRARY +# OA_TECH_LIBRARY_RELEASE +# OA_TECH_DEBUG +# +# The OpenAccess oaDesign library: OA_DESIGN_LIBRARY +# OA_DESIGN_LIBRARY_RELEASE +# OA_DESIGN_DEBUG +# +# The OpenAccess oaWafer library: OA_WAFER_LIBRARY +# OA_WAFER_LIBRARY_RELEASE +# OA_WAFER_DEBUG +# +# The OpenAccess oaPlugin library: OA_PLUGIN_LIBRARY +# OA_PLUGIN_LIBRARY_RELEASE +# OA_PLUGIN_DEBUG -SET(OPENACCESS_INCLUDE_PATH_DESCRIPTION "directory containing the OpenAccess include files. E.g /usr/local/include") +SET(OA_INCLUDE_PATH_DESCRIPTION "directory containing the OpenAccess include files. E.g /usr/local/include") -SET(OPENACCESS_DIR_MESSAGE "Set the OPENACCESS_INCLUDE_DIR cmake cache entry to the ${OPENACCESS_INCLUDE_PATH_DESCRIPTION}") +SET(OA_DIR_MESSAGE "Set the OA_INCLUDE_DIR cmake cache entry to the ${OA_INCLUDE_PATH_DESCRIPTION}") # don't even bother under WIN32 IF(UNIX) - SET(OPENACCESS_DIR_SEARCH $ENV{OPENACCESS_TOP}) - IF(OPENACCESS_DIR_SEARCH) - FILE(TO_CMAKE_PATH ${OPENACCESS_DIR_SEARCH} OPENACCESS_DIR_SEARCH) - ENDIF(OPENACCESS_DIR_SEARCH) + SET(OA_DIR_SEARCH $ENV{OPENACCESS_TOP}) + IF(OA_DIR_SEARCH) + FILE(TO_CMAKE_PATH ${OA_DIR_SEARCH} OA_DIR_SEARCH) + ENDIF(OA_DIR_SEARCH) # # Look for an installation. # - FIND_PATH(OPENACCESS_INCLUDE_PATH NAMES oa/oaDesign.h PATHS + FIND_PATH(OA_INCLUDE_PATH NAMES oa/oaDesign.h PATHS # Look in other places. - ${OPENACCESS_DIR_SEARCH} + ${OA_DIR_SEARCH} PATH_SUFFIXES include # Help the user find it if we cannot. - DOC "The ${OPENACCESS_INCLUDE_PATH_DESCRIPTION}" + DOC "The ${OA_INCLUDE_PATH_DESCRIPTION}" ) - FIND_LIBRARY(OPENACCESS_LIBRARY_PATH - NAMES oaDesignD - PATHS ${OPENACCESS_DIR_SEARCH} - PATH_SUFFIXES lib/linux_rhel30_64/dbg #for the moment... - # Help the user find it if we cannot. - DOC "The ${OPENACCESS_INCLUDE_PATH_DESCRIPTION}" - ) + SET(OA_LIBRARY_DIR ${OA_DIR_SEARCH}/lib/linux_rhel30_64/dbg) - # Assume we didn't find it. - SET(OPENACCESS_FOUND 0) - IF(OPENACCESS_INCLUDE_PATH) - IF(OPENACCESS_LIBRARY_PATH) - SET(OPENACCESS_FOUND "YES") - SET(OPENACCESS_INCLUDE_DIR - ${OPENACCESS_INCLUDE_PATH} - ) - SET(OPENACCESS_LIBRARIES - ${OPENACCESS_LIBRARY_PATH} - ) - ENDIF(OPENACCESS_LIBRARY_PATH) - ENDIF(OPENACCESS_INCLUDE_PATH) + # Set OA_OACOMMON_LIBRARY + FIND_LIBRARY(OA_OACOMMON_LIBRARY_RELEASE NAMES oaCommon PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OACOMMON_LIBRARY_DEBUG NAMES oaCommonD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) - IF(OPENACCESS_FOUND) - IF(NOT OPENACCESS_FIND_QUIETLY) - MESSAGE(STATUS "Found OPENACCESS : ${OPENACCESS_LIBRARIES}") - ENDIF(NOT OPENACCESS_FIND_QUIETLY) - ELSE(OPENACCESS_FOUND) - IF(OPENACCESS_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "OPENACCESS was not found. ${OPENACCESS_DIR_MESSAGE}") - ENDIF(OPENACCESS_FIND_REQUIRED) - ENDIF(OPENACCESS_FOUND) + # Set OA_OABASE_LIBRARY + FIND_LIBRARY(OA_OABASE_LIBRARY_RELEASE NAMES oaBase PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OABASE_LIBRARY_DEBUG NAMES oaBaseD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) - MARK_AS_ADVANCED( - OPENACCESS_INCLUDE_PATH - OPENACCESS_LIBRARY_PATH - ) + # Set OA_OADM_LIBRARY + FIND_LIBRARY(OA_OADM_LIBRARY_RELEASE NAMES oaDM PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OADM_LIBRARY_DEBUG NAMES oaDMD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set OA_OATECH_LIBRARY + FIND_LIBRARY(OA_OATECH_LIBRARY_RELEASE NAMES oaTech PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OATECH_LIBRARY_DEBUG NAMES oaTechD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set OA_OADESIGN_LIBRARY + FIND_LIBRARY(OA_OADESIGN_LIBRARY_RELEASE NAMES oaDesign PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OADESIGN_LIBRARY_DEBUG NAMES oaDesignD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set OA_OAWAFER_LIBRARY + FIND_LIBRARY(OA_OAWAFER_LIBRARY_RELEASE NAMES oaWafer PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OAWAFER_LIBRARY_DEBUG NAMES oaWaferD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set OA_OAPLUGIN_LIBRARY + FIND_LIBRARY(OA_OAPLUGIN_LIBRARY_RELEASE NAMES oaPlugIn PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH ) + FIND_LIBRARY(OA_OAPLUGIN_LIBRARY_DEBUG NAMES oaPlugInD PATHS ${OA_LIBRARY_DIR} NO_DEFAULT_PATH) + + ############################################ + # + # Check the existence of the libraries. + # + ############################################ + + MACRO (_OA_ADJUST_LIB_VARS basename) + # if only the release version was found, set the debug variable also to the release version + IF (OA_${basename}_LIBRARY_RELEASE AND NOT OA_${basename}_LIBRARY_DEBUG) + SET(OA_${basename}_LIBRARY_DEBUG ${OA_${basename}_LIBRARY_RELEASE}) + SET(OA_${basename}_LIBRARY ${OA_${basename}_LIBRARY_RELEASE}) + SET(OA_${basename}_LIBRARIES ${OA_${basename}_LIBRARY_RELEASE}) + ENDIF (OA_${basename}_LIBRARY_RELEASE AND NOT OA_${basename}_LIBRARY_DEBUG) + + # if only the debug version was found, set the release variable also to the debug version + IF (OA_${basename}_LIBRARY_DEBUG AND NOT OA_${basename}_LIBRARY_RELEASE) + SET(OA_${basename}_LIBRARY_RELEASE ${OA_${basename}_LIBRARY_DEBUG}) + SET(OA_${basename}_LIBRARY ${OA_${basename}_LIBRARY_DEBUG}) + SET(OA_${basename}_LIBRARIES ${OA_${basename}_LIBRARY_DEBUG}) + ENDIF (OA_${basename}_LIBRARY_DEBUG AND NOT OA_${basename}_LIBRARY_RELEASE) + IF (OA_${basename}_LIBRARY_DEBUG AND OA_${basename}_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(OA_${basename}_LIBRARY optimized ${OA_${basename}_LIBRARY_RELEASE} debug ${OA_${basename}_LIBRARY_DEBUG}) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(OA_${basename}_LIBRARY ${OA_${basename}_LIBRARY_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(OA_${basename}_LIBRARIES optimized ${OA_${basename}_LIBRARY_RELEASE} debug ${OA_${basename}_LIBRARY_DEBUG}) + ENDIF (OA_${basename}_LIBRARY_DEBUG AND OA_${basename}_LIBRARY_RELEASE) + + SET(OA_${basename}_LIBRARY ${OA_${basename}_LIBRARY} CACHE FILEPATH "The OpenAccess ${basename} library") + + IF (OA_${basename}_LIBRARY) + SET(OA_${basename}_FOUND 1) + ENDIF (OA_${basename}_LIBRARY) + + # Make variables changeble to the advanced user + MARK_AS_ADVANCED(OA_${basename}_LIBRARY OA_${basename}_LIBRARY_RELEASE OA_${basename}_LIBRARY_DEBUG OA_${basename}_INCLUDE_DIR) + ENDMACRO (_OA_ADJUST_LIB_VARS) + + _OA_ADJUST_LIB_VARS(OACOMMON) + _OA_ADJUST_LIB_VARS(OABASE) + _OA_ADJUST_LIB_VARS(OADM) + _OA_ADJUST_LIB_VARS(OATECH) + _OA_ADJUST_LIB_VARS(OADESIGN) + _OA_ADJUST_LIB_VARS(OAWAFER) + _OA_ADJUST_LIB_VARS(OAPLUGIN) + + + IF (OA_INCLUDE_PATH AND OA_OACOMMON_LIBRARY AND OA_OABASE_LIBRARY + AND OA_OADM_LIBRARY AND OA_OATECH_LIBRARY AND OA_OADESIGN_LIBRARY + AND OA_OAWAFER_LIBRARY AND OA_OAPLUGIN_LIBRARY) + SET(OPENACCESS_FOUND "YES") + IF (NOT OA_FIND_QUIETLY) + MESSAGE(STATUS "Found OpenAccess") + ENDIF( NOT OA_FIND_QUIETLY) + SET(OA_INCLUDE_DIR + ${OA_INCLUDE_PATH} + ) + SET(OA_LIBRARIES + ${OA_OACOMMON_LIBRARY} + ${OA_OABASE_LIBRARY} + ${OA_OADM_LIBRARY} + ${OA_OATECH_LIBRARY} + ${OA_OADESIGN_LIBRARY} + ${OA_OAWAFER_LIBRARY} + ${OA_OAPLUGIN_LIBRARY} + ) + ELSE (OA_INCLUDE_PATH AND OA_LIBRARY_PATH) + SET(OPENACCESS_FOUND "NO") + IF(OA_FIND_REQUIRED) + MESSAGE( FATAL_ERROR "OpenAccess libraries, includes NOT found!") + ENDIF( OA_FIND_REQUIRED) + ENDIF (OA_INCLUDE_PATH AND OA_OACOMMON_LIBRARY AND OA_OABASE_LIBRARY + AND OA_OADM_LIBRARY AND OA_OATECH_LIBRARY AND OA_OADESIGN_LIBRARY + AND OA_OAWAFER_LIBRARY AND OA_OAPLUGIN_LIBRARY) + + SET(OA_FOUND ${OA_FOUND}) ENDIF(UNIX)