forked from cs136/seashell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
115 lines (102 loc) · 4.07 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Seashell
# Copyright (C) 2012-2015 The Seashell Maintainers
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# See also 'ADDITIONAL TERMS' at the end of the included LICENSE file.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
# Implementor's note - this file will need to be updated when changing
# versions of a library, due to changes in build system, etc.
# Contact someone at seashell@cs.uwaterloo.ca if you're uncertain about what to do
# in this case.
# It's not terribly important to keep LLVM/Clang up to date, but do so
# anyways as it's easier to make incremental changes to the build system.
# We're on 3.4 as of January '14. Expect 3.5 before the end of the year.
# (At any rate, we should try to keep in sync with the version of clang used in RunC)
# libgit2 should remain relatively stable.
# Hacks to get Clang/Compiler-RT to build:
execute_process(COMMAND ln -sf "../../clang" "${CMAKE_CURRENT_SOURCE_DIR}/llvm/tools")
execute_process(COMMAND ln -sf "../../compiler-rt" "${CMAKE_CURRENT_SOURCE_DIR}/llvm/projects")
# Build our dependencies.
# ZLIB library (libssh2)
find_package(ZLIB)
# OpenSSL (libssh2)
find_package(OpenSSL)
# External projects (not CMake based)
# libssh2 - libssh2 SSH library
ExternalProject_Add(
libssh2
URL ${CMAKE_CURRENT_SOURCE_DIR}/libssh2
PATCH_COMMAND <SOURCE_DIR>/buildconf
CONFIGURE_COMMAND <SOURCE_DIR>/configure --with-openssl --enable-static --disable-shared
CFLAGS=-fPIC CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
BUILD_COMMAND make -j
INSTALL_COMMAND "")
# External projects (CMake based)
# Global overrides
# Build behaviour for TravisCI builds.
if(NOT DEFINED TRAVIS_BUILD OR NOT TRAVIS_BUILD)
else()
message( "Building on TravisCI infrastructure..." )
endif()
set(CMAKE_BUILD_TYPE "MinSizeRel")
# llvm/clang/compiler-rt (overrides).
set(LLVM_BUILD_TOOLS OFF CACHE STRING "Build LLVM tools." FORCE)
set(CLANG_ENABLE_ARCMT OFF CACHE STRING "Build Clang ARCMT." FORCE)
if (ENABLE_STATIC_ANALYSIS)
set(CLANG_ENABLE_STATIC_ANALYZER ON CACHE STRING "Build Clang Static Analysis." FORCE)
else()
set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE STRING "Build Clang Static Analysis." FORCE)
endif()
add_subdirectory(llvm EXCLUDE_FROM_ALL)
add_custom_target(_build_clang ALL)
add_dependencies(_build_clang clang llvm-symbolizer clang-tblgen llvm-tblgen compiler-rt clang-headers)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/llvm/lib/clang DESTINATION lib)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/llvm/bin/ USE_SOURCE_PERMISSIONS DESTINATION bin/)
# Set include paths.
set(LIBSSH2_LIBRARIES
ssh2
${CMAKE_DL_LIBS}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES}
PARENT_SCOPE)
set(LIBSSH2_LIBRARIES
ssh2
${CMAKE_DL_LIBS}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES})
set(LIBSSH2_LINK_DIRS
${CMAKE_CURRENT_BINARY_DIR}/libssh2-prefix/src/libssh2-build/src/.libs/
PARENT_SCOPE)
set(LIBSSH2_LINK_DIRS
${CMAKE_CURRENT_BINARY_DIR}/libssh2-prefix/src/libssh2-build/src/.libs/)
set(LIBSSH2_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libssh2/include/
PARENT_SCOPE)
set(LLVM_SOURCE_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/llvm/include
PARENT_SCOPE)
set(LLVM_BINARY_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/llvm/include
PARENT_SCOPE)
set(CLANG_SOURCE_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/clang/include
PARENT_SCOPE)
set(CLANG_BINARY_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/llvm/tools/clang/include
PARENT_SCOPE)
# Set LLVM CXX Flags
set(LLVM_CXX_COMPILE_FLAGS
"-fno-rtti"
PARENT_SCOPE)