Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 180 lines (145 sloc) 5.473 kB
1d083f4 @Stilgar84 Change the name of the generated solution file for a CMake build. (fr…
Stilgar84 authored
1 project(LLVM)
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
2 cmake_minimum_required(VERSION 2.6.1)
3
4 set(PACKAGE_NAME llvm)
5 set(PACKAGE_VERSION svn)
f7e73b9 CMake: Directed bug reports to llvmbugs.
Oscar Fuentes authored
6 set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
7
8 include(FindPerl)
9
10 set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
980e842 CMake: Removed some cruft.
Oscar Fuentes authored
11 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
12 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
13 set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
14 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
15
e1ad087 CMake: Builds all targets.
Oscar Fuentes authored
16 if( MSVC )
17 set(LLVM_TARGETS_TO_BUILD X86
18 CACHE STRING "Semicolon-separated list of targets to build")
19 else( MSVC )
20 set(LLVM_TARGETS_TO_BUILD
9380c05 @rlsosborne Add XCore backend to CMake build.
rlsosborne authored
21 Alpha ARM CBackend CellSPU CppBackend IA64 Mips MSIL PIC16 PowerPC Sparc X86 XCore
e1ad087 CMake: Builds all targets.
Oscar Fuentes authored
22 CACHE STRING "Semicolon-separated list of targets to build")
23 endif( MSVC )
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
24
25 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
26
27 # Add path for custom modules
28 set(CMAKE_MODULE_PATH
29 ${CMAKE_MODULE_PATH}
30 "${LLVM_MAIN_SRC_DIR}/cmake"
31 "${LLVM_MAIN_SRC_DIR}/cmake/modules"
32 )
33
34 if(WIN32)
4fd38b8 CMake: Cygwin pretends to be Unix.
Oscar Fuentes authored
35 if(CYGWIN)
36 set(LLVM_ON_WIN32 0)
37 set(LLVM_ON_UNIX 1)
38 else(CYGWIN)
39 set(LLVM_ON_WIN32 1)
40 set(LLVM_ON_UNIX 0)
41 endif(CYGWIN)
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
42 set(LTDL_SHLIB_EXT ".dll")
43 set(EXEEXT ".exe")
44 # Maximum path length is 160 for non-unicode paths
45 set(MAXPATHLEN 160)
46 else(WIN32)
47 if(UNIX)
48 set(LLVM_ON_WIN32 0)
49 set(LLVM_ON_UNIX 1)
50 set(LTDL_SHLIB_EXT ".so")
51 set(EXEEXT "")
52 # FIXME: Maximum path length is currently set to 'safe' fixed value
53 set(MAXPATHLEN 2024)
54 else(UNIX)
55 MESSAGE(SEND_ERROR "Unable to determine platform")
56 endif(UNIX)
57 endif(WIN32)
58
59 if( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
60 set(HAVE_LLVM_CONFIG 1)
61 endif( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config )
62 # find_file(HAVE_LLVM_CONFIG llvm-config ${LLVM_TOOLS_BINARY_DIR})
63 # message(STATUS ${HAVE_LLVM_CONFIG})
64
de98db3 CMake: MSVC++ no longer uses a special configuration method.
Oscar Fuentes authored
65 include(config-ix)
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
66
67 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
68 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
69 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
70
71 # set(CMAKE_VERBOSE_MAKEFILE true)
72
73 add_definitions( -D__STDC_LIMIT_MACROS )
0a48698 CMake: Reverted some unintentional changes on the previous commit.
Oscar Fuentes authored
74 add_definitions( -D__STDC_CONSTANT_MACROS )
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
75
b0c5699 CMake: Support for building 32 bit mode libs and binaries on
Oscar Fuentes authored
76 set(LLVM_PLO_FLAGS "" CACHE
77 STRING "Flags for creating partially linked objects.")
78
79 if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
80 # TODO: support other platforms and toolchains.
81 option(BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
82 if( BUILD_32_BITS )
83 message(STATUS "Building 32 bits executables and libraries.")
84 add_definitions( -m32 )
85 set( CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}" )
86 set( CMAKE_LINK_LIBRARY_FLAG "-m32 ${CMAKE_LINK_LIBRARY_FLAG}" )
87 set( LLVM_PLO_FLAGS -melf_i386 ${LLVM_PLO_FLAGS} )
88 endif( BUILD_32_BITS )
89 endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
90
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
91 if( MSVC )
92 add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
93 add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
94 add_definitions( -D_SCL_SECURE_NO_DEPRECATE )
a789af2 CMake: Disabled some warnings for MSVC.
Oscar Fuentes authored
95 add_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
96 add_definitions( -wd4355 -wd4715 )
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
97 endif( MSVC )
98
980e842 CMake: Removed some cruft.
Oscar Fuentes authored
99 include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
100 #link_directories( d:/dev/lib )
101
102 #add_subdirectory(lib)
103
104 include(AddLLVM)
105 include(AddPartiallyLinkedObject)
e1ad087 CMake: Builds all targets.
Oscar Fuentes authored
106 include(TableGen)
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
107
108 add_subdirectory(lib/Support)
109 add_subdirectory(lib/System)
1d8e4cf CMake build system: support for parallel builds.
Oscar Fuentes authored
110
111 # Everything else depends on Support and System:
112 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
113
3ab40ca CMake: Support for cross-compiling. For now, requires a previously
Oscar Fuentes authored
114 set(LLVM_TABLEGEN "tblgen" CACHE
115 STRING "Native TableGen executable.")
116
117 if( CMAKE_CROSSCOMPILING )
118 include( CrossCompileLLVM )
119 endif( CMAKE_CROSSCOMPILING )
120
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
121 add_subdirectory(utils/TableGen)
122
123 add_custom_command(OUTPUT ${llvm_builded_incs_dir}/Intrinsics.gen
3ab40ca CMake: Support for cross-compiling. For now, requires a previously
Oscar Fuentes authored
124 COMMAND ${LLVM_TABLEGEN} -gen-intrinsic -I ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
125 DEPENDS tblgen
126 COMMENT "Building intrinsics.gen...")
127
128 add_custom_target(intrinsics_gen ALL
129 DEPENDS ${llvm_builded_incs_dir}/Intrinsics.gen)
130
1d8e4cf CMake build system: support for parallel builds.
Oscar Fuentes authored
131 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} intrinsics_gen )
132
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
133 add_subdirectory(lib/VMCore)
134 add_subdirectory(lib/CodeGen)
135 add_subdirectory(lib/CodeGen/SelectionDAG)
136 add_subdirectory(lib/CodeGen/AsmPrinter)
137 add_subdirectory(lib/Bitcode/Reader)
138 add_subdirectory(lib/Bitcode/Writer)
139 add_subdirectory(lib/Transforms/Utils)
140 add_subdirectory(lib/Transforms/Instrumentation)
141 add_subdirectory(lib/Transforms/Scalar)
142 add_subdirectory(lib/Transforms/IPO)
143 add_subdirectory(lib/Transforms/Hello)
144 add_subdirectory(lib/Linker)
145 add_subdirectory(lib/Analysis)
146 add_subdirectory(lib/Analysis/IPA)
e1ad087 CMake: Builds all targets.
Oscar Fuentes authored
147
148 foreach(t ${LLVM_TARGETS_TO_BUILD})
149 message(STATUS "Targeting ${t}")
150 add_subdirectory(lib/Target/${t})
151 if( EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
152 add_subdirectory(lib/Target/${t}/AsmPrinter)
153 endif( EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
154 endforeach(t)
155
3d01fc7 Initial support for the CMake build system.
Oscar Fuentes authored
156 add_subdirectory(lib/ExecutionEngine)
157 add_subdirectory(lib/ExecutionEngine/Interpreter)
158 add_subdirectory(lib/ExecutionEngine/JIT)
159 add_subdirectory(lib/Target)
160 add_subdirectory(lib/AsmParser)
161 add_subdirectory(lib/Debugger)
162 add_subdirectory(lib/Archive)
163
164 add_subdirectory(tools)
165
166 add_subdirectory(examples)
1dc9716 CMake: `make install' for libraries, executables and header files.
Oscar Fuentes authored
167
168 install(DIRECTORY include
169 DESTINATION .
170 PATTERN ".svn" EXCLUDE
171 PATTERN "*.cmake" EXCLUDE
172 PATTERN "*.in" EXCLUDE
173 )
174
175 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include
176 DESTINATION .
177 )
178
179 # TODO: make and install documentation.
Something went wrong with that request. Please try again.