CMakeLists.txt 6.48 KB
Newer Older
1
# Look for dependencies - bail out if any necessary ones not found
2

Owen Arnold's avatar
Owen Arnold committed
3
4
set(WORKBENCH_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX})
set(WORKBENCH_PLUGINS_DIR ${CMAKE_INSTALL_PREFIX}/plugins)
5
set(WORKBENCH_BIN_DIR ${CMAKE_INSTALL_PREFIX})
6
7
8
9
10
check_include_files(stdint.h stdint)
if(stdint)
  add_definitions(-DHAVE_STDINT_H)
endif()

11
12
13
14
15
# Globally-linked libraries variable

# Might just as well link everything to Boost & Poco (found in CommonSetup)
# Boost_LIBRARIES variable is redefined by MPISetup so capture the value here
# and just add MPI stuff if required
16
set(MANTIDLIBS ${Boost_LIBRARIES} ${POCO_LIBRARIES})
17

18
# MPI-enable build setup
19

20
# Only available on Linux (specifically RedHat), and for a framework-only build
21
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
22
  option(MPI_BUILD "Enable MPI options")
23
24
25
26
27
28
  if(MPI_BUILD)
    include(MPISetup)
    set(MANTIDLIBS ${MANTIDLIBS} ${Boost_LIBRARIES} ${MPI_CXX_LIBRARIES})
  endif(MPI_BUILD)
endif()

29
option(MPI_EXPERIMENTAL "Enable MPI options")
30
31
32
33
if(MPI_EXPERIMENTAL)
  include(BoostMPI)
endif()

34
# Now add the packages one-by-one, building up the dependencies as we go
35
include(TargetFunctions)
36

37
38
add_custom_target(FrameworkTests) # target for all framework tests
add_dependencies(check FrameworkTests)
39
add_dependencies(FrameworkTests Framework)
40

41
42
43
include_directories(Types/inc)
add_subdirectory(Types)
set(MANTIDLIBS ${MANTIDLIBS} Types)
44

45
46
include_directories(Kernel/inc)
add_subdirectory(Kernel)
47

48
49
include_directories(Parallel/inc)
add_subdirectory(Parallel)
50

51
52
include_directories(HistogramData/inc)
add_subdirectory(HistogramData)
53

54
55
include_directories(Indexing/inc)
add_subdirectory(Indexing)
56

57
58
include_directories(Beamline/inc)
add_subdirectory(Beamline)
59

60
set(MANTIDLIBS ${MANTIDLIBS} Parallel)
61
# HistogramData has header-only dependency on Kernel, so Kernel comes after.
62
63
64
65
set(MANTIDLIBS ${MANTIDLIBS} HistogramData)
set(MANTIDLIBS ${MANTIDLIBS} Indexing)
set(MANTIDLIBS ${MANTIDLIBS} Kernel)
set(MANTIDLIBS ${MANTIDLIBS} Beamline)
66

67
# muParser needed by Geometry and subsequent packages
68
69
70
71
72
73
74
75
76
77
78
include_directories(${MUPARSER_INCLUDE_DIR})
set(MANTIDLIBS ${MANTIDLIBS} ${MUPARSER_LIBRARIES})

include_directories(Geometry/inc)
add_subdirectory(Geometry)
set(MANTIDLIBS ${MANTIDLIBS} Geometry)

include_directories(API/inc)
add_subdirectory(API)
set(MANTIDLIBS ${MANTIDLIBS} API)

Owen Arnold's avatar
Owen Arnold committed
79
80
81
82
include_directories(NexusGeometry/inc)
add_subdirectory(NexusGeometry)
set(MANTIDLIBS ${MANTIDLIBS} NexusGeometry)

83
84
85
86
87
88
89
90
91
92
add_subdirectory(PythonInterface)

include_directories(DataObjects/inc)
add_subdirectory(DataObjects)
set(MANTIDLIBS ${MANTIDLIBS} DataObjects)

add_subdirectory(Nexus)
add_subdirectory(DataHandling)
add_subdirectory(CurveFitting)
add_subdirectory(LiveData)
Owen Arnold's avatar
Owen Arnold committed
93
94
95
96
97
98
99
100
101
102
103
add_subdirectory(Catalog)
if(NOT FRAMEWORK_ONLY_BUILD)
  add_subdirectory(ICat)
  add_subdirectory(ScriptRepository)
  add_subdirectory(Doxygen)
  add_subdirectory(SINQ)
  add_subdirectory(Muon)
  add_subdirectory(Reflectometry)
  add_subdirectory(RemoteAlgorithms)
  add_subdirectory(RemoteJobManagers)
  add_subdirectory(WorkflowAlgorithms)
104
105
106
  add_subdirectory(Algorithms)
  add_subdirectory(Crystal)
  add_subdirectory (MDAlgorithms)
Owen Arnold's avatar
Owen Arnold committed
107
endif()
108

109
# If an MPI-enabled build, add in the MPI-specific algorithms package
110
111
112
if(MPI_BUILD)
  add_subdirectory(MPIAlgorithms)
endif()
113

114
115
116

# Add a custom target to build all of the Framework

Owen Arnold's avatar
Owen Arnold committed
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
if(FRAMEWORK_ONLY_BUILD)
set(FRAMEWORK_LIBS
    Kernel
    HistogramData
    Indexing
    Beamline
    Geometry
    API
    DataObjects
    PythonInterface
    DataHandling
    Nexus
    NexusGeometry
    CurveFitting
    Catalog
    LiveData)
else()
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
set(FRAMEWORK_LIBS
    Kernel
    HistogramData
    Indexing
    Beamline
    Geometry
    API
    DataObjects
    PythonInterface
    DataHandling
    Nexus
    NexusGeometry
    Algorithms
    CurveFitting
    ICat
    Catalog
    Crystal
    MDAlgorithms
    WorkflowAlgorithms
    LiveData
    RemoteAlgorithms
    RemoteJobManagers
    SINQ
157
    Muon
158
    Reflectometry)
Owen Arnold's avatar
Owen Arnold committed
159
endif()
160
161

add_custom_target(Framework DEPENDS ${FRAMEWORK_LIBS})
162

163
164
# Installation settings These need to be here so that a Framework only install
# will pick them up
165
166
#
# N.B. INBUNDLE variable is empty except on Mac (set in DarwinSetup.cmake)
167

Pete Peterson's avatar
Pete Peterson committed
168
# Create instrument directory
169
170
foreach(_bundle ${BUNDLES})
  install(DIRECTORY ../instrument/
171
          DESTINATION ${_bundle}/instrument
172
173
174
175
176
177
178
179
180
          PATTERN "*UNIT_TESTING*"
          EXCLUDE
          PATTERN ".gitignore"
          EXCLUDE)
  # Ships .py files but only ship compiled pyd files for supported platforms.
  if(WIN32) # General windows environment
    if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Recommended way of detecting 64- vs 32-bit
                                    # build Excludes .so files & _win32 binaries
      install(DIRECTORY ../scripts/
181
              DESTINATION ${_bundle}/scripts
182
183
184
185
186
187
188
189
190
191
192
193
194
195
              PATTERN "*.pyc"
              EXCLUDE
              PATTERN ".svn"
              EXCLUDE
              PATTERN ".gitignore"
              EXCLUDE
              PATTERN "*.so"
              EXCLUDE
              PATTERN "*_win32.pyd"
              EXCLUDE
              PATTERN "CMakeLists.txt"
              EXCLUDE
              PATTERN "test"
              EXCLUDE)
Samuel Jackson's avatar
Samuel Jackson committed
196
    else()
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
      # Excludes so files & _win64 binaries
      install(DIRECTORY ../scripts/
              DESTINATION ${_bundle}scripts
              PATTERN "*.pyc"
              EXCLUDE
              PATTERN ".svn"
              EXCLUDE
              PATTERN ".gitignore"
              EXCLUDE
              PATTERN "*.so"
              EXCLUDE
              PATTERN "*_win64.pyd"
              EXCLUDE
              PATTERN "CMakeLists.txt"
              EXCLUDE
              PATTERN "test"
              EXCLUDE)
    endif()

    # Also ship mingw libraries for Inelastic fortran code. We need to do a
    # better job here and build things
218
    file(GLOB MINGW_DLLS "${THIRD_PARTY_DIR}/bin/mingw/*.dll")
219
    install(FILES ${MINGW_DLLS} DESTINATION ${BIN_DIR})
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
  else()
    install(DIRECTORY ../scripts/
            DESTINATION ${_bundle}scripts
            PATTERN "*.pyc"
            EXCLUDE
            PATTERN ".svn"
            EXCLUDE
            PATTERN ".gitignore"
            EXCLUDE
            PATTERN "*_win*.pyd"
            EXCLUDE
            PATTERN "*_lnx64.so"
            EXCLUDE
            PATTERN "CMakeLists.txt"
            EXCLUDE
            PATTERN "test"
            EXCLUDE)
  endif()
Samuel Jackson's avatar
Samuel Jackson committed
238
endforeach()
239

240
241
242
243
244
# THIS MUST BE THE LAST SUB_DIRECTORY ADDED. See Properties/CMakeLists.txt. This
# is included by the top-level CMakeLists if it is a full build but do it here
# for a Framework only
if(NOT FULL_PACKAGE_BUILD)
  add_subdirectory(PostInstall)
245
endif()