Commit b7eb1e67 authored by miller86's avatar miller86

adding cmake logic to handle which PDB Lite variant we are linking with

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11752 18c085ea-50e0-402c-830e-de6fd14e8384
parent 60fd330f
/*****************************************************************************
*
* 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;
}
......@@ -64,9 +64,40 @@ 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)
SET(PDB_FOUND 1 CACHE BOOL "PDB library found")
SET(PDB_INCLUDE_DIR ${SILO_INCLUDE_DIR} CACHE PATH "PDB include directory")
SET(PDB_LIBRARY_DIR ${SILO_LIBRARY_DIR} CACHE PATH "PDB library directory")
SET(PDB_LIB ${SILO_LIB} CACHE STRING "PDB library")
MARK_AS_ADVANCED(PDB_INCLUDE_DIR PDB_LIBRARY_DIR PDB_LIB)
ENDIF(SILO_FOUND)
......@@ -77,6 +77,8 @@
# Hank Childs, Tue Jan 5 07:16:29 PST 2010
# Replace xml2makefile with xml2cmake.
#
# Mark C. Miller, Mon Jun 14 10:13:38 PDT 2010
# Updated commands/readme to support cmake style of building.
# ----------------------------------------------------------------------------
#
......@@ -144,12 +146,16 @@ cat >> $1 <<- EOF
If the above commands fail, you may need to use this appraoch...
Manual commands for installing and UNinstalling
(Note: Ensure you have a new enough version of cmake, 2.8 or
later, in your path or use the version of cmake that is part
of the VisIt installation.)
----------------------------------------------------------------
To untar the plugin...
% gunzip < $pluginName.tar.gz | tar xvf -
To install...
% cd $pluginName
% xml2cmake -clobber $pluginName.xml
% cmake .
% make
To UNinstall...
% cd $pluginName
......@@ -218,6 +224,7 @@ testBuildPluginTarball () {
return
fi
fi
cmake .
make 1>$oldDir/visit_plugin_${thePluginName}_make.log 2>&1
hadError=$?
if test -z "$deleteIt" || test "$deleteIt" != "0"; then
......
......@@ -2293,6 +2293,9 @@ PF3DFileFormat::MasterInformation::GetNDomains() const
// I added some coding to handle a weird case where float and double
// alignments appear to be reversed.
//
// Mark C. Miller, Mon Jun 21 12:28:13 PDT 2010
// Reverted Brad's fix (above). Now, lite_pdb.h header file should get
// PDB Lite's structures correct via new cmake tests in FindSilo.cmake.
// ****************************************************************************
bool
......@@ -2405,24 +2408,6 @@ PF3DFileFormat::MasterInformation::Read(PDBFileObject *pdb)
fclose(out);
}
#endif
debug4 << "char_alignment = " << pdb->filePointer()->align->char_alignment << endl;
debug4 << "short_alignment = " << pdb->filePointer()->align->short_alignment << endl;
debug4 << "int_alignment = " << pdb->filePointer()->align->int_alignment << endl;
debug4 << "long_alignment = " << pdb->filePointer()->align->long_alignment << endl;
debug4 << "float_alignment = " << pdb->filePointer()->align->float_alignment << endl;
debug4 << "double_alignment = " << pdb->filePointer()->align->double_alignment << endl;
int float_alignment = pdb->filePointer()->align->float_alignment;
int double_alignment = pdb->filePointer()->align->double_alignment;
if(float_alignment > double_alignment)
{
debug4 << "float_alignment > double_alignment That must be an error. "
"Swap alignments for float and double." << endl;
int tmp = float_alignment;
float_alignment = double_alignment;
double_alignment = tmp;
}
// Now iterate through the fields in the __@history variable type
// And populate the member data. We'll just promote everything
// that's not char to double and long. This will make some access
......@@ -2522,7 +2507,8 @@ PF3DFileFormat::MasterInformation::Read(PDBFileObject *pdb)
else if(strcmp(m->base_type, "float") == 0)
{
// Advance offset if necessary.
for(; ((unsigned long)(mptr)) % float_alignment != 0; ++mptr);
for(; ((unsigned long)(mptr)) % pdb->filePointer()->
align->float_alignment != 0; ++mptr);
float *src = (float *)mptr;
double *dest = new double[mSize];
......@@ -2537,7 +2523,8 @@ PF3DFileFormat::MasterInformation::Read(PDBFileObject *pdb)
else if(strcmp(m->base_type, "double") == 0)
{
// Advance offset if necessary.
for(; ((unsigned long)(mptr)) % double_alignment != 0; ++mptr);
for(; ((unsigned long)(mptr)) % pdb->filePointer()->
align->double_alignment != 0; ++mptr);
double *src = (double *)mptr;
double *dest = new double[mSize];
......
......@@ -210,6 +210,9 @@ struct s_data_alignment {
int short_alignment;
int int_alignment;
int long_alignment;
#if PDB_LITE_VARIANT == 1
int longlong_alignment;
#endif
int float_alignment;
int double_alignment;
int struct_alignment;
......@@ -226,6 +229,10 @@ struct s_data_standard {
int int_order;
int long_bytes;
int long_order;
#if PDB_LITE_VARIANT == 1
int longlong_bytes;
int longlong_order;
#endif
int float_bytes;
long *float_format;
int *float_order;
......
......@@ -34,6 +34,9 @@
/* Define if you have silo. */
#cmakedefine HAVE_LIBSILO
/* Define to identify the variant of PDB Lite (in silo) */
#cmakedefine PDB_LITE_VARIANT @PDB_LITE_VARIANT@
/*******************************************************************************
* 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