Commit 37cefb00 authored by miller86's avatar miller86

adjusting logic to check long long support in PDB lite to avoid TRY_RUN and...

adjusting logic to check long long support in PDB lite to avoid TRY_RUN and just inspect Silo version number

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11754 18c085ea-50e0-402c-830e-de6fd14e8384
parent b7eb1e67
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* Modifications:
*
*****************************************************************************/
#include <lite_pdb.h>
/* Presently, the only possible variants of PDB lite are those with or without
long long support */
int main(int argc, char **argv)
{
int have_long_long = 0;
PDBfile *f = lite_PD_open("/dev/null", "w");
if (!f) f = lite_PD_open("nul", "w"); /* For Windows */
if (f)
{
have_long_long = _lite_PD_lookup_type("long_long", f->chart) != 0;
lite_PD_close(f);
}
if (have_long_long) return 0+1;
return 1+1;
}
......@@ -41,6 +41,9 @@
# Kathleen Bonnell, Thu Apr 8 17:17:22 MST 2010
# Add install and copy of silex for windows.
#
# Mark C. Miller, Mon Jun 21 16:55:51 PDT 2010
# Replaced logic to TRY_RUN a tiny PDB Lite test to simply query the
# Silo version number.
#****************************************************************************/
# Use the SILO_DIR hint from the config-site .cmake file
......@@ -65,34 +68,22 @@ ENDIF (WIN32)
# We use Silo for PDB most of the time so set up additional PDB variables.
IF(SILO_FOUND)
# Determine which PDB Lite variant we are using
SET(MSG " Check for PDB Lite variant")
SET(TRY_RUN_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp)
TRY_RUN(TRY_RUN_RESULT HAVE_PDBLITE_VARIANT
${TRY_RUN_DIR}
${VISIT_SOURCE_DIR}/CMake/FindPDBLiteVariant.C
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${VISIT_SOURCE_DIR}/include"
"-DLINK_DIRECTORIES:STRING=${SILO_LIBRARY_DIR}"
"-DLINK_LIBRARIES:STRING=${SILO_LIB}"
OUTPUT_VARIABLE OUTPUT
)
IF(HAVE_PDBLITE_VARIANT)
IF("${TRY_RUN_RESULT}" MATCHES "FAILED_TO_RUN")
MESSAGE(STATUS "${MSG} - failed to run, defaulting to newest variant")
SET(PDB_LITE_VARIANT 1 CACHE INTERNAL "PDB Lite variant")
ELSE("${TRY_RUN_RESULT}" MATCHES "FAILED_TO_RUN")
SET(PDB_LITE_VARIANT ${TRY_RUN_RESULT} CACHE INTERNAL "PDB Lite variant")
IF(PDB_LITE_VARIANT EQUAL 1)
MESSAGE(STATUS "${MSG} - found (${TRY_RUN_RESULT}: newest variant)")
ELSE(PDB_LITE_VARIANT EQUAL 1)
MESSAGE(STATUS "${MSG} - found (${TRY_RUN_RESULT}: older variant)")
ENDIF(PDB_LITE_VARIANT EQUAL 1)
ENDIF("${TRY_RUN_RESULT}" MATCHES "FAILED_TO_RUN")
ELSE(HAVE_PDBLITE_VARIANT)
MESSAGE(STATUS "${MSG} - ${OUTPUT_VARIABLE} ${OUTPUT}")
MESSAGE(STATUS "${MSG} - failed to compile, defaulting to newest variant")
SET(PDB_LITE_VARIANT 0 CACHE INTERNAL "PDB Lite variant")
ENDIF(HAVE_PDBLITE_VARIANT)
# Inspect Silo version number to infer whether or not PDB Lite (in Silo)
# has support for long long type. Failure to either find silo.h header file
# or find a matching line in that file with Silo_version will result in
# executing the block where VERSION_LESS is true. That is appropriate as
# older versions of Silo do not have a PDB Lite with long long support.
FILE(STRINGS ${SILO_INCLUDE_DIR}/silo.h SILO_VERSION_LINE REGEX Silo_version_[0-9]_[0-9]_[0-9])
STRING(REGEX REPLACE "(.*) Silo_version_([0-9])_[0-9]_[0-9]" \\2 SILO_MAJ_NO "${SILO_VERSION_LINE}")
STRING(REGEX REPLACE "(.*) Silo_version_[0-9]_([0-9])_[0-9]" \\2 SILO_MIN_NO "${SILO_VERSION_LINE}")
STRING(REGEX REPLACE "(.*) Silo_version_[0-9]_[0-9]_([0-9])" \\2 SILO_PAT_NO "${SILO_VERSION_LINE}")
IF("${SILO_MAJ_NO}.${SILO_MIN_NO}.${SILO_PAT_NO}" VERSION_LESS 4.7.2)
SET(PDB_LITE_HAS_LONG_LONG 0 CACHE INTERNAL "Support for longlong type in PDB Lite")
MESSAGE(STATUS " PDB Lite does not have long long support")
ELSE("${SILO_MAJ_NO}.${SILO_MIN_NO}.${SILO_PAT_NO}" VERSION_LESS 4.7.2)
SET(PDB_LITE_HAS_LONG_LONG 1 CACHE INTERNAL "Support for longlong type in PDB Lite")
MESSAGE(STATUS " PDB Lite has long long support")
ENDIF("${SILO_MAJ_NO}.${SILO_MIN_NO}.${SILO_PAT_NO}" VERSION_LESS 4.7.2)
SET(PDB_FOUND 1 CACHE BOOL "PDB library found")
SET(PDB_INCLUDE_DIR ${SILO_INCLUDE_DIR} CACHE PATH "PDB include directory")
......
......@@ -62,6 +62,7 @@
extern "C" {
#endif
#include <visit-config.h> /* For PDB_LITE_HAS_LONG_LONG */
#include <setjmp.h> /* For the setjmp/long structure jmp_buf. */
#include <stdio.h>
#include <lite_score.h> /* For type definitions */
......@@ -210,7 +211,7 @@ struct s_data_alignment {
int short_alignment;
int int_alignment;
int long_alignment;
#if PDB_LITE_VARIANT == 1
#ifdef PDB_LITE_HAS_LONG_LONG
int longlong_alignment;
#endif
int float_alignment;
......@@ -229,7 +230,7 @@ struct s_data_standard {
int int_order;
int long_bytes;
int long_order;
#if PDB_LITE_VARIANT == 1
#ifdef PDB_LITE_HAS_LONG_LONG
int longlong_bytes;
int longlong_order;
#endif
......
......@@ -35,7 +35,7 @@
#cmakedefine HAVE_LIBSILO
/* Define to identify the variant of PDB Lite (in silo) */
#cmakedefine PDB_LITE_VARIANT @PDB_LITE_VARIANT@
#cmakedefine PDB_LITE_HAS_LONG_LONG
/*******************************************************************************
* Optional libraries
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment