[Openmp-commits] [openmp] r319341 - [CMake] Disallow direct configuration
Jonas Hahnfeld via Openmp-commits
openmp-commits at lists.llvm.org
Wed Nov 29 11:31:43 PST 2017
Author: hahnfeld
Date: Wed Nov 29 11:31:43 2017
New Revision: 319341
URL: http://llvm.org/viewvc/llvm-project?rev=319341&view=rev
Log:
[CMake] Disallow direct configuration
As a first step, this allows us to generalize the detection of
standalone builds and make it fully compatible when building in
llvm/runtimes/ which automatically sets OPENMP_STANDLONE_BUILD.
Differential Revision: https://reviews.llvm.org/D40080
Modified:
openmp/trunk/CMakeLists.txt
openmp/trunk/libomptarget/Build_With_CMake.txt
openmp/trunk/libomptarget/CMakeLists.txt
openmp/trunk/libomptarget/test/CMakeLists.txt
openmp/trunk/runtime/Build_With_CMake.txt
openmp/trunk/runtime/CMakeLists.txt
openmp/trunk/runtime/src/CMakeLists.txt
openmp/trunk/runtime/test/CMakeLists.txt
openmp/trunk/www/README.txt
openmp/trunk/www/index.html
Modified: openmp/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/CMakeLists.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/CMakeLists.txt (original)
+++ openmp/trunk/CMakeLists.txt Wed Nov 29 11:31:43 2017
@@ -1,6 +1,17 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
-set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing")
+# llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
+if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(OPENMP_STANDALONE_BUILD TRUE)
+ project(openmp C CXX)
+
+ # CMAKE_BUILD_TYPE was not set, default to Release.
+ if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+ endif()
+
+ set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
+endif()
add_subdirectory(runtime)
Modified: openmp/trunk/libomptarget/Build_With_CMake.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/Build_With_CMake.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/libomptarget/Build_With_CMake.txt (original)
+++ openmp/trunk/libomptarget/Build_With_CMake.txt Wed Nov 29 11:31:43 2017
@@ -51,7 +51,7 @@ How to call cmake initially, then repeat
=====================
Instructions to Build
=====================
- $ cd libomptarget_top_level/ [ directory with plugins/ , deviceRTLs/ , etc. ]
+ $ cd openmp_top_level/ [ directory with runtime/, libomptarget/, etc. ]
$ mkdir build
$ cd build
Modified: openmp/trunk/libomptarget/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/CMakeLists.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/libomptarget/CMakeLists.txt (original)
+++ openmp/trunk/libomptarget/CMakeLists.txt Wed Nov 29 11:31:43 2017
@@ -11,28 +11,16 @@
#
##===----------------------------------------------------------------------===##
-# CMAKE libomptarget
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ message(FATAL_ERROR "Direct configuration not supported, please use parent directory!")
+endif()
# Add cmake directory to search for custom cmake functions.
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ${CMAKE_MODULE_PATH})
-# Standalone build or part of LLVM?
-set(LIBOMPTARGET_STANDALONE_BUILD FALSE)
-if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
- "${CMAKE_SOURCE_DIR}/libomptarget" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
- project(libomptarget C CXX)
- set(LIBOMPTARGET_STANDALONE_BUILD TRUE)
-endif()
-
-
-if(${LIBOMPTARGET_STANDALONE_BUILD})
+if(OPENMP_STANDALONE_BUILD)
set(LIBOMPTARGET_ENABLE_WERROR FALSE CACHE BOOL
"Enable -Werror flags to turn warnings into errors for supporting compilers.")
- # CMAKE_BUILD_TYPE was not defined, set default to Release
- if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
- endif()
set(LIBOMPTARGET_LIBDIR_SUFFIX "" CACHE STRING
"suffix of lib installation directory, e.g. 64 => lib64")
Modified: openmp/trunk/libomptarget/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/test/CMakeLists.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/libomptarget/test/CMakeLists.txt (original)
+++ openmp/trunk/libomptarget/test/CMakeLists.txt Wed Nov 29 11:31:43 2017
@@ -16,7 +16,7 @@ else()
set(LIBOMPTARGET_DEBUG False)
endif()
-if(${LIBOMPTARGET_STANDALONE_BUILD})
+if(${OPENMP_STANDALONE_BUILD})
# Make sure we can use the console pool for recent cmake and ninja > 1.5
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
set(cmake_3_2_USES_TERMINAL)
Modified: openmp/trunk/runtime/Build_With_CMake.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/Build_With_CMake.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/runtime/Build_With_CMake.txt (original)
+++ openmp/trunk/runtime/Build_With_CMake.txt Wed Nov 29 11:31:43 2017
@@ -51,7 +51,7 @@ How to call cmake initially, then repeat
=====================
Instructions to Build
=====================
- $ cd libomp_top_level/ [ directory with src/ , exports/ , tools/ , etc. ]
+ $ cd openmp_top_level/ [ directory with runtime/, etc. ]
$ mkdir build
$ cd build
Modified: openmp/trunk/runtime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/CMakeLists.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/runtime/CMakeLists.txt (original)
+++ openmp/trunk/runtime/CMakeLists.txt Wed Nov 29 11:31:43 2017
@@ -9,21 +9,13 @@
#//===----------------------------------------------------------------------===//
#
-# CMAKE libomp
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ message(FATAL_ERROR "Direct configuration not supported, please use parent directory!")
+endif()
# Add cmake directory to search for custom cmake functions
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
-# Standalone build or part of LLVM?
-set(LIBOMP_STANDALONE_BUILD FALSE)
-if(OPENMP_STANDALONE_BUILD OR
- "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}" OR
- "${CMAKE_SOURCE_DIR}/runtime" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
- project(libomp C CXX)
- set(LIBOMP_STANDALONE_BUILD TRUE)
-endif()
-
# Set libomp version
set(LIBOMP_VERSION_MAJOR 5)
set(LIBOMP_VERSION_MINOR 0)
@@ -35,7 +27,7 @@ include(LibompHandleFlags)
include(LibompDefinitions)
# Determine the target architecture
-if(${LIBOMP_STANDALONE_BUILD})
+if(${OPENMP_STANDALONE_BUILD})
# If adding a new architecture, take a look at cmake/LibompGetArchitecture.cmake
libomp_get_architecture(LIBOMP_DETECTED_ARCH)
set(LIBOMP_ARCH ${LIBOMP_DETECTED_ARCH} CACHE STRING
@@ -48,10 +40,6 @@ if(${LIBOMP_STANDALONE_BUILD})
"enable assertions?")
set(LIBOMP_ENABLE_WERROR FALSE CACHE BOOL
"Enable -Werror flags to turn warnings into errors for supporting compilers.")
- # CMAKE_BUILD_TYPE was not defined, set default to Release
- if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
- endif()
else() # Part of LLVM build
# Determine the native architecture from LLVM.
string(TOLOWER "${LLVM_TARGET_ARCH}" LIBOMP_NATIVE_ARCH)
@@ -372,7 +360,7 @@ set(LIBOMP_INSTALL_ALIASES TRUE CACHE BO
"Install libgomp and libiomp5 library aliases for backwards compatibility")
# Print configuration after all variables are set.
-if(${LIBOMP_STANDALONE_BUILD})
+if(${OPENMP_STANDALONE_BUILD})
libomp_say("Operating System -- ${CMAKE_SYSTEM_NAME}")
libomp_say("Target Architecture -- ${LIBOMP_ARCH}")
if(${MIC})
Modified: openmp/trunk/runtime/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/CMakeLists.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/runtime/src/CMakeLists.txt (original)
+++ openmp/trunk/runtime/src/CMakeLists.txt Wed Nov 29 11:31:43 2017
@@ -282,7 +282,7 @@ add_dependencies(libomp-micro-tests libo
# Install rules
# We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib
# We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
-if(${LIBOMP_STANDALONE_BUILD})
+if(${OPENMP_STANDALONE_BUILD})
set(LIBOMP_HEADERS_INSTALL_PATH include)
else()
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
Modified: openmp/trunk/runtime/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/CMakeLists.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/runtime/test/CMakeLists.txt (original)
+++ openmp/trunk/runtime/test/CMakeLists.txt Wed Nov 29 11:31:43 2017
@@ -41,7 +41,7 @@ pythonize_bool(LIBOMP_HAVE_LIBATOMIC)
set(LIBOMP_TEST_CFLAGS "" CACHE STRING
"Extra compiler flags to send to the test compiler")
-if(${LIBOMP_STANDALONE_BUILD})
+if(${OPENMP_STANDALONE_BUILD})
# Make sure we can use the console pool for recent cmake and ninja > 1.5
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
set(cmake_3_2_USES_TERMINAL)
Modified: openmp/trunk/www/README.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/www/README.txt?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/www/README.txt (original)
+++ openmp/trunk/www/README.txt Wed Nov 29 11:31:43 2017
@@ -36,7 +36,7 @@ Out-of-tree build:
$ cd where-you-want-to-live
Check out openmp
-$ cd where-you-want-to-live/openmp/runtime
+$ cd where-you-want-to-live/openmp
$ mkdir build && cd build
$ cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler>
$ make
Modified: openmp/trunk/www/index.html
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/www/index.html?rev=319341&r1=319340&r2=319341&view=diff
==============================================================================
--- openmp/trunk/www/index.html (original)
+++ openmp/trunk/www/index.html Wed Nov 29 11:31:43 2017
@@ -183,7 +183,7 @@
<ul>
<li><code>cd where-you-want-to-live</code></li>
<li>Check out openmp</li>
- <li><code>cd where-you-want-to-live/openmp/runtime</code></li>
+ <li><code>cd where-you-want-to-live/openmp</code></li>
<li><code>mkdir build && cd build</code></li>
<li><code>cmake path/to/openmp -DCMAKE_C_COMPILER=<C compiler> -DCMAKE_CXX_COMPILER=<C++ compiler></code></li>
<li><code>make</code></li>
More information about the Openmp-commits
mailing list