2013-07-18 16:12:07 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
|
|
|
project(LEAN CXX)
|
|
|
|
set(LEAN_VERSION_MAJOR 0)
|
|
|
|
set(LEAN_VERSION_MINOR 1)
|
2013-07-17 05:11:48 +00:00
|
|
|
|
2013-07-18 16:12:07 +00:00
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
enable_testing()
|
2013-07-17 05:11:48 +00:00
|
|
|
|
2013-09-04 04:55:40 +00:00
|
|
|
# Added for CTest
|
|
|
|
INCLUDE(CTest)
|
|
|
|
CONFIGURE_FILE(${LEAN_SOURCE_DIR}/CTestCustom.cmake.in
|
|
|
|
${LEAN_BINARY_DIR}/CTestCustom.cmake @ONLY)
|
|
|
|
|
2013-08-10 21:15:13 +00:00
|
|
|
set(LEAN_EXTRA_LINKER_FLAGS "")
|
2013-09-03 17:26:12 +00:00
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "")
|
2013-08-10 21:15:13 +00:00
|
|
|
|
2013-08-23 00:46:18 +00:00
|
|
|
# Windows does not support ulimit -s unlimited. So, we reserve a lot of stack space: 100Mb
|
|
|
|
if((${CYGWIN} EQUAL "1") OR (${CMAKE_SYSTEM_NAME} MATCHES "Windows"))
|
|
|
|
message(STATUS "Windows detected")
|
2013-08-10 21:15:13 +00:00
|
|
|
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -Wl,--stack,104857600")
|
2013-09-03 17:26:12 +00:00
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_DEFAULT_PP_UNICODE=false")
|
2013-08-10 21:15:13 +00:00
|
|
|
endif()
|
|
|
|
|
2013-08-06 00:58:54 +00:00
|
|
|
# Set Module Path
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
|
|
|
|
2013-07-17 05:11:48 +00:00
|
|
|
# Initialize CXXFLAGS.
|
2013-09-03 17:26:12 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 ${LEAN_EXTRA_CXX_FLAGS}")
|
2013-07-18 18:10:15 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -DLEAN_DEBUG -DLEAN_TRACE")
|
2013-07-17 05:11:48 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
2013-09-03 17:26:12 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_TESTCOV "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
|
2013-07-17 05:11:48 +00:00
|
|
|
|
|
|
|
# Compiler-specific C++11 activation.
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
|
|
|
if (NOT (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8))
|
|
|
|
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.8 or greater.")
|
|
|
|
endif ()
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
2013-08-13 07:29:18 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2013-08-12 17:32:07 +00:00
|
|
|
# In OSX, clang requires "-stdlib=libc++" to support C++11
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
|
|
|
set(LEAN_EXTRA_LINKER_FLAGS "-stdlib=libc++")
|
2013-08-13 07:29:18 +00:00
|
|
|
endif ()
|
2013-07-17 05:11:48 +00:00
|
|
|
else ()
|
|
|
|
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
|
|
|
|
endif ()
|
|
|
|
|
2013-07-19 17:04:00 +00:00
|
|
|
# GMP
|
2013-08-06 02:33:33 +00:00
|
|
|
find_package(GMP 5.0.5)
|
2013-07-20 02:12:55 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${GMP_LIBRARIES})
|
2013-07-17 05:11:48 +00:00
|
|
|
|
2013-08-06 00:58:54 +00:00
|
|
|
# MPFR
|
2013-08-06 02:16:52 +00:00
|
|
|
find_package(MPFR 3.1.0)
|
2013-08-06 00:58:54 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${MPFR_LIBRARIES})
|
|
|
|
|
2013-07-19 17:04:00 +00:00
|
|
|
# tcmalloc
|
2013-08-22 02:08:34 +00:00
|
|
|
option(TCMALLOC "TCMALLOC" ON)
|
|
|
|
if("${TCMALLOC}" MATCHES "ON")
|
2013-07-20 21:19:36 +00:00
|
|
|
if(${TCMALLOC_FOUND})
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${TCMALLOC_LIBRARIES})
|
|
|
|
endif()
|
2013-08-22 02:08:34 +00:00
|
|
|
message(STATUS "Using tcmalloc.")
|
2013-07-20 21:19:36 +00:00
|
|
|
else()
|
2013-08-12 22:37:36 +00:00
|
|
|
message(STATUS "Using standard malloc.")
|
2013-07-18 22:10:31 +00:00
|
|
|
endif()
|
|
|
|
|
2013-08-22 02:08:34 +00:00
|
|
|
# Readline
|
|
|
|
option(READLINE "READLINE" OFF)
|
|
|
|
if("${READLINE}" MATCHES "ON")
|
|
|
|
find_package(Readline)
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${READLINE_LIBRARY})
|
|
|
|
message(STATUS "Using GNU readline")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLEAN_USE_READLINE")
|
|
|
|
endif()
|
|
|
|
|
2013-07-19 17:04:00 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/util)
|
2013-07-24 21:53:45 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/util/numerics)
|
2013-08-13 10:40:51 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/util/sexpr)
|
2013-07-19 03:21:41 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/interval)
|
2013-07-22 11:03:46 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/kernel)
|
2013-08-22 17:26:52 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/library)
|
2013-09-07 06:17:24 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/library/arith)
|
|
|
|
include_directories(${LEAN_SOURCE_DIR}/library/import_all)
|
2013-08-03 17:58:05 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/parsers)
|
2013-08-21 16:04:49 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/frontends/lean)
|
2013-07-19 17:04:00 +00:00
|
|
|
|
2013-07-17 05:10:18 +00:00
|
|
|
add_subdirectory(util)
|
2013-08-10 21:15:13 +00:00
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} util)
|
2013-07-24 21:53:45 +00:00
|
|
|
add_subdirectory(util/numerics)
|
2013-08-10 21:15:13 +00:00
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} numerics)
|
2013-08-13 10:40:51 +00:00
|
|
|
add_subdirectory(util/sexpr)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} sexpr)
|
2013-07-19 03:21:41 +00:00
|
|
|
add_subdirectory(interval)
|
2013-08-10 21:15:13 +00:00
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} interval)
|
2013-07-22 11:03:46 +00:00
|
|
|
add_subdirectory(kernel)
|
2013-08-10 21:15:13 +00:00
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} kernel)
|
2013-08-22 17:26:52 +00:00
|
|
|
add_subdirectory(library)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} library)
|
2013-09-07 06:17:24 +00:00
|
|
|
add_subdirectory(library/arith)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} arithlib)
|
|
|
|
add_subdirectory(library/import_all)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} import_all)
|
2013-08-21 16:04:49 +00:00
|
|
|
add_subdirectory(frontends/lean)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} lean_frontend)
|
2013-08-10 21:15:13 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread ${LEAN_EXTRA_LINKER_FLAGS}")
|
2013-08-18 03:37:10 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_TESTCOV "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
2013-08-10 21:15:13 +00:00
|
|
|
set(EXTRA_LIBS ${LEAN_LIBS} ${EXTRA_LIBS})
|
2013-07-17 05:10:18 +00:00
|
|
|
add_subdirectory(shell)
|
2013-07-20 02:12:55 +00:00
|
|
|
add_subdirectory(tests/util)
|
2013-07-24 21:53:45 +00:00
|
|
|
add_subdirectory(tests/util/numerics)
|
2013-07-19 03:21:41 +00:00
|
|
|
add_subdirectory(tests/interval)
|
2013-07-22 11:03:46 +00:00
|
|
|
add_subdirectory(tests/kernel)
|
2013-08-23 16:35:35 +00:00
|
|
|
add_subdirectory(tests/library)
|
2013-08-21 16:04:49 +00:00
|
|
|
add_subdirectory(tests/frontends/lean)
|