Skip to content

Commit f3c58e0

Browse files
preshanthsanbw
authored andcommitted
Fixing to build each of the subdirs of Libra as an external project
1 parent 6dd3dfa commit f3c58e0

File tree

4 files changed

+88
-13
lines changed

4 files changed

+88
-13
lines changed

CMakeLists.txt

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,48 @@ ExternalProject_Add(
406406
-DKokkos_COMPILE_LAUNCHER=${INSTALL_DIR}/bin/kokkos/kokkos_launch_compiler
407407
-DKokkos_NVCC_WRAPPER=${INSTALL_DIR}/bin/kokkos/nvcc_wrapper
408408
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}
409-
-DINSTALL_DIR=${INSTALL_DIR}
410409
-DTOP_LEVEL_DIR=${TOP_LEVEL_DIR}
411410
CONFIGURE_COMMAND PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${INSTALL_DIR}/lib/cmake/Hpg:${INSTALL_DIR}/lib/cmake/parafeed:${INSTALL_DIR}/lib/cmake/Kokkos
412411
${CMAKE_COMMAND} <SOURCE_DIR> -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_CXX_FLAGS=-I${INSTALL_DIR}/include -Dcasacore_DIR=${INSTALL_DIR}/lib/cmake/casacore
413412
-DCMAKE_PREFIX_PATH=${INSTALL_DIR}/lib/cmake/Hpg:${INSTALL_DIR}/lib/cmake/parafeed:${INSTALL_DIR}/lib/cmake/Kokkos:${INSTALL_DIR}/lib/cmake/GTest -DApps_BUILD_TESTS=${Apps_BUILD_TESTS}
414413
-DCMAKE_BUILD_TYPE=${CASA_BUILD_TYPE} -DKokkos_COMPILE_LAUNCHER=${INSTALL_DIR}/bin/kokkos/kokkos_launch_compiler -DKokkos_NVCC_WRAPPER=${INSTALL_DIR}/bin/kokkos/nvcc_wrapper
415-
-DINSTALL_DIR=${INSTALL_DIR} -DTOP_LEVEL_DIR=${TOP_LEVEL_DIR}
414+
#-DINSTALL_DIR=${INSTALL_DIR} -DTOP_LEVEL_DIR=${TOP_LEVEL_DIR}
416415
BUILD_COMMAND make -j${NCORES}
417416
INSTALL_COMMAND make install
418417
)
419418

419+
# Add Libra/frameworks as an external project
420+
ExternalProject_Add(
421+
Frameworks
422+
SOURCE_DIR ${CMAKE_SOURCE_DIR}/frameworks
423+
DOWNLOAD_COMMAND ""
424+
BINARY_DIR ${BUILD_DIR}/Libra/frameworks
425+
DEPENDS Apps
426+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR}
427+
-DCMAKE_INSTALL_LIBDIR=lib
428+
-DTOP_LEVEL_DIR=${TOP_LEVEL_DIR}
429+
-DINSTALL_DIR=${INSTALL_DIR}
430+
CONFIGURE_COMMAND ${CMAKE_COMMAND} <SOURCE_DIR> -B <BINARY_DIR> -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=lib -DTOP_LEVEL_DIR=${TOP_LEVEL_DIR} -DINSTALL_DIR=${INSTALL_DIR}
431+
BUILD_COMMAND make -j${NCORES} -C <BINARY_DIR>
432+
INSTALL_COMMAND make install -C <BINARY_DIR>
433+
)
434+
435+
# Add Libra/scripts as an external project
436+
ExternalProject_Add(
437+
Scripts
438+
SOURCE_DIR ${CMAKE_SOURCE_DIR}/scripts
439+
DOWNLOAD_COMMAND ""
440+
BINARY_DIR ${BUILD_DIR}/Libra/scripts
441+
DEPENDS Frameworks
442+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR}
443+
-DCMAKE_INSTALL_LIBDIR=lib
444+
-DTOP_LEVEL_DIR=${TOP_LEVEL_DIR}
445+
-DINSTALL_DIR=${INSTALL_DIR}
446+
CONFIGURE_COMMAND ${CMAKE_COMMAND} <SOURCE_DIR> -B <BINARY_DIR> -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=lib -DTOP_LEVEL_DIR=${TOP_LEVEL_DIR} -DINSTALL_DIR=${INSTALL_DIR}
447+
BUILD_COMMAND make -j${NCORES} -C <BINARY_DIR>
448+
INSTALL_COMMAND make install -C <BINARY_DIR>
449+
)
450+
420451
if (LIBRA_USE_EXODUS)
421452
# setup a python vitual environment inside the install directory
422453
# after checking if python3 is installed

apps/src/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ endif()
6464

6565
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/examples)
6666

67-
# Install the htclean scripts into the bin directory
68-
69-
if(DEFINED TOP_LEVEL_DIR AND DEFINED INSTALL_DIR)
70-
install(FILES
71-
${TOP_LEVEL_DIR}/frameworks/htclean/libra_htclean.sh
72-
${TOP_LEVEL_DIR}/scripts/runapp.sh
73-
${TOP_LEVEL_DIR}/scripts/emajor.sh
74-
DESTINATION ${INSTALL_DIR}/bin)
75-
else()
76-
message(WARNING "TOP_LEVEL_DIR or INSTALL_DIR is not defined, skipping script installation")
77-
endif()
7867

7968

8069

frameworks/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
project("LibRA Frameworks"
2+
DESCRIPTION "LibRA CL, C/C++, Py Interfaces"
3+
HOMEPAGE_URL https://github.com/ARDG-NRAO/LibRA
4+
LANGUAGES CXX Fortran C)
5+
6+
cmake_minimum_required(VERSION 3.12.0)
7+
8+
# Check if the TOP_LEVEL_DIR and INSTALL_DIR are defined
9+
if(DEFINED TOP_LEVEL_DIR AND DEFINED INSTALL_DIR)
10+
message(STATUS "TOP_LEVEL_DIR: ${TOP_LEVEL_DIR}")
11+
message(STATUS "INSTALL_DIR: ${INSTALL_DIR}")
12+
else()
13+
message(WARNING "TOP_LEVEL_DIR or INSTALL_DIR is not defined, skipping script installation")
14+
endif()
15+
16+
# Define the list of files to install. This is the only place where the files are listed
17+
# and need to be edited for future additions. The rest are warnings and messages.
18+
set(FRAMEWORK_FILES
19+
${TOP_LEVEL_DIR}/frameworks/htclean/libra_htclean.sh
20+
)
21+
22+
if(DEFINED TOP_LEVEL_DIR AND DEFINED INSTALL_DIR)
23+
install(FILES ${FRAMEWORK_FILES} DESTINATION ${INSTALL_DIR}/bin)
24+
message(STATUS "Scripts installed to ${INSTALL_DIR}/bin")
25+
else()
26+
message(WARNING "TOP_LEVEL_DIR or INSTALL_DIR is not defined, skipping script installation")
27+
endif()

scripts/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
project("LibRA Scripts"
2+
DESCRIPTION "LibRA CL, C/C++, Py Interfaces"
3+
HOMEPAGE_URL https://github.com/ARDG-NRAO/LibRA
4+
LANGUAGES CXX Fortran C)
5+
6+
cmake_minimum_required(VERSION 3.12.0)
7+
8+
# Check if the TOP_LEVEL_DIR and INSTALL_DIR are defined
9+
if(DEFINED TOP_LEVEL_DIR AND DEFINED INSTALL_DIR)
10+
message(STATUS "TOP_LEVEL_DIR: ${TOP_LEVEL_DIR}")
11+
message(STATUS "INSTALL_DIR: ${INSTALL_DIR}")
12+
else()
13+
message(WARNING "TOP_LEVEL_DIR or INSTALL_DIR is not defined, skipping script installation")
14+
endif()
15+
16+
# Define the list of files to install. This is the only place where the files are listed
17+
# and need to be edited for future additions. The rest are warnings and messages.
18+
set(SCRIPT_FILES
19+
${TOP_LEVEL_DIR}/scripts/runapp.sh
20+
${TOP_LEVEL_DIR}/scripts/emajor.sh
21+
)
22+
23+
if(DEFINED TOP_LEVEL_DIR AND DEFINED INSTALL_DIR)
24+
install(FILES ${SCRIPT_FILES} DESTINATION ${INSTALL_DIR}/bin)
25+
message(STATUS "Scripts installed to ${INSTALL_DIR}/bin")
26+
else()
27+
message(WARNING "TOP_LEVEL_DIR or INSTALL_DIR is not defined, skipping script installation")
28+
endif()

0 commit comments

Comments
 (0)