This repository requires CMake v2.8.0 or later. LLVM and Clang need a more recent version which also applies for in-tree builds. For more information than available in this document please see LLVM's CMake documentation and the official documentation.
When calling CMake for the first time, all needed compiler options must be specified on the command line. After this initial call to CMake, the compiler definitions must not be included for further calls to CMake. Other options can be specified on the command line multiple times including all definitions in the build options section below.
Example of configuring, building, reconfiguring, rebuilding:
$ mkdir build
$ cd build
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. # Initial configuration
$ make
...
$ make clean
$ cmake -DCMAKE_BUILD_TYPE=Debug .. # Second configuration
$ make
...
$ rm -rf *
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. # Third configuration
$ make
Notice in the example how the compiler definitions are only specified for an empty build directory, but other build options are used at any time.
The file CMakeCache.txt which is created after the first call to CMake is
a configuration file which holds all values for the build options. These
values can be changed using a text editor to modify CMakeCache.txt as
opposed to using definitions on the command line.
To have CMake create a particular type of build generator file simply include
the -G <Generator name> option:
$ cmake -G "Unix Makefiles" ...
You can see a list of generators CMake supports by executing the cmake command with no arguments.
$ cd openmp_top_level/ [ this directory with libomptarget/, runtime/, etc. ]
$ mkdir build
$ cd build
[ Unix* Libraries ]
$ cmake -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> ..
[ Windows* Libraries ]
$ cmake -G <Generator Type> -DCMAKE_C_COMPILER=<C Compiler> -DCMAKE_CXX_COMPILER=<C++ Compiler> -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release ..
$ make
$ make install
Builds with CMake can be customized by means of options as already seen above. One possibility is to pass them via the command line:
$ cmake -DOPTION=<value> path/to/source
Note
The first value listed is the respective default for that option.
For full documentation consult the CMake manual or execute
cmake --help-variable VARIABLE_NAME to get information about a specific
variable.
Release|Debug|RelWithDebInfo
Release, Debug, or RelWithDebInfo which chooses
the optimization level and presence of debugging symbols.ON (see below). So typically, a Fortran
compiler is not needed during the build.ml|ml64
OFF|ON
""
${CMAKE_C_COMPILER}
${CMAKE_CXX_COMPILER}
/path/to/built/llvm/tools
/path/to/llvm-lit
llvm-lit executable for running tests. The default
is to search the PATH and the directory in OPENMP_LLVM_TOOLS_DIR./path/to/FileCheck
FileCheck executable for running tests. The default
is to search the PATH and the directory in OPENMP_LLVM_TOOLS_DIR.libomp
aarch64|arm|i386|mic|mips|mips64|ppc64|ppc64le|x86_64
__x86_64__ predefined by compiler?).knc|knf
mic.50|45|40|30
normal|profile|stubs
normal, profile, or stubs.ON|OFF
OFF by default for Windows* and macOS*, but ON for
other Unix based operating systems.ON|OFF
Build a shared library. If this option is OFF, static OpenMP libraries
will be built instead of dynamic ones.
Note
Static libraries are not supported on Windows*.
OFF|ON
On macOS* machines, it is possible to build universal (or fat) libraries which include both i386 and x86_64 architecture objects in a single archive.
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_OSX_ARCHITECTURES='i386;x86_64' ..
$ make
There is also an option LIBOMP_OSX_ARCHITECTURES which can be set in case
this is an LLVM source tree build. It will only apply for the libomp library
avoids having the entire LLVM/Clang build produce universal binaries.
ON|OFF
ON
by default for IA-32 architecture and Intel(R) 64 architecture.OFF|ON
CACHE_LINE setting leads to false sharing.ON|OFF
ON by default for x86, x86_64, AArch64, and
PPC64 on Linux* and macOS*.
This option is OFF if this feature is not supported for the platform.ON|OFF
OFF.OFF|ON
OFF|ON
OFF|ON
/path/to/hwloc/install/dir
hwloc.h in ${LIBOMP_HWLOC_INSTALL_DIR}/include and the library in
${LIBOMP_HWLOC_INSTALL_DIR}/lib. The default is /usr/local.
This option is only used if LIBOMP_USE_HWLOC is ON.These flags are appended, they do not overwrite any of the preset flags.
libomptarget
""
omp.h. This is required for testing
out-of-tree builds.""
libomp.so. This is required for testing
out-of-tree builds.NVPTX device RTL
ON|OFF
""
""
""
Host compiler to use with NVCC. This compiler is not going to be used to produce any binary. Instead, this is used to overcome the input compiler checks done by NVCC. E.g. if using a default host compiler that is not compatible with NVCC, this option can be use to pass to NVCC a valid compiler to avoid the error.
35
OFF|ON
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
$ cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc ..
Build the i386 Linux* library using GCC*
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_ARCH=i386 ..
Build the x86_64 debug Mac library using Clang*
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBOMP_ARCH=x86_64 -DCMAKE_BUILD_TYPE=Debug ..
Build the library (architecture determined by probing compiler) using the Intel(R) C Compiler and the Intel(R) C++ Compiler. Also, create Fortran modules with the Intel(R) Fortran Compiler.
$ cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -DLIBOMP_FORTRAN_MODULES=on ..
Have CMake find the C/C++ compiler and specify additional flags for the C compiler, preprocessor, and C++ compiler.
.. code-blocks:: console $ cmake -DLIBOMP_CFLAGS='-specific-flag' -DLIBOMP_CPPFLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DLIBOMP_CXXFLAGS='--one-specific-flag --two-specific-flag' ..
Build the stubs library
.. code-blocks:: console $ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLIBOMP_LIB_TYPE=stubs ..
Footnotes
| [*] | Other names and brands may be claimed as the property of others. |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。