Skip to content

Commit 1a90840

Browse files
committed
Fixed the CMake environment to set a minimum compiler version, check
for it, and terminate building if it is not met.
1 parent 5fd581c commit 1a90840

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ if(WITH_TBINF)
9292
endif()
9393
include(Doxygen)
9494

95+
################################################################
96+
# Check Compiler versions
97+
################################################################
98+
99+
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CXX_VERSION)
100+
101+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
102+
if(NOT (CXX_VERSION VERSION_GREATER 4.9 OR CXX_VERSION VERSION_EQUAL 4.9))
103+
message(FATAL_ERROR "LBANN & Elemental requires G++ Version >= 4.9")
104+
endif()
105+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
106+
if(NOT (CXX_VERSION VERSION_GREATER 16.0 OR CXX_VERSION VERSION_EQUAL 16.0))
107+
message(FATAL_ERROR "LBANN & Elemental requires icpc Version >= 16.0")
108+
endif()
109+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
110+
message(FATAL_ERROR "Unsupported compiler: Clang")
111+
else()
112+
message(FATAL_ERROR "Unsupported compiler: Unknown compiler vendor")
113+
endif()
114+
95115
################################################################
96116
# Build LBANN
97117
################################################################

scripts/build_lbann_lc.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,22 @@ EOF
200200
echo "${CONFIGURE_COMMAND}"
201201
fi
202202
${CONFIGURE_COMMAND}
203+
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
203204

204205
# Build LBANN with make
205206
BUILD_COMMAND="make -j${MAKE_NUM_PROCESSES} VERBOSE=${VERBOSE}"
206207
if [ ${VERBOSE} -ne 0 ]; then
207208
echo "${BUILD_COMMAND}"
208209
fi
209210
${BUILD_COMMAND}
211+
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
210212

211213
# Build LBANN with make
212214
INSTALL_COMMAND="make install -j${MAKE_NUM_PROCESSES} VERBOSE=${VERBOSE}"
213215
if [ ${VERBOSE} -ne 0 ]; then
214216
echo "${INSTALL_COMMAND}"
215217
fi
216218
${INSTALL_COMMAND}
219+
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
217220

218221
popd

scripts/build_lbann_osx.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ pushd ${BUILD_DIR}
6868
-D VERBOSE=${VERBOSE} \
6969
-D MAKE_NUM_PROCESSES=${MAKE_NUM_PROCESSES} \
7070
${ROOT_DIR}
71+
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
7172

7273
# Build LBANN with make
7374
make -j${MAKE_NUM_PROCESSES} VERBOSE=${VERBOSE}
75+
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
7476

7577
# Install LBANN with make
7678
make install -j${MAKE_NUM_PROCESSES} VERBOSE=${VERBOSE}
79+
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
7780

7881
popd

0 commit comments

Comments
 (0)