tCMakeLists.txt - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tCMakeLists.txt (5614B)
---
1 # Create a subdirectory in the build directory containing symlinks to directories in
2 # PISM's source tree. This way other code using PISM needs to add only *one* directory to
3 # the compiler search path; see #166. This subdirectory contains a generated header,
4 # otherwise we could create *one* symlink to ${CMAKE_CURRENT_SOURCE_DIR} instead.
5
6 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/pism)
7
8 subdirlist(directories ${CMAKE_CURRENT_SOURCE_DIR})
9 foreach(d IN LISTS directories)
10 execute_process(
11 COMMAND
12 ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/${d} ${CMAKE_BINARY_DIR}/pism/${d})
13 endforeach(d)
14 unset(directories)
15
16 # Generate the header containing information about PISM's build-time configuration.
17 configure_file(pism_config.hh.in ${CMAKE_BINARY_DIR}/pism/pism_config.hh ESCAPE_QUOTES)
18 install(FILES ${CMAKE_BINARY_DIR}/pism/pism_config.hh
19 DESTINATION include/pism)
20
21 # Generate the source file containing constants defined in pism_config.hh Note that we
22 # don't escape quotes here: PETSc's configure flags should have them escaped already (if
23 # we're lucky).
24 configure_file(pism_config.cc.in pism_config.cc)
25
26 # PISM's build directory contains the symlink to its source directory (see above). This
27 # makes it possible to #include PISM's headers using '#include "pism/header.hh"' both in
28 # PISM's sources and in code linking to PISM as a library.
29 include_directories (${CMAKE_BINARY_DIR})
30
31 # This library contains PISM code implementing the ice-sheet model itself
32 # (using other PISM libraries and a good deal of non-trivial code).
33 add_library (pism
34 ${EVERYTRACE_cf_mpi_REFADDR}
35 ${CMAKE_CURRENT_BINARY_DIR}/pism_config.cc
36 age/AgeColumnSystem.cc
37 age/AgeModel.cc
38 basalstrength/ConstantYieldStress.cc
39 basalstrength/MohrCoulombYieldStress.cc
40 basalstrength/MohrCoulombPointwise.cc
41 basalstrength/YieldStress.cc
42 energy/BedrockColumn.cc
43 energy/BTU_Full.cc
44 energy/BTU_Minimal.cc
45 energy/BedThermalUnit.cc
46 energy/DummyEnergyModel.cc
47 energy/EnergyModel.cc
48 energy/EnthalpyModel.cc
49 energy/CHSystem.cc
50 energy/TemperatureModel.cc
51 energy/bootstrapping.cc
52 energy/enthSystem.cc
53 energy/tempSystem.cc
54 energy/utilities.cc
55 geometry/Geometry.cc
56 geometry/GeometryEvolution.cc
57 geometry/grounded_cell_fraction.cc
58 geometry/part_grid_threshold_thickness.cc
59 icemodel/IceModel.cc
60 icemodel/frontretreat.cc
61 icemodel/diagnostics.cc
62 icemodel/diagnostics.cc
63 icemodel/energy.cc
64 icemodel/flux_balance.hh
65 icemodel/fracture_density.cc
66 icemodel/initialization.cc
67 icemodel/output.cc
68 icemodel/output_backup.cc
69 icemodel/output_extra.cc
70 icemodel/output_save.cc
71 icemodel/output_ts.cc
72 icemodel/printout.cc
73 icemodel/timestepping.cc
74 icemodel/utilities.cc
75 icemodel/viewers.cc
76 stressbalance/timestepping.cc
77 fracturedensity/FractureDensity.cc
78 util/ColumnSystem.cc
79 util/pism_signal.c
80 $<TARGET_OBJECTS:frontretreat>
81 $<TARGET_OBJECTS:hydrology>
82 $<TARGET_OBJECTS:flowlaws>
83 $<TARGET_OBJECTS:stressbalance>
84 $<TARGET_OBJECTS:util>
85 $<TARGET_OBJECTS:earth>
86 $<TARGET_OBJECTS:verif>
87 $<TARGET_OBJECTS:boundary>
88 $<TARGET_OBJECTS:inverse>
89 $<TARGET_OBJECTS:regional>
90 $<TARGET_OBJECTS:calcalcs>
91 $<TARGET_OBJECTS:cubature>
92 )
93 target_link_libraries (pism ${Pism_EXTERNAL_LIBS})
94 add_dependencies (pism pism_config)
95
96 if (Pism_USE_JANSSON)
97 if (Pism_BUILD_JANSSON)
98 add_dependencies (pism pism_jansson)
99 endif()
100 endif()
101
102 # Main executables:
103 add_executable (pismr pismr.cc)
104 target_link_libraries (pismr pism)
105
106 # Simplified geometry
107 add_executable (pisms pisms.cc
108 icemodel/IceEISModel.cc)
109 target_link_libraries (pisms pism)
110
111 # Verification mode "driver".
112 add_executable (pismv pismv.cc)
113 target_link_libraries (pismv pism)
114
115 find_program (NCGEN_PROGRAM "ncgen" REQUIRED)
116 mark_as_advanced(NCGEN_PROGRAM)
117
118 add_custom_command (OUTPUT pism_config.nc
119 COMMAND ${NCGEN_PROGRAM} -o ${PROJECT_BINARY_DIR}/pism_config.nc ${CMAKE_CURRENT_SOURCE_DIR}/pism_config.cdl
120 DEPENDS pism_config.cdl
121 )
122 add_custom_target (pism_config DEPENDS pism_config.nc)
123
124 # Install the library
125 install (
126 TARGETS pism
127 LIBRARY DESTINATION ${Pism_LIB_DIR}
128 ARCHIVE DESTINATION ${Pism_LIB_DIR})
129
130 # Install executables.
131 install (TARGETS
132 pismr pisms pismv # executables
133 RUNTIME DESTINATION ${Pism_BIN_DIR})
134
135 install (FILES
136 "${PROJECT_BINARY_DIR}/pism_config.nc"
137 DESTINATION ${Pism_SHARE_DIR})
138
139 # miscellaneous executables needed by software tests
140 if (Pism_BUILD_EXTRA_EXECS)
141 add_executable (btutest energy/btutest.cc)
142 target_link_libraries (btutest pism)
143 list (APPEND EXTRA_EXECS btutest)
144
145 install (TARGETS
146 ${EXTRA_EXECS}
147 RUNTIME DESTINATION ${Pism_BIN_DIR}
148 LIBRARY DESTINATION ${Pism_LIB_DIR}
149 ARCHIVE DESTINATION ${Pism_LIB_DIR})
150 endif (Pism_BUILD_EXTRA_EXECS)
151
152
153 # ------------ Header Files
154 install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/
155 DESTINATION include/pism
156 FILES_MATCHING
157 PATTERN "*.hh"
158 PATTERN "*.h"
159 PATTERN "external" EXCLUDE
160 PATTERN "pythonbindings" EXCLUDE
161 PATTERN "doc" EXCLUDE
162 PATTERN "figs" EXCLUDE
163 PATTERN "ssa/tests" EXCLUDE
164 PATTERN "verification/tests/fortran" EXCLUDE
165 PATTERN "rheology/approximate" EXCLUDE
166 PATTERN "tracer" EXCLUDE
167 )
168
169 add_subdirectory (coupler)
170 add_subdirectory (earth)
171 add_subdirectory (external)
172 add_subdirectory (frontretreat)
173 add_subdirectory (hydrology)
174 add_subdirectory (inverse)
175 add_subdirectory (regional)
176 add_subdirectory (rheology)
177 add_subdirectory (stressbalance)
178 add_subdirectory (util)
179 add_subdirectory (verification)
180
181 if (Pism_BUILD_ICEBIN)
182 add_subdirectory (icebin)
183 endif()
184
185 if (Pism_DEBUG OR Pism_BUILD_PYTHON_BINDINGS)
186 add_subdirectory (pythonbindings)
187 endif()