feat(build): add 'CONSERVE_MEMORY' cmake option

When CONSERVE_MEMORY=ON and gcc is being used, we provide additional
command line options that will minimize the amount of memory used by gcc
when compiling Lean.
This is an attempt to fix the "out-of-memory" failures when building
Lean at Travis.
This commit is contained in:
Leonardo de Moura 2014-09-29 12:44:29 -07:00
parent 6630ed8165
commit 1a1e9a2340
2 changed files with 20 additions and 2 deletions

View file

@ -23,6 +23,7 @@ env:
PUSH_TO_CDASH=TRUE
TCMALLOC=OFF
LUA=52
CONSERVE_MEMORY=ON
# =======================================================
# DEBUG Build
# =======================================================
@ -41,6 +42,7 @@ env:
TCMALLOC=ON
PUSH_TO_CDASH=TRUE
LUA=52
CONSERVE_MEMORY=ON
# D3. clang++-3.3 | DEBUG
- CMAKE_CXX_COMPILER=clang++-3.3
CMAKE_BUILD_TYPE=DEBUG
@ -53,6 +55,7 @@ env:
TCMALLOC=OFF
PUSH_TO_CDASH=TRUE
LUA=52
CONSERVE_MEMORY=ON
# =======================================================
# RELEASE Build
# =======================================================
@ -70,6 +73,7 @@ env:
PUSH_TO_CDASH=TRUE
LUA=52
PACKAGE=TRUE
CONSERVE_MEMORY=ON
# R3. clang++-3.3 | RELEASE
- CMAKE_CXX_COMPILER=clang++-3.3
CMAKE_BUILD_TYPE=RELEASE
@ -83,6 +87,7 @@ env:
UPLOAD=linux
PUSH_TO_CDASH=TRUE
LUA=52
CONSERVE_MEMORY=ON
# =======================================================
# MEMCHECK Build
# =======================================================
@ -110,6 +115,7 @@ env:
MEMCHECK_RANGE=1,40
PUSH_TO_CDASH=TRUE
LUA=52
CONSERVE_MEMORY=ON
# M2-2. g++-4.8 | DEBUG | MEMCHECK | CDASH
- CMAKE_CXX_COMPILER=g++-4.8
CMAKE_BUILD_TYPE=DEBUG
@ -118,6 +124,7 @@ env:
MEMCHECK_RANGE=40,80
PUSH_TO_CDASH=TRUE
LUA=52
CONSERVE_MEMORY=ON
# =======================================================
# DOXYGEN Build
# =======================================================
@ -127,6 +134,7 @@ env:
BUILD_DOXYGEN=TRUE
TCMALLOC=OFF
LUA=52
CONSERVE_MEMORY=ON
# =======================================================
# Different Lua Versions
# =======================================================
@ -137,6 +145,7 @@ env:
UPLOAD=linux
PUSH_TO_CDASH=TRUE
LUA=51
CONSERVE_MEMORY=ON
# LJIT. g++-4.8 | RELEASE | | CDASH
- CMAKE_CXX_COMPILER=g++-4.8
CMAKE_BUILD_TYPE=RELEASE
@ -144,6 +153,7 @@ env:
UPLOAD=linux
PUSH_TO_CDASH=TRUE
LUA=JIT
CONSERVE_MEMORY=ON
install:
- until sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test; do echo retry; done
@ -230,7 +240,7 @@ script:
- if [[ $TESTCOV != ON ]]; then
TESTCOV=OFF;
fi
- /usr/bin/cmake -DIGNORE_SORRY=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTESTCOV=${TESTCOV} -DTCMALLOC=${TCMALLOC} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${GENERATOR} -DCMAKE_PROGRAM_PATH=/usr/bin ../src;
- /usr/bin/cmake -DIGNORE_SORRY=ON -DCONSERVE_MEMORY=${CONSERVE_MEMORY} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTESTCOV=${TESTCOV} -DTCMALLOC=${TCMALLOC} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${GENERATOR} -DCMAKE_PROGRAM_PATH=/usr/bin ../src;
- if [[ $CMAKE_BUILD_TYPE == DEBUG || $CMAKE_BUILD_TYPE == RELEASE || $TESTCOV == ON ]]; then
SITE=Ubuntu12.04@Travis;
if [[ $CMAKE_BUILD_TYPE == RELEASE ]]; then

View file

@ -27,6 +27,9 @@ option(IGNORE_SORRY "IGNORE_SORRY" OFF)
# When cross-compiling, we do not compile the standard library since
# the executable will not work on the host machine
option(CROSS_COMPILE "CROSS_COMPILE" OFF)
# When ON we try to minimize the amount of memory needed to compile Lean using gcc.
# We use this flag when compiling at Travis.
option(CONSERVE_MEMORY "CONSERVE_MEMORY" OFF)
# Added for CTest
include(CTest)
@ -60,9 +63,14 @@ if("${CACHE_EXPRS}" MATCHES "ON")
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_CACHE_EXPRS")
endif()
if(("${CONSERVE_MEMORY}" MATCHES "ON") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
message(STATUS "Using compilation flags for minimizing the amount of memory used by gcc")
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} --param ggc-min-heapsize=32768 --param ggc-min-expand=20")
endif()
if("${STATIC}" MATCHES "ON")
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -static")
message(STATUS "Creating a static executable")
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -static")
endif()
# Set Module Path