llvm.org GIT mirror llvm / d02e8e5
[CMake] [OCaml] Allow building OCaml bindings out of tree. That is, add build system support for building the OCaml bindings against preinstalled LLVM libraries. This is important for package managers such as OPAM, because OCaml libraries need to be built against a specific OCaml compiler installation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280642 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Zotov 4 years ago
3 changed file(s) with 39 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
0 This directory contains LLVM bindings for the OCaml programming language
1 (http://ocaml.org).
2
3 Prerequisites
4 -------------
5
6 * OCaml 4.00.0+.
7 * ctypes 0.4+.
8 * oUnit 2+ (only required for tests).
9 * CMake (to build LLVM).
10
11 Building the bindings
12 ---------------------
13
14 If all dependencies are present, the bindings will be built and installed
15 as a part of the default CMake configuration, with no further action.
16 They will only work with the specific OCaml compiler detected during the build.
17
18 The bindings can also be built out-of-tree, i.e. targeting a preinstalled
19 LLVM. To do this, configure the LLVM build tree as follows:
20
21 $ cmake -DLLVM_OCAML_OUT_OF_TREE=TRUE \
22 -DCMAKE_INSTALL_PREFIX=[OCaml install prefix] \
23 [... any other options]
24
25 then build and install it as:
26
27 $ make ocaml_all
28 $ cmake -P bindings/ocaml/cmake_install.cmake
564564 endif()
565565 endif()
566566
567 # Keep the version requirements in sync with bindings/ocaml/README.txt.
567568 include(FindOCaml)
568569 include(AddOCaml)
569570 if(WIN32)
169169 add_dependencies("ocaml_${name}" "ocaml_${ocaml_dep}")
170170 endforeach()
171171
172 foreach( llvm_lib ${llvm_libs} )
173 add_dependencies("ocaml_${name}" "${llvm_lib}")
174 endforeach()
172 if( NOT LLVM_OCAML_OUT_OF_TREE )
173 foreach( llvm_lib ${llvm_libs} )
174 add_dependencies("ocaml_${name}" "${llvm_lib}")
175 endforeach()
176 endif()
177
178 add_dependencies("ocaml_all" "ocaml_${name}")
175179
176180 set(install_files)
177181 set(install_shlibs)
204208 VERBATIM)
205209 endforeach()
206210 endfunction()
211
212 add_custom_target("ocaml_all")