[Openmp-commits] [openmp] r356998 - [libomptarget] Introduce LIBOMPTARGET_ENABLE_DEBUG cmake option.
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Tue Mar 26 08:19:16 PDT 2019
Author: meinersbur
Date: Tue Mar 26 08:19:15 2019
New Revision: 356998
URL: http://llvm.org/viewvc/llvm-project?rev=356998&view=rev
Log:
[libomptarget] Introduce LIBOMPTARGET_ENABLE_DEBUG cmake option.
At the moment, support for runtime debug output using the
OMPTARGET_DEBUG=1 environment variable is only available with
CMAKE_BUILD_TYPE=Debug builds. The patch allows setting it independently
using the LIBOMPTARGET_ENABLE_DEBUG option, which is enabled by default
depending on CMAKE_BUILD_TYPE. That is, unless this option is set
explicitly, nothing changes. This is the same mechanism used by LLVM for
LLVM_ENABLE_ASSERTIONS.
This patch also removes adding -g -O0 in debug builds, it should be
handled by cmake's CMAKE_{C|CXX}_FLAGS_DEBUG configuration option.
Idea by Hal Finkel
Differential Revision: https://reviews.llvm.org/D55952
Modified:
openmp/trunk/libomptarget/CMakeLists.txt
openmp/trunk/libomptarget/test/CMakeLists.txt
Modified: openmp/trunk/libomptarget/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/CMakeLists.txt?rev=356998&r1=356997&r2=356998&view=diff
==============================================================================
--- openmp/trunk/libomptarget/CMakeLists.txt (original)
+++ openmp/trunk/libomptarget/CMakeLists.txt Tue Mar 26 08:19:15 2019
@@ -40,13 +40,17 @@ set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPT
# the list of supported targets in the current system.
set (LIBOMPTARGET_SYSTEM_TARGETS "")
-# If building this library in debug mode, we define a macro to enable
-# dumping progress messages at runtime.
+# Check whether using debug mode. In debug mode, allow dumping progress
+# messages at runtime by default. Otherwise, it can be enabled
+# independently using the LIBOMPTARGET_ENABLE_DEBUG option.
string( TOLOWER "${CMAKE_BUILD_TYPE}" LIBOMPTARGET_CMAKE_BUILD_TYPE)
if(LIBOMPTARGET_CMAKE_BUILD_TYPE MATCHES debug)
+ option(LIBOMPTARGET_ENABLE_DEBUG "Allow debug output with the environment variable LIBOMPTARGET_DEBUG=1" ON)
+else()
+ option(LIBOMPTARGET_ENABLE_DEBUG "Allow debug output with the environment variable LIBOMPTARGET_DEBUG=1" OFF)
+endif()
+if(LIBOMPTARGET_ENABLE_DEBUG)
add_definitions(-DOMPTARGET_DEBUG)
- add_definitions(-g)
- add_definitions(-O0)
endif()
include_directories(include)
Modified: openmp/trunk/libomptarget/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/test/CMakeLists.txt?rev=356998&r1=356997&r2=356998&view=diff
==============================================================================
--- openmp/trunk/libomptarget/test/CMakeLists.txt (original)
+++ openmp/trunk/libomptarget/test/CMakeLists.txt Tue Mar 26 08:19:15 2019
@@ -6,7 +6,7 @@ if(NOT OPENMP_TEST_COMPILER_ID STREQUAL
return()
endif()
-if(LIBOMPTARGET_CMAKE_BUILD_TYPE MATCHES debug)
+if(LIBOMPTARGET_ENABLE_DEBUG)
set(LIBOMPTARGET_DEBUG True)
else()
set(LIBOMPTARGET_DEBUG False)
More information about the Openmp-commits
mailing list