Vc uses CMake as its buildsystem. It also provides much of the CMake logic it uses for itself for other projects that use CMake and Vc. Here's an (incomplete) list of features you can get from the CMake scripts provided with Vc:
To make use of these features simply copy the FindVc.cmake as installed by Vc to your project. Add
to your CMakeLists.txt. After that you can use the following variables:
add_definitions
. COMPILE_OPTIONS
property or via add_compile_options
. add_compile_options
).The following variables might be of interest, too:
The macro vc_compile_for_all_implementations is provided to help with compiling a given source file multiple times with all different possible SIMD targets for the given architecture. Example:
vc_compile_for_all_implementations(objs src/trigonometric.cpp FLAGS -DSOME_FLAG EXCLUDE Scalar SSE2)
You can specify an arbitrary number of additional compiler flags after the FLAGS argument. These flags will be used for all compiler calls. After an optional EXCLUDE argument you can specify targets that you want to exclude. After an optional ONLY argument you can specify targets that you want to compile for. (So either you exclude some, or you explicitly list the targets you want.)
Often it suffices to have SSE2 or SSE3 as the least common denominator and provide SSE4_1 and AVX. Here is the currently complete list of possible targets the macro will compile for:
If your project does not use CMake all you need to do is the following: