-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
179 lines (152 loc) · 6.76 KB
/
Copy pathCMakeLists.txt
File metadata and controls
179 lines (152 loc) · 6.76 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#
# Copyright Regents of the University of Minnesota, 2014. This software is released under the following license: http://opensource.org/licenses/lgpl-3.0.html.
# Source code originally developed at the University of Minnesota Interactive Visualization Lab (http://ivlab.cs.umn.edu).
#
# Funding for this software development was provided in part by the NSF (IIS-1251069) and NIH (1R01EB018205-01).
# Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
#
# The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health.
#
# Code author(s):
# Dan Orban (dtorban)
#
cmake_minimum_required (VERSION 2.8.2)
project (VISCDF)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../install" CACHE PATH "default install path" FORCE )
endif()
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH} )
#This way will auto detect all source files in the directory,
#while this will work, the preferred technique is to list out
#sourcefiles individually. This will allow cmake to automatically
#rerun if a source file is added, which it will not do if you don't
#list the explicit source files.
#aux_source_directory(${CMAKE_SOURCE_DIR} SOURCEFILES})
#This is how you specific source file individually
set (SOURCEFILES
core/source/NcAttributeCollection.cpp
core/source/NcFileReader.cpp
core/source/NcGroup.cpp
core/source/NcVariable.cpp
core/source/AttributeCollection.cpp
core/source/Dimension.cpp
core/source/Variable.cpp
core/source/VcContainerBase.cpp
core/source/VcGroup.cpp
VCDF_FEA/source/test.cpp
VCDF_FEA/source/FEASimulation.cpp
VCDF_FEA/source/FEAPart.cpp
VCDF_FEA/source/FEAFrame.cpp)
set (HEADERFILES
core/include/memory/CountedPtr.h
core/include/netcdf/NcAttributeCollection.h
core/include/netcdf/NcDimension.h
core/include/netcdf/NcFileReader.h
core/include/netcdf/NcGroup.h
core/include/netcdf/NcVariable.h
core/include/netcdf/visnetcdf.h
core/include/AttributeCollection.h
core/include/Dimension.h
core/include/Variable.h
core/include/VcContainerBase.h
core/include/VcGroup.h
VCDF_FEA/include/FEASimulation.h
VCDF_FEA/include/FEAPart.h
VCDF_FEA/include/FEAFrame.h)
source_group("Header Files" FILES ${HEADERFILES})
############################################################
#Start of library detection
#Any libraries outside of your source should have a corresponding
#find module in the $G/src/cmake/Modules directory and the
#find_package method should be used here.
############################################################
find_package(NetCDF)
if(NETCDF_FOUND)
message("NETCDF was FOUND")
endif(NETCDF_FOUND)
include_directories(${NETCDF_INCLUDES})
############################################################
#End external library searching
############################################################
set (CMAKE_VERBOSE_MAKEFILE TRUE)
# Used for compiling in subdirectories of the project
include_directories (
.
..
${VISCDF_SOURCE_DIR}/core/include
${VISCDF_SOURCE_DIR}/VCDF_FEA/include
)
# If you want to add any link directories you can add them here
link_directories (
${VISCDF_BINARY_DIR}
)
############################################################
#OS Specific flags should go here
############################################################
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
#set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++")
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Linux specific code
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# Windows specific code
endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
############################################################
# Add POSTFIX info
############################################################
set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_RELEASE_POSTFIX "")
set(CMAKE_RELWITHDEBINFO_POSTFIX "rd")
set(CMAKE_MINSIZEREL_POSTFIX "s")
#set the build postfix extension according to the current configuration
if (CMAKE_BUILD_TYPE MATCHES "Release")
set(CMAKE_BUILD_POSTFIX "${CMAKE_RELEASE_POSTFIX}")
elseif (CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
set(CMAKE_BUILD_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}")
elseif (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
set(CMAKE_BUILD_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}")
elseif (CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_BUILD_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
else()
set(CMAKE_BUILD_POSTFIX "")
endif()
############################################################
#Finally add all the targets here
############################################################
#First an example of executable target
add_executable(testfea ${SOURCEFILES})
#All of libs should be added here
#If its a debug-only lib specify it as "debug <libtoadd>"
#If its a opt-only lib specify it as "optimized <libtoadd>"
#<libtoadd> should either be a full path to the lib, or the OS
#indepdent way it would appear in the command line (i.e. -l<libtoadd>)
#If the second is way is used you need to sure the directory the lib is
#in will be found
target_link_libraries (testfea ${LIBS_DEBUG} ${LIBS_OPT} ${LIBS_ALL} ${NETCDF_LIBRARIES})
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
FILE(GLOB children RELATIVE ${NETCDF_EXECUTABLE_DIR} ${NETCDF_EXECUTABLE_DIR}/*.dll)
FOREACH(child ${children})
add_custom_command(TARGET testfea POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/Debug
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/Release
COMMAND ${CMAKE_COMMAND} -E copy ${NETCDF_EXECUTABLE_DIR}/${child} ${PROJECT_BINARY_DIR}/Debug/${child}
COMMAND ${CMAKE_COMMAND} -E copy ${NETCDF_EXECUTABLE_DIR}/${child} ${PROJECT_BINARY_DIR}/Release/${child}
)
ENDFOREACH()
endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
#Second an example of a library target
#It should default to making a static library
add_library(viscdf ${SOURCEFILES} ${SOURCEFILES})
#You can also add subprojects that are in subdirectories
#These subdirectories must contain their own CMakeLists.txt
#add_subdirectory (mysubproject)
install(DIRECTORY core/include/ DESTINATION include)
install(DIRECTORY VCDF_FEA/include/ DESTINATION include)
install( TARGETS viscdf testfea
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)