[libcxx] r228005 - Don't assume LIT_EXECUTABLE points to a Python script, take 2

Jonathan Roelofs jroelofs.lists at gmail.com
Tue Feb 3 11:06:37 PST 2015


I think most of the complexity here would go away if we instead used 
add_lit_testsuite as libcxxabi does.


Jon

On 2/3/15 11:47 AM, Greg Fitzgerald wrote:
> Author: garious
> Date: Tue Feb  3 12:47:37 2015
> New Revision: 228005
>
> URL: http://llvm.org/viewvc/llvm-project?rev=228005&view=rev
> Log:
> Don't assume LIT_EXECUTABLE points to a Python script, take 2
>
> Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
> to a Python script, not an executable.  If you were to pass in an
> executable, such as the result of py2exe on lit.py, the build would
> fall over.
>
> With this patch, the CMake build assumes LIT_EXECUTABLE is an
> executable.  You can continue setting it to lit.py, but it will
> now use its shebang to find a Python interpreter.
>
> Differential Revision: http://reviews.llvm.org/D7315
>
> Modified:
>      libcxx/trunk/test/CMakeLists.txt
>
> Modified: libcxx/trunk/test/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=228005&r1=228004&r2=228005&view=diff
> ==============================================================================
> --- libcxx/trunk/test/CMakeLists.txt (original)
> +++ libcxx/trunk/test/CMakeLists.txt Tue Feb  3 12:47:37 2015
> @@ -6,20 +6,26 @@ macro(pythonize_bool var)
>     endif()
>   endmacro()
>
> -include(FindPythonInterp)
> -if(PYTHONINTERP_FOUND)
> -  if(LIBCXX_BUILT_STANDALONE)
> -    set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's lit.py.")
> -    # 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)
> -    else()
> -      set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
> -    endif()
> +set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's llvm-lit.")
> +
> +if(LIBCXX_BUILT_STANDALONE)
> +  # 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)
>     else()
> -    set(LIT_EXECUTABLE "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
> +    set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
>     endif()
> +else()
> +  include(FindPythonInterp)
> +  if(PYTHONINTERP_FOUND)
> +    set(LIT_EXECUTABLE
> +        ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/lit/lit.py)
> +  else()
> +    message(WARNING "Could not find Python, cannot set LIT_EXECUTABLE.")
> +  endif()
> +endif()
>
> +if (LIT_EXECUTABLE)
>     set(LIT_ARGS_DEFAULT "-sv --show-unsupported --show-xfail")
>     if (MSVC OR XCODE)
>       set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
> @@ -47,13 +53,13 @@ if(PYTHONINTERP_FOUND)
>       @ONLY)
>
>     add_custom_target(check-libcxx
> -    COMMAND ${PYTHON_EXECUTABLE}
> -            ${LIT_EXECUTABLE}
> +    COMMAND ${LIT_EXECUTABLE}
>               ${LIT_ARGS}
>               ${CMAKE_CURRENT_BINARY_DIR}
>       DEPENDS cxx
>       COMMENT "Running libcxx tests"
>       ${cmake_3_2_USES_TERMINAL})
>   else()
> -  message(WARNING "Could not find Python, no check target will be available!")
> +  message(WARNING
> +          "LIT_EXECUTABLE not set, no check-libcxx target will be available!")
>   endif()
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the cfe-commits mailing list