This repository has been archived by the owner on Jun 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
74 lines (57 loc) · 2.18 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
PROJECT(OPESCI)
# The version number.
set (OPESCI_VERSION_MAJOR 0)
set (OPESCI_VERSION_MINOR 1)
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include(CTest)
enable_testing()
enable_language(CXX)
set (OPESCI_LIBRARIES)
FIND_PACKAGE(VTK NO_MODULE)
if(VTK_FOUND)
message(STATUS "Found VTK: ${VTK_DIR} (found version \"${VTK_VERSION}\")")
include(${VTK_USE_FILE})
set (OPESCI_LIBRARIES ${VTK_LIBRARIES} ${OPESCI_LIBRARIES})
add_definitions(-DVTK_FOUND)
endif()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-literal-suffix -Wno-deprecated")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
message(STATUS "Adding magic sauce for Intel compiler.")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -xHOST -g")
endif()
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
add_definitions(-DOPENMP_FOUND)
endif()
find_package(PAPI)
if(PAPI_FOUND)
include_directories(${PAPI_INCLUDE_DIRS})
set (OPESCI_LIBRARIES ${PAPI_LIBRARIES} ${OPESCI_LIBRARIES})
add_definitions(-DOPESCI_HAVE_PAPI)
endif()
include_directories(include)
file(GLOB CXX_SOURCES src/*.cpp)
# target_link_library
add_library(opesci SHARED ${CXX_SOURCES})
target_link_libraries(opesci ${OPESCI_LIBRARIES})
install(DIRECTORY include/ DESTINATION include/opesci FILES_MATCHING PATTERN *.h)
install(FILES libopesci.so DESTINATION lib)
ADD_EXECUTABLE(segy2vts src/segy2vts.cpp)
TARGET_LINK_LIBRARIES(segy2vts ${OPESCI_LIBRARIES} opesci)