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
|
|
|
|
|
|
|
# Initialize CXXFLAGS.
|
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -std=c++11")
|
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")
|
|
|
|
|
|
|
|
# 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-07-18 18:10:15 +00:00
|
|
|
# Do nothing
|
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
|
|
|
|
include(cmake/FindGMP.cmake)
|
2013-07-20 02:12:55 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${GMP_LIBRARIES})
|
2013-07-17 05:11:48 +00:00
|
|
|
|
2013-07-19 17:04:00 +00:00
|
|
|
# tcmalloc
|
2013-07-20 21:19:36 +00:00
|
|
|
option(tcmalloc "tcmalloc" ON)
|
|
|
|
if("${tcmalloc}" MATCHES "ON")
|
|
|
|
include(cmake/FindTcmalloc.cmake)
|
|
|
|
if(${TCMALLOC_FOUND})
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${TCMALLOC_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message("-- Using standard malloc.")
|
2013-07-18 22:10:31 +00:00
|
|
|
endif()
|
|
|
|
|
2013-07-19 17:04:00 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/util)
|
|
|
|
include_directories(${LEAN_SOURCE_DIR}/numerics)
|
2013-07-19 03:21:41 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/interval)
|
2013-07-20 21:19:36 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR}/sexpr)
|
2013-07-19 17:04:00 +00:00
|
|
|
|
2013-07-17 05:10:18 +00:00
|
|
|
add_subdirectory(util)
|
2013-07-20 02:12:55 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} util)
|
2013-07-17 21:33:00 +00:00
|
|
|
add_subdirectory(numerics)
|
2013-07-20 02:12:55 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} numerics)
|
2013-07-20 21:19:36 +00:00
|
|
|
add_subdirectory(sexpr)
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} sexpr)
|
2013-07-19 03:21:41 +00:00
|
|
|
add_subdirectory(interval)
|
2013-07-20 02:12:55 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} interval)
|
2013-07-18 16:12:07 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
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-18 16:12:07 +00:00
|
|
|
add_subdirectory(tests/numerics)
|
2013-07-19 03:21:41 +00:00
|
|
|
add_subdirectory(tests/interval)
|
2013-07-20 21:19:36 +00:00
|
|
|
add_subdirectory(tests/sexpr)
|