-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt.spack
More file actions
183 lines (152 loc) · 5.61 KB
/
CMakeLists.txt.spack
File metadata and controls
183 lines (152 loc) · 5.61 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
180
181
182
183
#-*- cmake -*-
# Copyright (C) 2025
# Associated Universities, Inc. Washington DC, USA.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.is
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
#
# Correspondence concerning this should be addressed as follows:
# Postal address: National Radio Astronomy Observatory
# 1003 Lopezville Road,
# Socorro, NM - 87801, USA
#
cmake_minimum_required(VERSION 3.18)
# Set policy for CMAKE_VERSION >= 3.24.0
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 OLD)
endif()
project("LibRA Apps"
DESCRIPTION "LibRA CL, C/C++, Py Interfaces"
HOMEPAGE_URL https://github.com/ARDG-NRAO/LibRA
LANGUAGES CXX Fortran C)
set(LIBRA_ID "LibRA INFO: ")
set(CMAKE_CXX_STANDARD 17)
set(BUILD_TYPE "RelWithDebInfo")
set(CASA_BUILD_TYPE "RelWithDebInfo")
# Include required modules
include(FindPkgConfig)
# Add local cmake modules to path - this will be set properly in src/CMakeLists.txt
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake")
# Set CMAKE environment variables
set(CMAKE_INSTALL_LIBDIR lib)
set(CMAKE_INSTALL_INCLUDEDIR include)
set(CMAKE_INSTALL_BINDIR bin)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
# Find system information
if (NOT DEFINED NCORES)
cmake_host_system_information(RESULT NCORES QUERY NUMBER_OF_PHYSICAL_CORES)
cmake_host_system_information(RESULT NTHREADS QUERY NUMBER_OF_LOGICAL_CORES)
message("${LIBRA_ID} Number of physical cores: ${NCORES}")
message("${LIBRA_ID} Number of logical cores: ${NTHREADS}")
math(EXPR NCORES "${NCORES} - 2")
endif()
if (NCORES LESS 1)
set(NCORES 1)
endif()
message("${LIBRA_ID} Setting number of cores to ${NCORES}")
# LibRA variant options
if(NOT DEFINED LIBRA_USE_LIBSAKURA)
set(LIBRA_USE_LIBSAKURA OFF)
endif()
if(NOT DEFINED LIBRA_USE_EXODUS)
set(LIBRA_USE_EXODUS OFF)
endif()
if(NOT DEFINED Apps_BUILD_TESTS)
set(Apps_BUILD_TESTS OFF)
endif()
message("${LIBRA_ID} LIBRA_USE_LIBSAKURA: ${LIBRA_USE_LIBSAKURA}")
message("${LIBRA_ID} LIBRA_USE_EXODUS: ${LIBRA_USE_EXODUS}")
message("${LIBRA_ID} Apps_BUILD_TESTS: ${Apps_BUILD_TESTS}")
# Find Spack-managed dependencies
find_package(PkgConfig REQUIRED)
# Find Kokkos
find_package(Kokkos REQUIRED)
message("${LIBRA_ID} Found Kokkos: ${Kokkos_DIR}")
# Find HPG
find_package(Hpg REQUIRED)
message("${LIBRA_ID} Found HPG: ${Hpg_DIR}")
# Find parafeed
find_package(parafeed REQUIRED)
message("${LIBRA_ID} Found parafeed: ${parafeed_DIR}")
# Find casacore using pkg-config (casacore only provides .pc files)
pkg_check_modules(CASACORE REQUIRED casacore)
message("${LIBRA_ID} Found casacore: ${CASACORE_LIBDIR}")
# Find pybind11
find_package(pybind11 REQUIRED)
message("${LIBRA_ID} Found pybind11: ${pybind11_DIR}")
# Find FFTW
pkg_check_modules(FFTW REQUIRED fftw3)
message("${LIBRA_ID} Found FFTW: ${FFTW_LIBDIR}")
# Find system libraries
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
# Find optional dependencies
if(LIBRA_USE_LIBSAKURA)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SAKURA REQUIRED libsakura)
message("${LIBRA_ID} Found libsakura: ${SAKURA_LIBDIR}")
endif()
if(Apps_BUILD_TESTS)
find_package(GTest REQUIRED)
message("${LIBRA_ID} Found GTest: ${GTest_DIR}")
endif()
# Set up include directories
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/apps/src
)
# Add subdirectories for building LibRA components
# Don't use add_subdirectory(src) - instead include src components directly
add_subdirectory(apps)
add_subdirectory(frameworks)
add_subdirectory(scripts)
# Handle src components manually to avoid path issues
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake")
include(DeclareCasacppComponent)
# List of src components to build
set(LIBRA_COMPONENTS
asdmstman
atmosphere
casatools
components
imageanalysis
libracore
librautils
mstransform
msvis
nrao
stdcasa
synthesis
)
# Add each component from src directory
foreach(_component ${LIBRA_COMPONENTS})
set(component_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/${_component}")
if(EXISTS ${component_dir})
message("${LIBRA_ID} Adding component: ${_component}")
add_subdirectory("src/${_component}")
else()
message("${LIBRA_ID} Skipping missing component: ${_component}")
endif()
endforeach()
# Create installation directories
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY DESTINATION share)
# Set up data directory for casacore if needed
set(DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/casacore/data)
install(DIRECTORY DESTINATION ${DATA_DIR})
message("${LIBRA_ID} Installing libraries to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
message("${LIBRA_ID} Installing headers to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
message("${LIBRA_ID} Installing binaries to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")