[compiler-rt] r334570 - Reland "Passthrough additional flags to custom libcxx CMake build"
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 22:32:22 PDT 2018
Author: phosek
Date: Tue Jun 12 22:32:22 2018
New Revision: 334570
URL: http://llvm.org/viewvc/llvm-project?rev=334570&view=rev
Log:
Reland "Passthrough additional flags to custom libcxx CMake build"
This is needed when we're cross-compiling compiler-rt.
Differential Revision: https://reviews.llvm.org/D47834
Modified:
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
compiler-rt/trunk/lib/fuzzer/CMakeLists.txt
Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=334570&r1=334569&r2=334570&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Tue Jun 12 22:32:22 2018
@@ -474,11 +474,6 @@ macro(add_custom_libcxx name prefix)
endif()
cmake_parse_arguments(LIBCXX "USE_TOOLCHAIN" "" "DEPS;CFLAGS;CMAKE_ARGS" ${ARGN})
- foreach(flag ${LIBCXX_CFLAGS})
- set(flagstr "${flagstr} ${flag}")
- endforeach()
- set(LIBCXX_C_FLAGS ${flagstr})
- set(LIBCXX_CXX_FLAGS ${flagstr})
if(LIBCXX_USE_TOOLCHAIN)
set(compiler_args -DCMAKE_C_COMPILER=${COMPILER_RT_TEST_COMPILER}
@@ -514,9 +509,29 @@ macro(add_custom_libcxx name prefix)
add_custom_target(${name}-clobber
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${name}-clobber-stamp)
- if(CMAKE_SYSROOT)
- set(sysroot_arg -DCMAKE_SYSROOT=${CMAKE_SYSROOT})
- endif()
+ set(PASSTHROUGH_VARIABLES
+ CMAKE_C_COMPILER_TARGET
+ CMAKE_CXX_COMPILER_TARGET
+ CMAKE_INSTALL_PREFIX
+ CMAKE_MAKE_PROGRAM
+ CMAKE_LINKER
+ CMAKE_AR
+ CMAKE_RANLIB
+ CMAKE_NM
+ CMAKE_OBJCOPY
+ CMAKE_OBJDUMP
+ CMAKE_STRIP
+ CMAKE_SYSROOT
+ CMAKE_SYSTEM_NAME)
+ foreach(variable ${PASSTHROUGH_VARIABLES})
+ if(${variable})
+ list(APPEND CMAKE_PASSTHROUGH_VARIABLES -D${variable}=${${variable}})
+ endif()
+ endforeach()
+
+ string(REPLACE ";" " " FLAGS_STRING "${LIBCXX_CFLAGS}")
+ set(LIBCXX_C_FLAGS "${FLAGS_STRING}")
+ set(LIBCXX_CXX_FLAGS "${FLAGS_STRING}")
ExternalProject_Add(${name}
DEPENDS ${name}-clobber ${LIBCXX_DEPS}
@@ -524,13 +539,11 @@ macro(add_custom_libcxx name prefix)
SOURCE_DIR ${COMPILER_RT_LIBCXX_PATH}
STAMP_DIR ${STAMP_DIR}
BINARY_DIR ${BINARY_DIR}
- CMAKE_ARGS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
+ CMAKE_ARGS ${CMAKE_PASSTHROUGH_VARIABLES}
${compiler_args}
- ${sysroot_arg}
-DCMAKE_C_FLAGS=${LIBCXX_C_FLAGS}
-DCMAKE_CXX_FLAGS=${LIBCXX_CXX_FLAGS}
-DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DLLVM_PATH=${LLVM_MAIN_SRC_DIR}
-DLLVM_BINARY_DIR=${prefix}
-DLLVM_LIBRARY_OUTPUT_INTDIR=${prefix}/lib
Modified: compiler-rt/trunk/lib/fuzzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/CMakeLists.txt?rev=334570&r1=334569&r2=334570&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/fuzzer/CMakeLists.txt Tue Jun 12 22:32:22 2018
@@ -105,6 +105,7 @@ if(OS_NAME MATCHES "Linux|Fuchsia" AND C
-fvisibility=hidden
CMAKE_ARGS -DCMAKE_CXX_COMPILER_WORKS=ON
-DLIBCXX_ENABLE_EXCEPTIONS=OFF
+ -DLIBCXX_ENABLE_SHARED=OFF
-DLIBCXX_CXX_ABI=none)
target_compile_options(RTfuzzer.${arch} PRIVATE -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1)
add_dependencies(RTfuzzer.${arch} libcxx_fuzzer_${arch}-build)
More information about the llvm-commits
mailing list