-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
88 lines (65 loc) · 2.96 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# root
cmake_minimum_required(VERSION 2.6)
# this policy warning is due to lib command lines arg output from llvm-config
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
project (rphp)
set(LLVM_MIN_VERSION "2006000")
set(LLVM_MIN_VERSION_TEXT "2.6")
set(BOOST_MIN_VERSION "103800")
set(BOOST_MIN_VERSION_TEXT "1.38")
set(ICU_MIN_VERSION "4002000")
set(ICU_MIN_VERSION_TEXT "4.2")
set(RPHP_SHARED_LIBS 0)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules )
set(RPHP_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
set(ASIO_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include/asio)
set(RPHP_LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_CXX_FLAGS_DEBUG "-fexceptions -g -Wall -Winline -W -Wwrite-strings -Wno-unused")
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
MESSAGE( STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH} )
MESSAGE( STATUS "RPHP_INCLUDE_DIR: " ${RPHP_INCLUDE_DIR} )
MESSAGE( STATUS "RPHP_LIB_DIR: " ${RPHP_LIB_DIR} )
MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )
Find_Package(Boost REQUIRED)
IF( Boost_VERSION LESS ${BOOST_MIN_VERSION} )
MESSAGE(FATAL_ERROR "Boost version ${Boost_VERSION} too old, please install ${BOOST_MIN_VERSION_TEXT} or greater!")
ENDIF( Boost_VERSION LESS ${BOOST_MIN_VERSION} )
Find_Package(ICU REQUIRED)
Find_Package(LLVM REQUIRED)
Find_Package(GMP REQUIRED)
Find_Package(CppUnit) # optional
Find_Package(Doxygen) # optional
#set(RPHP_INCLUDE_FULL ${RPHP_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${ICU_INCLUDE_DIRS} ${GMP_INCLUDE_DIR} ${LLVM_INCLUDE_DIR})
#Message(STATUS "Includes: ${RPHP_INCLUDE_FULL}")
include_directories(${RPHP_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${ICU_INCLUDE_DIRS} ${GMP_INCLUDE_DIR} ${LLVM_INCLUDE_DIR})
link_directories(${ICU_LIB_DIRS})
set(TINYXML_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/3rdparty/tinyxml")
# require ICU 4.2
IF(ICU_VERSION LESS ${ICU_MIN_VERSION})
MESSAGE(FATAL_ERROR "ICU version ${ICU_STRING_VERSION} is too old, please install ${ICU_MIN_VERSION_TEXT} or greater!")
ENDIF(ICU_VERSION LESS ${ICU_MIN_VERSION})
IF( LLVM_VERSION LESS ${LLVM_MIN_VERSION} )
MESSAGE(FATAL_ERROR "LLVM version ${LLVM_STRING_VERSION} is too old, please install ${LLVM_MIN_VERSION_TEXT} of greater!")
ENDIF( LLVM_VERSION LESS ${LLVM_MIN_VERSION} )
add_definitions(-DLLVM_VERSION=${LLVM_VERSION})
add_subdirectory(3rdparty)
add_subdirectory(runtime)
add_subdirectory(c-runtime)
add_subdirectory(compiler)
add_subdirectory(frontend/cli)
add_subdirectory(frontend/http)
# check whether to include the sandbox
IF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_subdirectory(sandbox)
ENDIF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
IF(CPPUNIT_FOUND)
ENABLE_TESTING()
ADD_TEST(rphp-runtime-suite runtime/test/rphp-runtime-suite)
ADD_TEST(rphp-sizes runtime/test/rphp-sizes)
ENDIF(CPPUNIT_FOUND)
IF(DOXYGEN_FOUND)
SET(DOXYFILE doc/Doxyfile.rphp)
ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXYFILE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
ENDIF(DOXYGEN_FOUND)