Commit 54efb940 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #242 from dagar/cmake

fixes #238 CMake issues
parents 51d65601 0ed9c200
......@@ -15,12 +15,34 @@ if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release" AND NOT ${CMAKE_BUILD_TYPE} STREQU
message(FATAL_ERROR "CMAKE_BUILD_TYPE must be set to Release or Debug")
endif()
option(ENABLE_CCACHE "enable caching compiler output" ON)
option(ENABLE_GIL "threading use GIL" ON)
option(ENABLE_GOLD "enable the gold linker" ON)
option(ENABLE_GRWL "threading use GRWL" OFF)
option(ENABLE_INTEL_JIT_EVENTS "LLVM support for Intel JIT Events API" OFF)
option(ENABLE_LLVM_DEBUG "LLVM debug symbols" OFF)
option(ENABLE_VALGRIND "pyston valgrind support" OFF)
# automatically use ccache if found
if(ENABLE_CCACHE)
find_program(CCACHE ccache)
if(CCACHE)
message(STATUS "found ccache ${CCACHE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
endif()
endif()
# automatically use the gold linker if found
if(ENABLE_GOLD)
find_program(GOLD_LINKER ld.gold)
if(GOLD_LINKER)
message(STATUS "found the gold linker ${GOLD_LINKER}")
set(CMAKE_LINKER "${GOLD_LINKER}")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -B${CMAKE_SOURCE_DIR}/tools/build_system")
endif()
endif()
# initial clang flags (set here so they're used when building llvm)
set(CLANG_FLAGS "-Qunused-arguments -fcolor-diagnostics" CACHE STRING "Clang specific C and CXX flags")
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
......@@ -32,7 +54,7 @@ endif()
# llvm disable debug info unless ENABLE_LLVM_DEBUG is ON
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND NOT ENABLE_LLVM_DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "-g0" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O3" CACHE STRING "" FORCE)
endif()
execute_process(COMMAND cat llvm_revision.txt WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE LLVMREV OUTPUT_STRIP_TRAILING_WHITESPACE)
......
......@@ -290,24 +290,58 @@ CC="ccache $HOME/pyston_deps/gcc-4.8.2-install/bin/gcc" CXX="ccache $HOME/pyston
~/pyston_deps/ninja/ninja check-pyston
```
On Ubuntu 12.04, you need a new cmake in order to use ninja, but can install ninja using `sudo apt-get install ninja-build`. Then:
If your system provides a new enough GCC and cmake, you can just do:
```
mkdir ~/pyston-build
cd ~/pyston-build
CC="ccache $HOME/pyston_deps/gcc-4.8.2-install/bin/gcc" CXX="ccache $HOME/pyston_deps/gcc-4.8.2-install/bin/g++" ~/pyston_deps/cmake-3.0.0/bin/cmake -GNinja ~/pyston -DCMAKE_EXE_LINKER_FLAGS="-Wl,-rpath,$HOME/pyston_deps/gcc-4.8.2-install/lib64" -DGCC_INSTALL_PREFIX=~/pyston_deps/gcc-4.8.2-install
mkdir ~/pyston-build && cd ~/pyston-build
cmake -GNinja ~/pyston
ninja check-pyston
```
If your system provides a new enough GCC and cmake, you can just do:
**Ubuntu 12.04**
```
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
sudo add-apt-repository --yes ppa:kubuntu-ppa/backports
sudo apt-get -qq update
sudo apt-get install -yq git cmake ninja-build ccache libncurses5-dev liblzma-dev libreadline-dev libgmp3-dev autoconf libtool python-dev texlive-extra-utils clang-3.4 libstdc++-4.8-dev
git clone --recursive https://github.com/dropbox/pyston.git ~/pyston
git clone git://github.com/llvm-mirror/llvm.git ~/pyston_deps/llvm-trunk
git clone git://github.com/llvm-mirror/clang.git ~/pyston_deps/llvm-trunk/tools/clang
mkdir ~/pyston-build && cd ~/pyston-build
CC='clang' CXX='clang++' cmake -GNinja ~/pyston
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
ninja llvm_up
ninja check-pyston # run the test suite
```
mkdir ~/pyston-build
cd ~/pyston-build
CC='ccache gcc' CXX='ccache g++' cmake -GNinja ~/pyston
ninja check-pyston
**Ubuntu 14.04**
```
sudo apt-get install -yq git cmake ninja-build ccache libncurses5-dev liblzma-dev libreadline-dev libgmp3-dev autoconf libtool python-dev texlive-extra-utils clang-3.5
git clone --recursive https://github.com/dropbox/pyston.git ~/pyston
git clone git://github.com/llvm-mirror/llvm.git ~/pyston_deps/llvm-trunk
git clone git://github.com/llvm-mirror/clang.git ~/pyston_deps/llvm-trunk/tools/clang
mkdir ~/pyston-build && cd ~/pyston-build
CC='clang' CXX='clang++' cmake -GNinja ~/pyston
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
ninja llvm_up
ninja check-pyston # run the test suite
```
Other important options:
- `-DCMAKE_BUILD_TYPE=Debug` (or Release, but defaults to Release I believe)
- `-DCMAKE_BUILD_TYPE=Debug` (defaults to Release)
- `-DENABLE_LLVM_DEBUG=1` for full LLVM debug
- `-DENABLE_CCACHE=0` to disable ccache
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment