1aa31bc9d32e49cddf832a8fcd11fa1f27c2de80
[blender.git] / build_files / build_environment / cmake / llvm.cmake
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ***** END GPL LICENSE BLOCK *****
18
19 set(LLVM_EXTRA_ARGS
20         -DLLVM_USE_CRT_RELEASE=MT
21         -DLLVM_USE_CRT_DEBUG=MTd
22         -DLLVM_INCLUDE_TESTS=OFF
23         -DLLVM_TARGETS_TO_BUILD=X86
24         -DLLVM_INCLUDE_EXAMPLES=OFF
25         -DLLVM_ENABLE_TERMINFO=OFF
26 )
27
28 if(WIN32)
29         set(LLVM_GENERATOR "Ninja")
30 else()
31         set(LLVM_GENERATOR "Unix Makefiles")
32 endif()
33
34 # short project name due to long filename issues on windows
35 ExternalProject_Add(ll
36         URL ${LLVM_URI}
37         DOWNLOAD_DIR ${DOWNLOAD_DIR}
38         URL_HASH MD5=${LLVM_HASH}
39         CMAKE_GENERATOR ${LLVM_GENERATOR}
40         PREFIX ${BUILD_DIR}/ll
41         CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
42         INSTALL_DIR ${LIBDIR}/llvm
43 )
44
45 if(MSVC)
46         if(BUILD_MODE STREQUAL Release)
47                 set(LLVM_HARVEST_COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ )
48         else()
49                 set(LLVM_HARVEST_COMMAND
50                         ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/
51                 )
52         endif()
53         ExternalProject_Add_Step(ll after_install
54                 COMMAND ${LLVM_HARVEST_COMMAND}
55                 DEPENDEES mkdir update patch download configure build install
56         )
57 endif()