Add simple build system based on cmake

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-07-16 22:10:18 -07:00
parent e9c9974ee0
commit 139f4f2a7f
6 changed files with 54 additions and 0 deletions

2
README
View file

@ -6,6 +6,8 @@ Requirements:
http://gmplib.org/
- (optional) gperftools
https://code.google.com/p/gperftools/
- cmake
http://www.cmake.org
Instructions for installing gcc-4.8 (C++11 compatible) on Ubuntu
Execute:

13
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,13 @@
cmake_minimum_required (VERSION 2.8.7)
project (LEAN CXX)
set (LEAN_VERSION_MAJOR 0)
set (LEAN_VERSION_MINOR 1)
set (CMAKE_CXX_COMPILER "g++-4.8")
set (CMAKE_CXX_FLAGS_DEBUG "-DLEAN_DEBUG -DLEAN_TRACE -g")
set (CMAKE_CXX_FLAGS_RELEASE "-O3")
set (CMAKE_COLOR_MAKEFILE ON)
add_definitions(-std=c++11 -Wall)
add_subdirectory(util)
add_subdirectory(shell)

12
src/shell/CMakeLists.txt Normal file
View file

@ -0,0 +1,12 @@
configure_file (
"${LEAN_SOURCE_DIR}/shell/version.h.in"
"${LEAN_BINARY_DIR}/version.h"
)
include_directories("${LEAN_BINARY_DIR}")
include_directories (${LEAN_SOURCE_DIR}/util)
set (EXTRA_LIBS ${EXTRA_LIBS} util gmp)
add_executable(lean lean.cpp)
target_link_libraries (lean ${EXTRA_LIBS})

23
src/shell/lean.cpp Normal file
View file

@ -0,0 +1,23 @@
#include <iostream>
#include "version.h"
#include "name.h"
#include "mpq.h"
void tst1() {
lean::name n1("foo");
lean::name n2(n1, 1);
std::cout << n2 << "\n";
}
void tst2() {
lean::mpq n1("10000000000000000000000000000000000000000");
lean::mpq n2(317, 511);
std::cout << n1*n2 << "\n";
}
int main() {
std::cout << "Lean (version " << LEAN_VERSION_MAJOR << "." << LEAN_VERSION_MINOR << ")\n";
tst1();
tst2();
return 0;
}

3
src/shell/version.h.in Normal file
View file

@ -0,0 +1,3 @@
// the configured options and settings for Tutorial
#define LEAN_VERSION_MAJOR @LEAN_VERSION_MAJOR@
#define LEAN_VERSION_MINOR @LEAN_VERSION_MINOR@

1
src/util/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
add_library(util trace.cpp debug.cpp name.cpp exception.cpp gmp_init.cpp mpz.cpp mpq.cpp mpbq.cpp)