This should fix psblas errors on windows
parent
3290dcf14b
commit
7ee5a6af7c
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* gettimeofday.c
|
||||||
|
* Win32 gettimeofday() replacement
|
||||||
|
*
|
||||||
|
* src/port/gettimeofday.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003 SRA, Inc.
|
||||||
|
* Copyright (c) 2003 SKC, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software and
|
||||||
|
* its documentation for any purpose, without fee, and without a
|
||||||
|
* written agreement is hereby granted, provided that the above
|
||||||
|
* copyright notice and this paragraph and the following two
|
||||||
|
* paragraphs appear in all copies.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||||
|
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
|
||||||
|
* LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
|
||||||
|
* DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS
|
||||||
|
* IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
|
||||||
|
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "c.h"
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* FILETIME of Jan 1 1970 00:00:00. */
|
||||||
|
static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* timezone information is stored outside the kernel so tzp isn't used anymore.
|
||||||
|
*
|
||||||
|
* Note: this function is not for Win32 high precision timing purpose. See
|
||||||
|
* elapsed_time().
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||||
|
{
|
||||||
|
FILETIME file_time;
|
||||||
|
SYSTEMTIME system_time;
|
||||||
|
ULARGE_INTEGER ularge;
|
||||||
|
|
||||||
|
GetSystemTime(&system_time);
|
||||||
|
SystemTimeToFileTime(&system_time, &file_time);
|
||||||
|
ularge.LowPart = file_time.dwLowDateTime;
|
||||||
|
ularge.HighPart = file_time.dwHighDateTime;
|
||||||
|
|
||||||
|
tp->tv_sec = (long) ((ularge.QuadPart - epoch) / 10000000L);
|
||||||
|
tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
if (METIS_INCLUDES AND METIS_LIBRARIES)
|
||||||
|
set(METIS_FIND_QUIETLY TRUE)
|
||||||
|
endif (METIS_INCLUDES AND METIS_LIBRARIES)
|
||||||
|
|
||||||
|
if( DEFINED ENV{METISDIR} )
|
||||||
|
if( NOT DEFINED METIS_ROOT )
|
||||||
|
set(METIS_ROOT "$ENV{METISDIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( (DEFINED ENV{METIS_ROOT}) OR (DEFINED METIS_ROOT) )
|
||||||
|
if( NOT DEFINED METIS_ROOT)
|
||||||
|
set(METIS_ROOT "$ENV{METIS_ROOT}")
|
||||||
|
endif()
|
||||||
|
set(METIS_HINTS "${METIS_ROOT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(METIS_INCLUDES
|
||||||
|
NAMES
|
||||||
|
metis.h
|
||||||
|
HINTS
|
||||||
|
${METIS_HINTS}
|
||||||
|
PATHS
|
||||||
|
"${INCLUDE_INSTALL_DIR}"
|
||||||
|
/usr/local/opt
|
||||||
|
/usr/local
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
)
|
||||||
|
|
||||||
|
if(METIS_INCLUDES)
|
||||||
|
foreach(include IN_LISTS METIS_INCLUDES)
|
||||||
|
get_filename_component(mts_include_dir "${include}" DIRECTORY)
|
||||||
|
get_filename_component(mts_abs_include_dir "${mts_include_dir}" ABSOLUTE)
|
||||||
|
get_filename_component(new_mts_hint "${include_dir}/.." ABSOLUTE )
|
||||||
|
list(APPEND METIS_HINTS "${new_mts_hint}")
|
||||||
|
break()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(METIS_HINTS)
|
||||||
|
list(REMOVE_DUPLICATES METIS_HINTS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
macro(_metis_check_version)
|
||||||
|
file(READ "${METIS_INCLUDES}/metis.h" _metis_version_header)
|
||||||
|
|
||||||
|
string(REGEX MATCH "define[ \t]+METIS_VER_MAJOR[ \t]+([0-9]+)" _metis_major_version_match "${_metis_version_header}")
|
||||||
|
set(METIS_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "define[ \t]+METIS_VER_MINOR[ \t]+([0-9]+)" _metis_minor_version_match "${_metis_version_header}")
|
||||||
|
set(METIS_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "define[ \t]+METIS_VER_SUBMINOR[ \t]+([0-9]+)" _metis_subminor_version_match "${_metis_version_header}")
|
||||||
|
set(METIS_SUBMINOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
if(NOT METIS_MAJOR_VERSION)
|
||||||
|
message(STATUS "Could not determine Metis version. Assuming version 4.0.0")
|
||||||
|
set(METIS_VERSION 4.0.0)
|
||||||
|
else()
|
||||||
|
set(METIS_VERSION ${METIS_MAJOR_VERSION}.${METIS_MINOR_VERSION}.${METIS_SUBMINOR_VERSION})
|
||||||
|
endif()
|
||||||
|
if(${METIS_VERSION} VERSION_LESS ${Metis_FIND_VERSION})
|
||||||
|
set(METIS_VERSION_OK FALSE)
|
||||||
|
else()
|
||||||
|
set(METIS_VERSION_OK TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT METIS_VERSION_OK)
|
||||||
|
message(STATUS "Metis version ${METIS_VERSION} found in ${METIS_INCLUDES}, "
|
||||||
|
"but at least version ${Metis_FIND_VERSION} is required")
|
||||||
|
endif(NOT METIS_VERSION_OK)
|
||||||
|
endmacro(_metis_check_version)
|
||||||
|
|
||||||
|
if(METIS_INCLUDES AND Metis_FIND_VERSION)
|
||||||
|
_metis_check_version()
|
||||||
|
else()
|
||||||
|
set(METIS_VERSION_OK TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
find_library(METIS_LIBRARIES metis
|
||||||
|
HINTS
|
||||||
|
${METIS_HINTS}
|
||||||
|
PATHS
|
||||||
|
"${LIB_INSTALL_DIR}"
|
||||||
|
/usr/local/
|
||||||
|
/usr/local/opt
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
lib64
|
||||||
|
metis/lib)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(METIS DEFAULT_MSG
|
||||||
|
METIS_INCLUDES METIS_LIBRARIES METIS_VERSION_OK)
|
||||||
|
|
||||||
|
mark_as_advanced(METIS_INCLUDES METIS_LIBRARIES)
|
||||||
Loading…
Reference in New Issue