[CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER
Given that LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_C_COMPILER are both set at configuration time, I don't really see the point of having both. This patch simplifies things and uses the custom C/C++ compiler when the variable is set, and uses the default one when it's not set. The variable can be unset by passing -ULLDB_TEST_C_COMPILER to CMake. Differential revision: https://reviews.llvm.org/D66429 llvm-svn: 369435
This commit is contained in:
		
							parent
							
								
									3a2b08e6c9
								
							
						
					
					
						commit
						8509b0a778
					
				| 
						 | 
					@ -70,8 +70,6 @@ add_subdirectory(tools)
 | 
				
			||||||
add_subdirectory(docs)
 | 
					add_subdirectory(docs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
 | 
					option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
 | 
				
			||||||
option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
 | 
					 | 
				
			||||||
option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
 | 
					 | 
				
			||||||
if(LLDB_INCLUDE_TESTS)
 | 
					if(LLDB_INCLUDE_TESTS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Set the path to the default lldb test executable.
 | 
					  # Set the path to the default lldb test executable.
 | 
				
			||||||
| 
						 | 
					@ -81,15 +79,11 @@ if(LLDB_INCLUDE_TESTS)
 | 
				
			||||||
  set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
 | 
					  set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
 | 
				
			||||||
  set(LLDB_DEFAULT_TEST_FILECHECK "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 | 
					  set(LLDB_DEFAULT_TEST_FILECHECK "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang)
 | 
					  if (TARGET clang)
 | 
				
			||||||
    set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
 | 
					    set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
 | 
				
			||||||
  else()
 | 
					 | 
				
			||||||
    set(LLDB_DEFAULT_TEST_C_COMPILER "")
 | 
					 | 
				
			||||||
  endif()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER AND TARGET clang)
 | 
					 | 
				
			||||||
    set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
 | 
					    set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
 | 
				
			||||||
  else()
 | 
					  else()
 | 
				
			||||||
 | 
					    set(LLDB_DEFAULT_TEST_C_COMPILER "")
 | 
				
			||||||
    set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
 | 
					    set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
 | 
				
			||||||
  endif()
 | 
					  endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,7 +95,7 @@ if(LLDB_INCLUDE_TESTS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
 | 
					  if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
 | 
				
			||||||
      ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
 | 
					      ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
 | 
				
			||||||
    message(FATAL_ERROR "LLDB test compilers not specified.  Tests will not run")
 | 
					    message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run.")
 | 
				
			||||||
  endif()
 | 
					  endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set(LLDB_TEST_DEPS lldb)
 | 
					  set(LLDB_TEST_DEPS lldb)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -185,8 +185,6 @@ suite.
 | 
				
			||||||
::
 | 
					::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  > cmake -G Ninja \
 | 
					  > cmake -G Ninja \
 | 
				
			||||||
      -DLLDB_TEST_USE_CUSTOM_C_COMPILER=On \
 | 
					 | 
				
			||||||
      -DLLDB_TEST_USE_CUSTOM_CXX_COMPILER=On \
 | 
					 | 
				
			||||||
      -DLLDB_TEST_C_COMPILER=<path to C compiler> \
 | 
					      -DLLDB_TEST_C_COMPILER=<path to C compiler> \
 | 
				
			||||||
      -DLLDB_TEST_CXX_COMPILER=<path to C++ compiler> \
 | 
					      -DLLDB_TEST_CXX_COMPILER=<path to C++ compiler> \
 | 
				
			||||||
      <path to root of llvm source tree>
 | 
					      <path to root of llvm source tree>
 | 
				
			||||||
| 
						 | 
					@ -228,7 +226,6 @@ Sample command line:
 | 
				
			||||||
  > cmake -G Ninja^
 | 
					  > cmake -G Ninja^
 | 
				
			||||||
      -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
 | 
					      -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
 | 
				
			||||||
      -DPYTHON_HOME=C:\Python35^
 | 
					      -DPYTHON_HOME=C:\Python35^
 | 
				
			||||||
      -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON^
 | 
					 | 
				
			||||||
      -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
 | 
					      -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
 | 
				
			||||||
      <path to root of llvm source tree>
 | 
					      <path to root of llvm source tree>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,9 +30,7 @@ target.
 | 
				
			||||||
By default, the ``check-lldb`` target builds the test programs with the same
 | 
					By default, the ``check-lldb`` target builds the test programs with the same
 | 
				
			||||||
compiler that was used to build LLDB. To build the tests with a different
 | 
					compiler that was used to build LLDB. To build the tests with a different
 | 
				
			||||||
compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
 | 
					compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
 | 
				
			||||||
``LLDB_TEST_CXX_COMPILER`` CMake variables. These variables are ignored unless
 | 
					``LLDB_TEST_CXX_COMPILER`` CMake variables.
 | 
				
			||||||
the respective ``LLDB_TEST_USE_CUSTOM_C_COMPILER`` and
 | 
					 | 
				
			||||||
``LLDB_TEST_USE_CUSTOM_CXX_COMPILER`` are set to ``ON``.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
It is possible to customize the architecture of the test binaries and compiler
 | 
					It is possible to customize the architecture of the test binaries and compiler
 | 
				
			||||||
used by appending ``-A`` and ``-C`` options respectively to the CMake variable
 | 
					used by appending ``-A`` and ``-C`` options respectively to the CMake variable
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue