mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#804 Updated ERT based on 6287acdb0d039ce13eb9956b67035280a3de9539
This commit is contained in:
42
ThirdParty/Ert/cmake/Modules/UseMultiArch.cmake
vendored
Normal file
42
ThirdParty/Ert/cmake/Modules/UseMultiArch.cmake
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# - Multiarch support in object code library directories
|
||||
#
|
||||
# This module sets the following variable
|
||||
# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
|
||||
# depending on the platform; use this path
|
||||
# for platform-specific binaries.
|
||||
#
|
||||
# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform;
|
||||
# use this path for architecture-independent
|
||||
# files.
|
||||
#
|
||||
# Note that it will override the results of GNUInstallDirs if included after
|
||||
# that module.
|
||||
|
||||
# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu;
|
||||
# Fedora put module files in lib64/ too, but Debian uses lib/ for that
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
# Debian or Ubuntu?
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
set (_libdir_noarch "lib")
|
||||
else (EXISTS "/etc/debian_version")
|
||||
# 64-bit system?
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_noarch "lib64")
|
||||
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_noarch "lib")
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_def "${_libdir_noarch}")
|
||||
endif (EXISTS "/etc/debian_version")
|
||||
else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set (_libdir_def "lib")
|
||||
set (_libdir_noarch "lib")
|
||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
|
||||
# let the user override if somewhere else is desirable
|
||||
set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries")
|
||||
set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files")
|
||||
mark_as_advanced (
|
||||
CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_LIBDIR_NOARCH
|
||||
)
|
||||
7
ThirdParty/Ert/cmake/Tests/test_getenv.c
vendored
Normal file
7
ThirdParty/Ert/cmake/Tests/test_getenv.c
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
getenv("PATH");
|
||||
}
|
||||
|
||||
10
ThirdParty/Ert/cmake/Tests/test_have_sigbus.c
vendored
Normal file
10
ThirdParty/Ert/cmake/Tests/test_have_sigbus.c
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <signal.h>
|
||||
|
||||
void sigbus_handler(int signal) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
signal(SIGBUS , sigbus_handler);
|
||||
}
|
||||
5
ThirdParty/Ert/cmake/Tests/test_isfinite.c
vendored
Normal file
5
ThirdParty/Ert/cmake/Tests/test_isfinite.c
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <math.h>
|
||||
|
||||
int main( int argc , char ** argv) {
|
||||
isfinite(0.0);
|
||||
}
|
||||
23
ThirdParty/Ert/cmake/Tests/test_mktime_before1970.c
vendored
Normal file
23
ThirdParty/Ert/cmake/Tests/test_mktime_before1970.c
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
struct tm ts;
|
||||
ts.tm_sec = 0;
|
||||
ts.tm_min = 0;
|
||||
ts.tm_hour = 0;
|
||||
ts.tm_mday = 1;
|
||||
ts.tm_mon = 0;
|
||||
ts.tm_year = 0;
|
||||
ts.tm_isdst = -1;
|
||||
{
|
||||
time_t t = mktime( &ts );
|
||||
if (t == -1)
|
||||
exit(1);
|
||||
else
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
6
ThirdParty/Ert/cmake/Tests/test_mode_t.c
vendored
Normal file
6
ThirdParty/Ert/cmake/Tests/test_mode_t.c
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
mode_t new_mode = S_IWGRP;
|
||||
chmod( "/tmp" , new_mode );
|
||||
}
|
||||
11
ThirdParty/Ert/cmake/Tests/test_openmp.c
vendored
Normal file
11
ThirdParty/Ert/cmake/Tests/test_openmp.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <omp.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
int sum = 0;
|
||||
#pragma omp parallel for
|
||||
for (int i=0; i < 100; i++)
|
||||
sum += i;
|
||||
|
||||
}
|
||||
|
||||
6
ThirdParty/Ert/cmake/Tests/test_pid_t.c
vendored
Normal file
6
ThirdParty/Ert/cmake/Tests/test_pid_t.c
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
pid_t pid = getpid();
|
||||
}
|
||||
5
ThirdParty/Ert/cmake/Tests/test_shared_ptr.cpp
vendored
Normal file
5
ThirdParty/Ert/cmake/Tests/test_shared_ptr.cpp
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <memory>
|
||||
|
||||
int main( int argc , char ** argv) {
|
||||
std::shared_ptr<int> ptr = std::make_shared<int>( 10 );
|
||||
}
|
||||
16
ThirdParty/Ert/cmake/Tests/test_va_copy.c
vendored
Normal file
16
ThirdParty/Ert/cmake/Tests/test_va_copy.c
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int func(int arg1 , ...) {
|
||||
va_list ap;
|
||||
va_list copy;
|
||||
va_start(ap , arg1);
|
||||
va_copy( copy , ap );
|
||||
|
||||
va_end(ap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
func(10 , NULL , "String" );
|
||||
}
|
||||
35
ThirdParty/Ert/cmake/cmake_pyc
vendored
Normal file
35
ThirdParty/Ert/cmake/cmake_pyc
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
# Small 'python compiler' used in the build system for ert. The
|
||||
# commandline arguments should be:
|
||||
#
|
||||
# cmake_pyc.py src1.py src2.py src3.py /path/to/pyc/files
|
||||
#
|
||||
# The input source files can contain a path component like
|
||||
# path/src1.py, but the path will not be recreated in the target
|
||||
# domain.
|
||||
|
||||
|
||||
def compile_file(src_file , target_file):
|
||||
path = os.path.dirname( target_file )
|
||||
if not os.path.exists( path ):
|
||||
os.makedirs( path )
|
||||
try:
|
||||
py_compile.compile( src_file , cfile = target_file , doraise = True)
|
||||
except Exception,error:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
target_path = sys.argv[-1]
|
||||
for src_file in sys.argv[1:-1]:
|
||||
compile_file( src_file , "%s/%sc" % (target_path , os.path.basename(src_file)))
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
||||
32
ThirdParty/Ert/cmake/cmake_pyc2
vendored
Normal file
32
ThirdParty/Ert/cmake/cmake_pyc2
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
|
||||
src_file = sys.argv[1]
|
||||
target_file = sys.argv[2]
|
||||
|
||||
(target_path , tail) = os.path.split( target_file )
|
||||
if not os.path.exists( target_path ):
|
||||
try:
|
||||
os.makedirs( target_path )
|
||||
except:
|
||||
# When running with make -j 4 there might be a race to create this directory.
|
||||
pass
|
||||
|
||||
shutil.copyfile( src_file , target_file )
|
||||
shutil.copystat( src_file , target_file )
|
||||
try:
|
||||
py_compile.compile( target_file , doraise = True)
|
||||
except Exception,error:
|
||||
sys.exit("py_compile(%s) failed:%s" % (target_file , error))
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
||||
20
ThirdParty/Ert/cmake/cmake_pyc_file
vendored
Normal file
20
ThirdParty/Ert/cmake/cmake_pyc_file
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
# Small 'python compiler' used in the build system for ert.
|
||||
|
||||
for file in sys.argv[1:]:
|
||||
try:
|
||||
py_compile.compile( file , doraise = True )
|
||||
except Exception,error:
|
||||
sys.exit("py_compile(%s) failed:%s" % (file , error))
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
||||
35
ThirdParty/Ert/cmake/cmake_pyc_tree
vendored
Normal file
35
ThirdParty/Ert/cmake/cmake_pyc_tree
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
# Small 'python compiler' used in the build system for ert. The
|
||||
# commandline argument should be the top level name of directory
|
||||
# containing python source code. The 'compiler' will walk through the
|
||||
# tree and in-place compile all the python files.
|
||||
|
||||
|
||||
root_path = sys.argv[1]
|
||||
for (root , dir_list , file_list) in os.walk( root_path ):
|
||||
for file in file_list:
|
||||
full_path = os.path.join( root , file )
|
||||
(tmp , ext) = os.path.splitext( full_path )
|
||||
if ext == ".py":
|
||||
py_file = full_path
|
||||
pyc_file = full_path + "c"
|
||||
if os.path.exists( pyc_file ):
|
||||
os.unlink( pyc_file )
|
||||
|
||||
try:
|
||||
print "Compiling: %s" % py_file
|
||||
py_compile.compile( py_file , doraise = True )
|
||||
except Exception,error:
|
||||
sys.exit("py_compile(%s) failed:%s" % (py_file , error))
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
||||
85
ThirdParty/Ert/cmake/create_cmakelists.py
vendored
Normal file
85
ThirdParty/Ert/cmake/create_cmakelists.py
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from os import listdir
|
||||
from os.path import isfile, join, isdir, islink
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
def findFilesAndDirectories(directory):
|
||||
all_files = listdir(directory)
|
||||
files = []
|
||||
directories = []
|
||||
for f in all_files:
|
||||
path = join(directory, f)
|
||||
if isfile(path) and not f == "CMakeLists.txt" and not islink(path):
|
||||
files.append(f)
|
||||
if isdir(path):
|
||||
directories.append(f)
|
||||
|
||||
return sorted(files), sorted(directories)
|
||||
|
||||
|
||||
def findRelativeModulePath(directory):
|
||||
"""@type directory: str"""
|
||||
index = directory.rfind("python/")
|
||||
index += len("python/")
|
||||
return directory[index:len(directory)]
|
||||
|
||||
def createPythonSources(files, test_sources=False):
|
||||
result = ""
|
||||
|
||||
if len(files) > 0:
|
||||
result = "set(%s\n" % ("PYTHON_SOURCES" if not test_sources else "TEST_SOURCES")
|
||||
|
||||
files = [f for f in files if f.endswith(".py")]
|
||||
|
||||
for f in files:
|
||||
result += " " + str(f) + "\n"
|
||||
|
||||
if len(files) > 0:
|
||||
result += ")"
|
||||
|
||||
return result
|
||||
|
||||
def addSubDirectories(directories):
|
||||
result = ""
|
||||
|
||||
for d in directories:
|
||||
result += "add_subdirectory(" + str(d) + ")\n"
|
||||
|
||||
return result
|
||||
|
||||
def addPythonPackage(relative_module_path, test_sources=False):
|
||||
module_name = ".".join(relative_module_path.split("/"))
|
||||
source_type = "PYTHON_SOURCES" if not test_sources else "TEST_SOURCES"
|
||||
template = "add_python_package(\"python.%s\" ${PYTHON_INSTALL_PREFIX}/%s \"${%s}\" %s)"
|
||||
|
||||
install = "False" if test_sources else "True"
|
||||
|
||||
return template % (module_name, relative_module_path, source_type, install)
|
||||
|
||||
def addInclude(filename):
|
||||
with open(filename, "r") as include_file:
|
||||
content = include_file.read()
|
||||
return content
|
||||
|
||||
files, directories = findFilesAndDirectories(sys.argv[1])
|
||||
module_path = findRelativeModulePath(sys.argv[1])
|
||||
|
||||
output_file = join(sys.argv[1], "CMakeLists.txt")
|
||||
test_sources = module_path.startswith("tests")
|
||||
with open(output_file, "w+") as text_file:
|
||||
text_file.write(createPythonSources(files, test_sources=test_sources))
|
||||
text_file.write("\n\n")
|
||||
text_file.write(addPythonPackage(module_path, test_sources=test_sources))
|
||||
text_file.write("\n\n")
|
||||
text_file.write(addSubDirectories(directories))
|
||||
|
||||
if "local.cmake" in files:
|
||||
text_file.write("\n\n")
|
||||
text_file.write(addInclude(join(sys.argv[1], "local.cmake")))
|
||||
|
||||
|
||||
|
||||
|
||||
74
ThirdParty/Ert/cmake/ert_api_check.cmake
vendored
Normal file
74
ThirdParty/Ert/cmake/ert_api_check.cmake
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# This file contains feature checks which affect the API of the final
|
||||
# product; i.e. if the test for zlib fails the function
|
||||
# buffer_fwrite_compressed() will not be available in the final
|
||||
# installation.
|
||||
#
|
||||
# The results of these tests will be assembled in the
|
||||
# ert/util/ert_api_config.h header; all the symbols in that header will
|
||||
# have a ERT_ prefix. The generated header is part of the api and can be
|
||||
# included by other header files in the ert source.
|
||||
|
||||
find_library( BLAS_LIBRARY NAMES blas)
|
||||
if (BLAS_LIBRARY)
|
||||
set(ERT_HAVE_BLAS ON)
|
||||
endif()
|
||||
|
||||
find_library( LAPACK_LIBRARY NAMES lapack)
|
||||
if (LAPACK_LIBRARY)
|
||||
set(ERT_HAVE_LAPACK ON)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
find_library( ZLIB_LIBRARY NAMES z )
|
||||
find_path( ZLIB_HEADER zlib.h /usr/include )
|
||||
if (ZLIB_LIBRARY AND ZLIB_HEADER)
|
||||
set( ERT_HAVE_ZLIB ON )
|
||||
else()
|
||||
message("ZLib not found - zlib support will not be included." )
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
try_compile( ERT_HAVE_ISFINITE ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c )
|
||||
find_path( ERT_HAVE_GETOPT getopt.h /usr/include )
|
||||
find_path( ERT_HAVE_UNISTD unistd.h /usr/include )
|
||||
|
||||
check_function_exists( posix_spawn ERT_HAVE_SPAWN )
|
||||
check_function_exists( opendir ERT_HAVE_OPENDIR )
|
||||
check_function_exists( symlink ERT_HAVE_SYMLINK )
|
||||
check_function_exists( readlinkat ERT_HAVE_READLINKAT )
|
||||
check_function_exists( glob ERT_HAVE_GLOB )
|
||||
check_function_exists( getuid ERT_HAVE_GETUID )
|
||||
check_function_exists( regexec ERT_HAVE_REGEXP )
|
||||
check_function_exists( lockf ERT_HAVE_LOCKF )
|
||||
|
||||
|
||||
check_type_size(time_t SIZE_OF_TIME_T)
|
||||
if (${SIZE_OF_TIME_T} EQUAL 8)
|
||||
try_run( RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mktime_before1970.c )
|
||||
if (${COMPILE_RESULT})
|
||||
if (${RUN_RESULT} EQUAL 0)
|
||||
set( ERT_TIME_T_64BIT_ACCEPT_PRE1970 ON )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (ERT_WINDOWS)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set( ERT_WINDOWS_LFS ON )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (HAVE_PTHREAD)
|
||||
set( ERT_HAVE_THREAD_POOL ON )
|
||||
endif()
|
||||
|
||||
|
||||
find_program(PING_PATH NAMES ping)
|
||||
if (PING_PATH)
|
||||
set( ERT_HAVE_PING ON )
|
||||
add_definitions( -DPING_CMD="${PING_PATH}" )
|
||||
endif()
|
||||
76
ThirdParty/Ert/cmake/ert_build_check.cmake
vendored
Normal file
76
ThirdParty/Ert/cmake/ert_build_check.cmake
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# This file contains checks which are used to implement portable
|
||||
# utility functions. The results of these check are assembled in the
|
||||
# generated header "ert/util/build_config.h" - that header is NOT part
|
||||
# of the public api and it should only be included from source files
|
||||
# as part of the compilation.
|
||||
#
|
||||
# Check which affect the final api are implemented in the
|
||||
# ert_api_check.cmake file.
|
||||
|
||||
find_library( PTHREAD_LIBRARY NAMES pthread )
|
||||
if (PTHREAD_LIBRARY)
|
||||
set( HAVE_PTHREAD ON )
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} pthread)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m )
|
||||
set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} m )
|
||||
endif(UNIX)
|
||||
|
||||
|
||||
check_function_exists( localtime_r HAVE_LOCALTIME_R )
|
||||
check_function_exists( gmtime_r HAVE_GMTIME_R )
|
||||
check_function_exists( realpath HAVE_REALPATH )
|
||||
check_function_exists( usleep HAVE__USLEEP )
|
||||
check_function_exists( fnmatch HAVE_FNMATCH )
|
||||
check_function_exists( ftruncate HAVE_FTRUNCATE )
|
||||
check_function_exists( round HAVE_ROUND )
|
||||
check_function_exists( GetTempPath HAVE_WINDOWS_GET_TEMP_PATH )
|
||||
check_function_exists( fork HAVE_FORK )
|
||||
check_function_exists( getpwuid HAVE_GETPWUID )
|
||||
check_function_exists( fsync HAVE_FSYNC )
|
||||
check_function_exists( setenv HAVE_POSIX_SETENV )
|
||||
check_function_exists( chmod HAVE_CHMOD )
|
||||
check_function_exists( pthread_timedjoin_np HAVE_TIMEDJOIN)
|
||||
check_function_exists( pthread_yield_np HAVE_YIELD_NP)
|
||||
check_function_exists( pthread_yield HAVE_YIELD)
|
||||
check_function_exists( fseeko HAVE_FSEEKO )
|
||||
check_function_exists( timegm HAVE_TIMEGM )
|
||||
|
||||
check_function_exists( _mkdir HAVE_WINDOWS_MKDIR)
|
||||
if (NOT HAVE_WINDOWS_MKDIR)
|
||||
check_function_exists( mkdir HAVE_POSIX_MKDIR)
|
||||
endif()
|
||||
|
||||
|
||||
check_function_exists( _chdir HAVE_WINDOWS_CHDIR)
|
||||
if (NOT HAVE_WINDOWS_CHDIR)
|
||||
check_function_exists( chdir HAVE_POSIX_CHDIR)
|
||||
endif()
|
||||
|
||||
check_function_exists( _getcwd HAVE_WINDOWS_GETCWD)
|
||||
if (NOT HAVE_WINDOWS_GETCWD)
|
||||
check_function_exists( getcwd HAVE_POSIX_GETCWD)
|
||||
endif()
|
||||
|
||||
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(_tzname time.h HAVE_WINDOWS_TZNAME)
|
||||
check_symbol_exists( tzname time.h HAVE_TZNAME)
|
||||
|
||||
find_path( HAVE_EXECINFO execinfo.h /usr/include )
|
||||
|
||||
try_compile( HAVE_VA_COPY ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_va_copy.c )
|
||||
try_compile( HAVE_SIGBUS ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_sigbus.c )
|
||||
try_compile( HAVE_PID_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_pid_t.c )
|
||||
try_compile( HAVE_MODE_T ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_mode_t.c )
|
||||
|
||||
|
||||
set( BUILD_CXX ON )
|
||||
try_compile( HAVE_CXX_SHARED_PTR ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/Tests/test_shared_ptr.cpp )
|
||||
if (NOT HAVE_CXX_SHARED_PTR)
|
||||
set( BUILD_CXX OFF )
|
||||
endif()
|
||||
|
||||
|
||||
30
ThirdParty/Ert/cmake/ert_lib_check.cmake
vendored
Normal file
30
ThirdParty/Ert/cmake/ert_lib_check.cmake
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file contains various checks which will append to the list
|
||||
# $ERT_EXTERNAL_UTIL_LIBS which should contain all the external library
|
||||
# dependencies. Observe that all library dependencies go transitively
|
||||
# through the ert_util library.
|
||||
|
||||
if (ERT_HAVE_LAPACK)
|
||||
set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${LAPACK_LIBRARY} ${BLAS_LIBRARY})
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LAPACK_LIBRARY} ${BLAS_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
||||
if (ERT_WINDOWS)
|
||||
find_library( SHLWAPI_LIBRARY NAMES Shlwapi )
|
||||
set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} Shlwapi )
|
||||
endif()
|
||||
|
||||
|
||||
if (ERT_HAVE_ZLIB)
|
||||
set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${ZLIB_LIBRARY} )
|
||||
endif()
|
||||
|
||||
if (HAVE_PTHREAD)
|
||||
set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${PTHREAD_LIBRARY} )
|
||||
endif()
|
||||
|
||||
find_library( DL_LIBRARY NAMES dl )
|
||||
find_path( DLFUNC_HEADER dlfcn.h )
|
||||
if (DL_LIBRARY AND DLFUNC_HEADER)
|
||||
set( ERT_EXTERNAL_UTIL_LIBS ${ERT_EXTERNAL_UTIL_LIBS} ${DL_LIBRARY} )
|
||||
endif()
|
||||
16
ThirdParty/Ert/cmake/ert_link.cmake
vendored
Normal file
16
ThirdParty/Ert/cmake/ert_link.cmake
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
option (USE_RUNPATH "Embed original dependency paths in installed library" ON)
|
||||
if (USE_RUNPATH)
|
||||
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif (USE_RUNPATH)
|
||||
else()
|
||||
set(USE_RUNPATH OFF)
|
||||
endif()
|
||||
|
||||
|
||||
macro( add_runpath target )
|
||||
if(NOT ERT_MAC)
|
||||
set_target_properties( ${target} PROPERTIES LINK_FLAGS -Wl,--enable-new-dtags)
|
||||
endif()
|
||||
endmacro()
|
||||
17
ThirdParty/Ert/cmake/ert_module_name.cmake
vendored
Normal file
17
ThirdParty/Ert/cmake/ert_module_name.cmake
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
function( ert_module_name module module_name lib_path )
|
||||
|
||||
set( osx_file ${lib_path}/${module_name}.dylib )
|
||||
set( linux_file ${lib_path}/${module_name}.so )
|
||||
set( win_file ${lib_path}/${module_name}.dll )
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set( ${module} ${linux_file} PARENT_SCOPE)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set( ${module} ${osx_file} PARENT_SCOPE)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set( ${module} ${win_file} PARENT_SCOPE)
|
||||
else()
|
||||
message( FATAL_ERROR "Hmmm - which platform is this ??")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
25
ThirdParty/Ert/cmake/python.cmake
vendored
Normal file
25
ThirdParty/Ert/cmake/python.cmake
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
macro(add_python_target tgt PYTHON_INSTALL_PATH)
|
||||
SET(OUT_FILES "")
|
||||
foreach(file ${python_source_files})
|
||||
set(OUT ${CMAKE_CURRENT_BINARY_DIR}/${file}.pyc)
|
||||
list(APPEND OUT_FILES ${OUT})
|
||||
#------------------------------------------------------
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${OUT}
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/cmake/cmake_pyc
|
||||
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PATH}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.py)
|
||||
#------------------------------------------------------
|
||||
if (INSTALL_ERT)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/${PYTHON}/${file}.pyc DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PATH})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file}.py DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PATH})
|
||||
endif()
|
||||
endforeach(file)
|
||||
list(REMOVE_DUPLICATES OUT_FILES)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
${tgt} ALL DEPENDS ${OUT_FILES})
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
43
ThirdParty/Ert/cmake/python.cmake2
vendored
Normal file
43
ThirdParty/Ert/cmake/python.cmake2
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
find_package (PythonInterp REQUIRED)
|
||||
endif ()
|
||||
function(add_python_package target package_path source_files install_package)
|
||||
|
||||
set(build_files "")
|
||||
|
||||
foreach (file ${source_files} )
|
||||
string(SUBSTRING ${file} 0 1 first_char)
|
||||
string(SUBSTRING ${file} 1 1 second_char)
|
||||
if (first_char STREQUAL "/" OR second_char STREQUAL ":")
|
||||
set( source_file ${file} )
|
||||
set( build_file ${file} )
|
||||
file(RELATIVE_PATH file ${CMAKE_CURRENT_BINARY_DIR} ${file})
|
||||
set(dependent_target)
|
||||
else()
|
||||
set( source_file ${CMAKE_CURRENT_SOURCE_DIR}/${file} )
|
||||
set( build_file ${PROJECT_BINARY_DIR}/${package_path}/${file} )
|
||||
set(dependent_target DEPENDS ${source_file})
|
||||
endif()
|
||||
if("$ENV{DESTDIR}" STREQUAL "")
|
||||
set( install_file ${CMAKE_INSTALL_PREFIX}/${package_path}/${file} )
|
||||
else()
|
||||
set( install_file $ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/${package_path}/${file} )
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${build_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS ${PROJECT_SOURCE_DIR}/cmake/cmake_pyc2 ${source_file} ${build_file}
|
||||
${dependent_target})
|
||||
|
||||
list(APPEND build_files ${build_file} )
|
||||
|
||||
if (install_package)
|
||||
install(FILES ${build_file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${package_path})
|
||||
install(CODE "execute_process(COMMAND ${PROJECT_SOURCE_DIR}/cmake/cmake_pyc_file ${install_file})")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
add_custom_target( ${target} ALL DEPENDS ${build_files})
|
||||
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user