Features known to CMake are named mostly following the same convention as the Clang feature test macros. There are some exceptions, such as CMake using cxxfinal and cxxoverride instead of the single cxxoverridecontrol used by Clang. Note that there are no separate compile features properties or variables for the OBJC or OBJCXX languages. It turns out that there is fairly simple way to find it though: findprogram(CLANGFORMAT NAMES clang-format clang-format-3.6 clang-format-3.5 clang-format-3.4) This picks the first match in the list of names, which is just what I need. It's not totally generic because, when a new version of clang-format is released, the command needs updating.
We use here the command-line, non-interactive CMake interface.
- Download and installCMake. Version 3.4.3 is the minimum required.
- Open a shell. Your development tools must be reachable from this shellthrough the PATH environment variable.
- Create a build directory. Building LLVM in the sourcedirectory is not supported. cd to this directory:
- Execute this command in the shell replacing path/to/llvm/source/root withthe path to the root of your LLVM source tree:CMake will detect your development environment, perform a series of tests, andgenerate the files required for building LLVM. CMake will use default valuesfor all build parameters. See the Options and variables section fora list of build parameters that you can modify.This can fail if CMake can’t detect your toolset, or if it thinks that theenvironment is not sane enough. In this case, make sure that the toolset thatyou intend to use is the only one reachable from the shell, and that the shellitself is the correct one for your development environment. CMake will refuseto build MinGW makefiles if you have a POSIX shell reachable through the PATHenvironment variable, for instance. Filemaker vs ninox. You can force CMake to use a given buildtool; for instructions, see the Usage section, below.
- After CMake has finished running, proceed to use IDE project files, or startthe build from the build directory:The
--build
option tellscmake
to invoke the underlying buildtool (make
,ninja
,xcodebuild
,msbuild
, etc.)The underlying build tool can be invoked directly, of course, butthe--build
option is portable. - After LLVM has finished building, install it from the build directory:The
--target
option withinstall
parameter in addition tothe--build
option tellscmake
to build theinstall
target.It is possible to set a different install prefix at installation timeby invoking thecmake_install.cmake
script generated in thebuild directory:
Yes, a few example 'projects' are high on my wish list. Fashion digital art.
Cmake Build With Clang
The PyKDE5 work stalled earlier this year as Shaheed got other commitments, and myself, I've not had time to work on that corner. The final piece that is needed is moving all sip annotations (in/out parameters, ownership, etc.) out of sip files into something that cppyy can use in the pythonizations (or even generate the pythonizations from sip annotations).
Cmake Set Compiler Clang
PyKDE is somewhat of a special case, b/c the approach taken there was to automatically create bindings to all classes accessible from the KDE headers, which is a bit of a fuzzy requirement. An easier approach is possible if a project has a better structure. E.g. if all relevant C++ entities live in a single namespace. Likewise, if the project has clear conventions on ownership (KDE does not), then pythonization rules are simple to write.