2013-07-18 16:12:07 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
|
|
|
project(LEAN CXX)
|
|
|
|
set(LEAN_VERSION_MAJOR 0)
|
2014-02-12 18:54:03 +00:00
|
|
|
set(LEAN_VERSION_MINOR 2)
|
2013-07-17 05:11:48 +00:00
|
|
|
|
2014-09-17 22:20:35 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
|
|
message(STATUS "No build type selected, default to Release")
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
endif()
|
|
|
|
|
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-20 19:31:06 +00:00
|
|
|
option(TRACK_MEMORY_USAGE "TRACK_MEMORY_USAGE" ON)
|
2013-12-10 00:55:13 +00:00
|
|
|
option(MULTI_THREAD "MULTI_THREAD" ON)
|
|
|
|
option(BOOST "BOOST" OFF)
|
2013-12-10 02:02:04 +00:00
|
|
|
option(STATIC "STATIC" OFF)
|
2013-12-10 06:30:54 +00:00
|
|
|
option(SPLIT_STACK "SPLIT_STACK" OFF)
|
2013-12-22 02:57:15 +00:00
|
|
|
option(READLINE "READLINE" OFF)
|
2014-06-03 20:32:02 +00:00
|
|
|
option(CACHE_EXPRS "CACHE_EXPRS" ON)
|
2014-07-22 20:44:47 +00:00
|
|
|
option(TCMALLOC "TCMALLOC" ON)
|
|
|
|
option(JEMALLOC "JEMALLOC" OFF)
|
2014-09-26 15:55:54 +00:00
|
|
|
# IGNORE_SORRY is a tempory option (hack). It allows us to build
|
|
|
|
# a version of Lean that does not report when 'sorry' is used.
|
|
|
|
# This is useful for suppressing warning messages in the nightly builds.
|
|
|
|
option(IGNORE_SORRY "IGNORE_SORRY" OFF)
|
2014-09-26 16:26:40 +00:00
|
|
|
# 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)
|
2014-09-29 19:44:29 +00:00
|
|
|
# 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)
|
2013-12-10 02:02:04 +00:00
|
|
|
|
2013-09-04 04:55:40 +00:00
|
|
|
# Added for CTest
|
2013-12-23 05:00:32 +00:00
|
|
|
include(CTest)
|
|
|
|
configure_file(${LEAN_SOURCE_DIR}/CTestCustom.cmake.in
|
2013-09-04 04:55:40 +00:00
|
|
|
${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-12-01 20:42:32 +00:00
|
|
|
set(LEAN_WIN_STACK_SIZE "104857600")
|
|
|
|
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -Wl,--stack,${LEAN_WIN_STACK_SIZE}")
|
2013-09-03 17:26:12 +00:00
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_DEFAULT_PP_UNICODE=false")
|
2013-12-01 20:42:32 +00:00
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_WINDOWS -D LEAN_WIN_STACK_SIZE=${LEAN_WIN_STACK_SIZE}")
|
2013-11-18 17:52:47 +00:00
|
|
|
endif()
|
|
|
|
|
2013-12-30 22:50:40 +00:00
|
|
|
if("${CYGWIN}" EQUAL "1")
|
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_CYGWIN")
|
|
|
|
endif()
|
|
|
|
|
2013-12-09 22:56:48 +00:00
|
|
|
if("${MULTI_THREAD}" MATCHES "OFF")
|
|
|
|
message(STATUS "Disabled multi-thread support, it will not be safe to run multiple threads in parallel")
|
|
|
|
else()
|
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_MULTI_THREAD")
|
2013-10-25 18:50:35 +00:00
|
|
|
endif()
|
|
|
|
|
2014-06-03 20:32:02 +00:00
|
|
|
if("${CACHE_EXPRS}" MATCHES "ON")
|
|
|
|
message(STATUS "Lean expression caching enabled (aka partial hashconsing)")
|
|
|
|
set(LEAN_EXTRA_CXX_FLAGS "${LEAN_EXTRA_CXX_FLAGS} -D LEAN_CACHE_EXPRS")
|
|
|
|
endif()
|
|
|
|
|
2014-09-29 19:44:29 +00:00
|
|
|
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()
|
|
|
|
|
2013-12-10 02:02:04 +00:00
|
|
|
if("${STATIC}" MATCHES "ON")
|
|
|
|
message(STATUS "Creating a static executable")
|
2014-09-29 19:44:29 +00:00
|
|
|
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -static")
|
2013-12-10 02:02:04 +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.
|
2014-09-19 05:40:05 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11 ${LEAN_EXTRA_CXX_FLAGS} -DLEAN_BUILD_TYPE=\"${CMAKE_BUILD_TYPE}\"")
|
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")
|
2014-05-27 17:21:03 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_GPROF "-O2 -g -pg")
|
2013-09-27 03:22:40 +00:00
|
|
|
|
2014-08-04 21:42:44 +00:00
|
|
|
include(CheckIncludeFileCXX)
|
|
|
|
check_include_file_cxx("unistd.h" HAVE_UNISTD)
|
|
|
|
|
2014-09-26 15:55:54 +00:00
|
|
|
if ("${IGNORE_SORRY}" MATCHES "ON")
|
|
|
|
message(STATUS "IGNORE_SORRY is ON, Lean will not report when 'sorry' is used directly or indirectly")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D LEAN_IGNORE_SORRY")
|
|
|
|
endif()
|
|
|
|
|
2013-12-10 06:30:54 +00:00
|
|
|
# SPLIT_STACK
|
|
|
|
if ("${SPLIT_STACK}" MATCHES "ON")
|
|
|
|
if ((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsplit-stack -D LEAN_USE_SPLIT_STACK")
|
|
|
|
message(STATUS "Using split-stacks")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Split-stacks are only supported on Linux with g++")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-09-27 03:22:40 +00:00
|
|
|
# Test coverage
|
|
|
|
if("${TESTCOV}" MATCHES "ON")
|
2013-09-27 05:24:24 +00:00
|
|
|
include(CodeCoverage)
|
2013-09-27 03:22:40 +00:00
|
|
|
message(STATUS "Enable test-coverage")
|
2013-09-27 17:23:52 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -fprofile-arcs -ftest-coverage --coverage")
|
2013-09-27 05:24:24 +00:00
|
|
|
setup_target_for_coverage(cov ${LEAN_SOURCE_DIR}/../script/run_tests.sh coverage)
|
2013-09-27 03:22:40 +00:00
|
|
|
endif()
|
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")
|
2014-08-26 19:46:24 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__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-12-10 00:55:13 +00:00
|
|
|
# BOOST
|
|
|
|
if (("${BOOST}" MATCHES "ON") AND ("${MULTI_THREAD}" MATCHES "ON"))
|
|
|
|
find_package(Boost 1.54 COMPONENTS system thread atomic chrono REQUIRED)
|
|
|
|
message(STATUS "Boost library will be used to implement multi-threading support")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D LEAN_USE_BOOST")
|
2014-06-07 18:31:33 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES})
|
2014-06-07 18:59:31 +00:00
|
|
|
if (("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))
|
|
|
|
# Hide warnings when using Boost and g++ on OSX
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Wno-deprecated-declarations")
|
|
|
|
endif()
|
2013-12-10 00:55:13 +00:00
|
|
|
endif()
|
|
|
|
|
2013-08-06 00:58:54 +00:00
|
|
|
# MPFR
|
2014-07-18 12:29:51 +00:00
|
|
|
find_package(MPFR 3.1.0 REQUIRED)
|
2013-10-26 03:35:06 +00:00
|
|
|
include_directories(${MPFR_INCLUDES})
|
2013-08-06 00:58:54 +00:00
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${MPFR_LIBRARIES})
|
|
|
|
|
2013-11-06 00:30:36 +00:00
|
|
|
# GMP
|
2014-07-18 12:29:51 +00:00
|
|
|
find_package(GMP 5.0.5 REQUIRED)
|
2013-11-06 00:30:36 +00:00
|
|
|
include_directories(${GMP_INCLUDE_DIR})
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${GMP_LIBRARIES})
|
|
|
|
|
2013-09-20 19:31:06 +00:00
|
|
|
# TRACK_MEMORY_USAGE
|
|
|
|
if("${TRACK_MEMORY_USAGE}" MATCHES "ON")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D LEAN_TRACK_MEMORY")
|
|
|
|
endif()
|
|
|
|
|
2014-07-22 20:44:47 +00:00
|
|
|
# jemalloc
|
|
|
|
if("${JEMALLOC}" MATCHES "ON")
|
|
|
|
find_package(Jemalloc)
|
|
|
|
if(${JEMALLOC_FOUND})
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${JEMALLOC_LIBRARIES})
|
|
|
|
message(STATUS "Using jemalloc.")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D HAS_JEMALLOC")
|
|
|
|
else()
|
2014-09-17 22:22:03 +00:00
|
|
|
message(STATUS "Failed to find jemalloc, will try tcmalloc and then standard malloc.")
|
2014-07-22 20:44:47 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-07-19 17:04:00 +00:00
|
|
|
# tcmalloc
|
2014-07-22 20:44:47 +00:00
|
|
|
if(NOT "${JEMALLOC_FOUND}")
|
|
|
|
if("${TCMALLOC}" MATCHES "ON")
|
|
|
|
find_package(Tcmalloc)
|
|
|
|
if(${TCMALLOC_FOUND})
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${TCMALLOC_LIBRARIES})
|
|
|
|
message(STATUS "Using tcmalloc.")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D HAS_TCMALLOC")
|
|
|
|
else()
|
2014-09-17 22:22:03 +00:00
|
|
|
message(STATUS "Failed to find tcmalloc, using standard malloc.")
|
2014-07-22 20:44:47 +00:00
|
|
|
endif()
|
2013-09-20 06:36:57 +00:00
|
|
|
else()
|
2014-07-22 20:44:47 +00:00
|
|
|
message(STATUS "Using standard malloc.")
|
2013-07-20 21:19:36 +00:00
|
|
|
endif()
|
2013-07-18 22:10:31 +00:00
|
|
|
endif()
|
|
|
|
|
2013-08-22 02:08:34 +00:00
|
|
|
# Readline
|
|
|
|
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-09-20 19:31:06 +00:00
|
|
|
# Check malloc_usable_size
|
2014-07-22 20:44:47 +00:00
|
|
|
if(NOT "${TCMALLOC_FOUND}" AND NOT "${JEMALLOC_FOUND}" AND "${TRACK_MEMORY_USAGE}" MATCHES "ON")
|
2013-09-20 19:31:06 +00:00
|
|
|
find_package(MallocUsableSize)
|
2013-09-20 21:12:11 +00:00
|
|
|
if("${MUS_FOUND}" MATCHES "TRUE")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I ${MALLOC_DIR} -D HAS_MALLOC_USABLE_SIZE")
|
|
|
|
else()
|
2013-09-21 00:45:50 +00:00
|
|
|
find_package(MallocSize)
|
|
|
|
if("${MALLOCSIZE_FOUND}" MATCHES "TRUE")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I ${MALLOC_DIR} -D HAS_MALLOCSIZE")
|
|
|
|
else()
|
|
|
|
find_package(MSize)
|
|
|
|
if("${MSIZE_FOUND}" MATCHES "TRUE")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I ${MALLOC_DIR} -D HAS_MSIZE")
|
|
|
|
endif()
|
2013-09-20 21:12:11 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2013-09-20 19:31:06 +00:00
|
|
|
endif()
|
|
|
|
|
2013-12-26 00:18:51 +00:00
|
|
|
# Lua
|
2013-11-08 18:56:29 +00:00
|
|
|
find_package(Lua REQUIRED)
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} ${LUA_LIBRARIES})
|
2013-11-14 02:44:01 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
# Lua static library for linux depends on dl.so
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} -ldl)
|
|
|
|
endif()
|
2013-11-08 18:56:29 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I ${LUA_INCLUDE_DIR}")
|
|
|
|
if ("${HAS_LUA_NEWSTATE}$" MATCHES "TRUE")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D LEAN_USE_LUA_NEWSTATE")
|
|
|
|
endif()
|
2013-11-02 18:16:30 +00:00
|
|
|
|
2013-12-14 00:52:40 +00:00
|
|
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND ${LUA_FOUND} AND
|
|
|
|
"${LUA_INCLUDE_DIR}" MATCHES "jit")
|
|
|
|
# http://luajit.org/install.html
|
|
|
|
# If you're building a 64 bit application on OSX which links
|
|
|
|
# directly or indirectly against LuaJIT, you need to link your main
|
|
|
|
# executable with these flags:
|
|
|
|
set(LEAN_EXTRA_LINKER_FLAGS "${LEAN_EXTRA_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
|
|
|
|
ENDIF()
|
|
|
|
|
2014-10-03 00:04:30 +00:00
|
|
|
# Python
|
|
|
|
find_package(PythonInterp REQUIRED)
|
|
|
|
|
2013-12-26 00:18:51 +00:00
|
|
|
# CPack
|
|
|
|
set(CPACK_PACKAGE_NAME lean)
|
|
|
|
string(TOLOWER ${CMAKE_SYSTEM_NAME} LOWER_SYSTEM_NAME)
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "lean-${LEAN_VERSION_MAJOR}.${LEAN_VERSION_MINOR}-${LOWER_SYSTEM_NAME}")
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
SET(CPACK_GENERATOR TGZ)
|
|
|
|
else()
|
|
|
|
SET(CPACK_GENERATOR ZIP)
|
|
|
|
endif()
|
|
|
|
include(CPack)
|
|
|
|
|
|
|
|
# Examples
|
|
|
|
file(GLOB LEANLIB "${LEAN_SOURCE_DIR}/../examples/lean/*.lean")
|
|
|
|
FOREACH(FILE ${LEANLIB})
|
|
|
|
install_files(/examples/lean FILES ${FILE})
|
|
|
|
ENDFOREACH(FILE)
|
2013-07-19 17:04:00 +00:00
|
|
|
|
2013-12-26 00:18:51 +00:00
|
|
|
include_directories(${LEAN_SOURCE_DIR})
|
2013-12-29 22:41:28 +00:00
|
|
|
|
|
|
|
# Git HASH
|
|
|
|
include(GetGitRevisionDescription)
|
|
|
|
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
|
|
|
configure_file("${LEAN_SOURCE_DIR}/githash.h.in" "${LEAN_BINARY_DIR}/githash.h")
|
|
|
|
|
|
|
|
# Version
|
2013-12-29 01:31:35 +00:00
|
|
|
configure_file("${LEAN_SOURCE_DIR}/version.h.in" "${LEAN_BINARY_DIR}/version.h")
|
2013-12-04 19:21:26 +00:00
|
|
|
|
2013-12-29 22:41:28 +00:00
|
|
|
include_directories("${LEAN_BINARY_DIR}")
|
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-09-17 21:10:53 +00:00
|
|
|
add_subdirectory(util/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)
|
2014-05-16 16:53:51 +00:00
|
|
|
add_subdirectory(kernel/inductive)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} inductive)
|
2014-02-23 06:53:34 +00:00
|
|
|
add_subdirectory(library)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} library)
|
2014-06-27 13:59:17 +00:00
|
|
|
add_subdirectory(library/tactic)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} tactic)
|
2014-04-29 18:52:09 +00:00
|
|
|
add_subdirectory(library/error_handling)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} error_handling)
|
2014-05-15 22:51:41 +00:00
|
|
|
add_subdirectory(frontends/lean)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} lean_frontend)
|
2014-04-29 00:57:39 +00:00
|
|
|
add_subdirectory(frontends/lua)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} leanlua)
|
2014-09-22 17:27:48 +00:00
|
|
|
add_subdirectory(init)
|
|
|
|
set(LEAN_LIBS ${LEAN_LIBS} init)
|
2014-06-07 20:21:00 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LEAN_EXTRA_LINKER_FLAGS}")
|
|
|
|
if(("${MULTI_THREAD}" MATCHES "ON") AND (NOT (("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") AND ("${BOOST}" MATCHES "ON"))))
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
2013-12-09 22:56:48 +00:00
|
|
|
endif()
|
2013-08-18 03:37:10 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_TESTCOV "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
|
2014-07-30 01:25:57 +00:00
|
|
|
set(ALL_LIBS ${LEAN_LIBS} ${EXTRA_LIBS})
|
2014-04-29 00:49:23 +00:00
|
|
|
add_subdirectory(shell)
|
2014-05-15 22:51:41 +00:00
|
|
|
add_subdirectory(emacs)
|
2013-12-23 05:00:32 +00:00
|
|
|
|
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-10-22 01:17:34 +00:00
|
|
|
add_subdirectory(tests/util/interval)
|
2014-02-14 02:02:14 +00:00
|
|
|
add_subdirectory(tests/kernel)
|
2014-04-22 19:05:49 +00:00
|
|
|
add_subdirectory(tests/library)
|
2014-02-12 18:54:03 +00:00
|
|
|
# add_subdirectory(tests/library/rewriter)
|
|
|
|
# add_subdirectory(tests/library/tactic)
|
2014-06-06 01:55:36 +00:00
|
|
|
add_subdirectory(tests/frontends/lean)
|
2013-09-14 02:15:38 +00:00
|
|
|
|
|
|
|
# Include style check
|
|
|
|
include(StyleCheck)
|
|
|
|
file(GLOB_RECURSE LEAN_SOURCES
|
2013-09-14 03:00:55 +00:00
|
|
|
${LEAN_SOURCE_DIR}
|
2013-09-16 23:23:20 +00:00
|
|
|
${LEAN_SOURCE_DIR}/[A-Za-z]*.cpp
|
|
|
|
${LEAN_SOURCE_DIR}/[A-Za-z]*.h)
|
2013-09-14 02:15:38 +00:00
|
|
|
add_style_check_target(style "${LEAN_SOURCES}")
|
2014-10-03 00:04:30 +00:00
|
|
|
add_test(NAME style_check COMMAND ${PYTHON_EXECUTABLE} ${LEAN_SOURCE_DIR}/cmake/Modules/cpplint.py ${LEAN_SOURCES})
|
2014-06-29 01:32:44 +00:00
|
|
|
|
2014-07-21 02:34:33 +00:00
|
|
|
# Set PROCESSOR_COUNT
|
|
|
|
if(NOT DEFINED PROCESSOR_COUNT)
|
|
|
|
# Unknown:
|
|
|
|
set(PROCESSOR_COUNT 1)
|
|
|
|
|
|
|
|
# Linux:
|
|
|
|
set(cpuinfo_file "/proc/cpuinfo")
|
|
|
|
if(EXISTS "${cpuinfo_file}")
|
|
|
|
file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
|
|
|
|
list(LENGTH procs PROCESSOR_COUNT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Mac:
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
2014-07-22 03:07:11 +00:00
|
|
|
execute_process(COMMAND "sysctl" "hw.ncpu" OUTPUT_VARIABLE info)
|
|
|
|
string(REGEX REPLACE "^hw.ncpu: ([0-9]+).*$" "\\1" PROCESSOR_COUNT "${info}")
|
2014-07-21 02:34:33 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Windows:
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-09-26 16:26:40 +00:00
|
|
|
if("${CROSS_COMPILE}" MATCHES "ON")
|
|
|
|
message(STATUS "Lean standard library will not be compiled when using cross-compilation.")
|
|
|
|
else()
|
|
|
|
add_custom_target(
|
|
|
|
standard_lib ALL
|
2014-10-03 00:04:30 +00:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${LEAN_SOURCE_DIR}/../bin/linja
|
2014-09-26 16:26:40 +00:00
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/shell/lean
|
|
|
|
WORKING_DIRECTORY ${LEAN_SOURCE_DIR}/../library
|
|
|
|
)
|
|
|
|
endif()
|
2014-07-30 22:12:37 +00:00
|
|
|
|
|
|
|
add_custom_target(clean-olean
|
2014-09-14 08:40:21 +00:00
|
|
|
WORKING_DIRECTORY ${LEAN_SOURCE_DIR}/../library
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_MODULE_PATH}CleanOlean.cmake
|
|
|
|
)
|