Skip to content

Commit

Permalink
Add installation of OM3 executables and WW3 utilities to CMakeLists. …
Browse files Browse the repository at this point in the history
…Update build script to use "cmake --install" and rename all executables.
  • Loading branch information
micaeljtoliveira committed Oct 22, 2023
1 parent d913691 commit 27f9590
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ message(STATUS " - CICE6-WW3 ${OM3_ENABLE_CICE6-WW3}")
message(STATUS " - MOM6-CICE6-WW3 ${OM3_ENABLE_MOM6-CICE6-WW3}")

# Build options
option(OM3_BIN_INSTALL "Instal ACCESS-OM3 executables" ${PROJECT_IS_TOP_LEVEL})
option(OM3_OPENMP "Enable OpenMP threading" OFF)
option(OM3_MOM_SYMMETRIC "Use symmetric memory" OFF)
set(OM3_CICE_IO "PIO" CACHE STRING "CICE OPTIONS: Choose IO options.")
set_property(CACHE OM3_CICE_IO PROPERTY STRINGS "NetCDF" "PIO" "Binary")

message(STATUS "Build options")
message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}")
message(STATUS " - OM3_OPENMP ${OM3_OPENMP}")
message(STATUS " - OM3_MOM_SYMMETRIC ${OM3_MOM_SYMMETRIC}")
message(STATUS " - OM3_CICE_IO ${OM3_CICE_IO}")
Expand Down Expand Up @@ -207,4 +209,15 @@ endforeach()
# Install or Export #
#]==============================================================================]

# TODO
## Installs
if(OM3_BIN_INSTALL)
foreach(CONF IN LISTS KnownConfigurations)
if(NOT OM3_ENABLE_${CONF})
continue()
endif()

install(TARGETS OM3_${CONF}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endforeach()
endif()
7 changes: 7 additions & 0 deletions WW3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,10 @@ set_target_properties(OM3_ww3_outp PROPERTIES
OUTPUT_NAME ww3_outp
)
target_link_libraries(OM3_ww3_outp PRIVATE OM3_ww3)


## Installs
if(OM3_BIN_INSTALL)
install(TARGETS OM3_ww3_grid OM3_ww3_strt OM3_ww3_ounf OM3_ww3_outp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
10 changes: 5 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ module load esmf/8.4.2 fms/git.2021.03.01=2021.03.01 parallelio/2.5.10
module load intel-compiler/${COMPILER_VERSION} openmpi/${OPENMPI_VERSION}

cd ${SCRIPT_DIR}
INSTALL_DIR=${SCRIPT_DIR}

hash=`git rev-parse --short=7 HEAD`
test -z "$(git status --porcelain)" || hash=${hash}-modified # uncommitted changes or untracked files

mkdir -p bin

for BUILD_TYPE in "${BUILD_TYPES[@]}"; do
echo "BUILD_TYPE = "${BUILD_TYPE}
rm -r build || true

cmake -S . -B build --preset=gadi -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build build -j 4
cmake --install build --prefix=${INSTALL_DIR}

for exec in build/access-om3*; do
dest=bin/$(basename ${exec})
for exec in ${INSTALL_DIR}/bin/*; do
dest=${INSTALL_DIR}/bin/$(basename ${exec})
if [[ ${BUILD_TYPE} != "Release" ]] ; then dest=${dest}-${BUILD_TYPE}; fi
dest=${dest}-${hash}
cp -p ${exec} ${dest}
mv ${exec} ${dest}
echo "Successfully built ${dest}"
done
done

0 comments on commit 27f9590

Please sign in to comment.