Skip to content
Snippets Groups Projects
Commit 34fbc544 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'master' of github.com:tarantool/tarantool

parents 13789bfe 673554c1
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,8 @@ include(CheckCCompilerFlag)
include(CheckSymbolExists)
include(CheckCSourceRuns)
include(CheckCXXSourceRuns)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(TestBigEndian)
include(CheckFunctionExists)
......
OS X Readme
===========
This manual explains how to manually build tarantool from sources.
If you just need a working binary, please use homebrew:
brew install http://tarantool.org/dist/tarantool.rb
Target OS: MacOS X "Lion"
First of all, make sure mac ports are available (to install packages from).
......@@ -7,7 +15,13 @@ First of all, make sure mac ports are available (to install packages from).
port install autoconf binutils cmake ncurses zlib readline
2. Install necessary python modules: pexpect, pyYAML, daemon
2. Upgrade clang to 3.2+
Go to http://developer.apple.com/ to download and install the latest version
of "Command Line Tools for Xcode". This package contains /usr/bin/clang and
/usr/bin/clang++ binaries. Check that clang version is at least 3.2.
3. Install necessary python modules: pyYAML, daemon
-------------
NB: it is recommended to install python modules through setup.py,
using the default python (which should be >= 2.6.x and < 3.x);
......@@ -16,10 +30,10 @@ tar -xzf module.tar.gz
cd module-dir
sudo python setup.py install
where module is the name of the installed module and module-dir is the name of the directory
the module's archive deflates into.
where module is the name of the installed module and module-dir is the name of
the directory the module's archive deflates into.
3. Download & build tarantool source code:
4. Download & build tarantool source code:
-------------
git clone git://github.com/tarantool/tarantool.git
......@@ -27,7 +41,7 @@ git clone git://github.com/tarantool/tarantool.git
cd tarantool
CC=clang CXX=clang++ cmake . -DCMAKE_BUILD_TYPE=RelWithDebugInfo -DENABLE_CLIENT=true
4. Run tarantool test suite
5. Run tarantool test suite
-------------
NB: the following tests are not runnable on MacOS X at this point:
......
......@@ -16,22 +16,28 @@ if (CMAKE_C_COMPILER_ID STREQUAL Clang)
set(CMAKE_COMPILER_IS_GNUCXX OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
# gcc and g++ >= 4.5 are supported
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE CC_VERSION)
if (CC_VERSION VERSION_LESS 4.5)
message (FATAL_ERROR
"${CMAKE_C_COMPILER} version should be >= 4.5 -- ${CC_VERSION}")
endif()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE CXX_VERSION)
if (CXX_VERSION VERSION_LESS 4.5)
message (FATAL_ERROR
"${CMAKE_CXX_COMPILER} version should be >= 4.5 -- ${CXX_VERSION}")
endif()
#
# Check supported standards
#
if((NOT HAVE_STD_C11 AND NOT HAVE_STD_GNU99) OR
(NOT HAVE_STD_CXX11 AND NOT HAVE_STD_GNUXX0X))
set(CMAKE_REQUIRED_FLAGS "-std=c11")
check_c_source_compiles("int main(void) { return 0; }" HAVE_STD_C11)
set(CMAKE_REQUIRED_FLAGS "-std=gnu99")
check_c_source_compiles("int main(void) { return 0; }" HAVE_STD_GNU99)
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
check_cxx_source_compiles("int main(void) { return 0; }" HAVE_STD_CXX11)
set(CMAKE_REQUIRED_FLAGS "-std=gnu++0x")
check_cxx_source_compiles("int main(void) { return 0; }" HAVE_STD_GNUXX0X)
set(CMAKE_REQUIRED_FLAGS "")
endif()
if((NOT HAVE_STD_C11 AND NOT HAVE_STD_GNU99) OR
(NOT HAVE_STD_CXX11 AND NOT HAVE_STD_GNUXX0X))
message (FATAL_ERROR
"${CMAKE_C_COMPILER} should support -std=c11 or -std=gnu99. "
"${CMAKE_CXX_COMPILER} should support -std=c++11 or -std=gnu++0x. "
"Please consider upgrade to gcc 4.5+ or clang 3.2+.")
endif()
#
# Perform build type specific configuration.
......@@ -82,12 +88,15 @@ macro(enable_tnt_compile_flags)
# of the code.
# Set standard
if (CMAKE_COMPILER_IS_CLANG OR CC_VERSION VERSION_GREATER 4.7 OR
CC_VERSION VERSION_EQUAL 4.7)
if (HAVE_STD_C11)
add_compile_flags("C" "-std=c11")
add_compile_flags("CXX" "-std=c++11")
else()
add_compile_flags("C" "-std=gnu99")
endif()
if (HAVE_STD_CXX11)
add_compile_flags("CXX" "-std=c++11")
else()
add_compile_flags("CXX" "-std=gnu++0x")
endif()
......@@ -112,11 +121,12 @@ macro(enable_tnt_compile_flags)
add_definitions("-D__STDC_LIMIT_MACROS=1")
add_definitions("-D__STDC_CONSTANT_MACROS=1")
# Only add -Werror if it's a debug build, done by developers using GCC.
# Community builds should not cause extra trouble.
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND CMAKE_COMPILER_IS_GNUCC)
add_compile_flags("C;CXX" "-Werror")
endif()
# Only add -Werror if it's a debug build, done by developers.
# Release builds should not cause extra trouble.
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug")
AND HAVE_STD_C11 AND HAVE_STD_CXX11)
add_compile_flags("C;CXX" "-Werror")
endif()
endmacro(enable_tnt_compile_flags)
#
......
......@@ -3,8 +3,9 @@
#
enable_tnt_compile_flags()
add_subdirectory(plugin)
if (NOT TARGET_OS_DARWIN)
add_subdirectory(plugin)
endif()
include_directories(${LIBEV_INCLUDE_DIR})
include_directories(${LIBEIO_INCLUDE_DIR})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment