[libcxx] r174623 - Michael van der Westhuizen: The attached patch add support for building against libc++abi and libcxxrt to CMake builds of libc++.
Michael van der Westhuizen
r1mikey at gmail.com
Fri Feb 8 02:32:09 PST 2013
Please use this corrected patch instead.
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcxx-use-macros-for-abi-library-setup.patch
Type: application/octet-stream
Size: 7708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130208/4a2db1e3/attachment.obj>
-------------- next part --------------
On 08 Feb 2013, at 12:04 PM, Michael van der Westhuizen <r1mikey at gmail.com> wrote:
> Here's a patch against the current state of the repository to implement this macro.
>
> Michael
>
> <libcxx-use-macros-for-abi-library-setup.patch>
>
> On 07 Feb 2013, at 9:52 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
>
>> On Thu, Feb 7, 2013 at 7:27 AM, Howard Hinnant <hhinnant at apple.com> wrote:
>>> Author: hhinnant
>>> Date: Thu Feb 7 09:27:39 2013
>>> New Revision: 174623
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=174623&view=rev
>>> Log:
>>> Michael van der Westhuizen: The attached patch add support for building against libc++abi and libcxxrt to CMake builds of libc++.
>>>
>>> Usage (with the appropriate CC and CXX environment variables) is:
>>> $ cmake -DLIBCXX_CXX_ABI=libcxxabi '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=/home/michael/libcxxabi/include' ../libcxx
>>> and:
>>> $ cmake -DLIBCXX_CXX_ABI=libcxxrt '-DLIBCXX_LIBCXXRT_INCLUDE_PATHS=/home/michael/libcxxrt/src' ../libcxx
>>>
>>> Modified:
>>> libcxx/trunk/CMakeLists.txt
>>> libcxx/trunk/include/__split_buffer
>>> libcxx/trunk/include/functional
>>> libcxx/trunk/include/string
>>> libcxx/trunk/include/vector
>>>
>>> Modified: libcxx/trunk/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=174623&r1=174622&r2=174623&view=diff
>>> ==============================================================================
>>> --- libcxx/trunk/CMakeLists.txt (original)
>>> +++ libcxx/trunk/CMakeLists.txt Thu Feb 7 09:27:39 2013
>>> @@ -114,6 +114,89 @@ if ("${LIBCXX_CXX_ABI}" STREQUAL "libsup
>>> FILES_MATCHING
>>> PATTERN "*"
>>> )
>>> +elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
>>> + set(LIBCXX_LIBCXXABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDE_PATHS}"
>>> + CACHE STRINGS
>>> + "Paths to libc++abi include directories separate by ';'.")
>>> + set(LIBCXX_CXX_ABI_LIBRARIES c++abi)
>>> + set(LIBCXX_LIBCXXABI_FILES
>>> + cxxabi.h
>>> + cxa_demangle.h
>>> + )
>>> + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
>>> + set(LIBCXX_LIBCXXABI_FILE_PATHS)
>>> + foreach(path ${LIBCXX_LIBCXXABI_FILES})
>>> + set(found FALSE)
>>> + foreach(incpath ${LIBCXX_LIBCXXABI_INCLUDE_PATHS})
>>> + if (EXISTS "${incpath}/${path}")
>>> + set(found TRUE)
>>> + get_filename_component(file ${path} NAME)
>>> + add_custom_command(
>>> + OUTPUT "${CMAKE_BINARY_DIR}/include/${file}"
>>> + COMMAND ${CMAKE_COMMAND} -E copy_if_different
>>> + "${incpath}/${path}"
>>> + "${CMAKE_BINARY_DIR}/include"
>>> + MAIN_DEPENDENCY "${incpath}/${path}"
>>> + )
>>> + list(APPEND LIBCXX_CXX_ABI_DEPS
>>> + "${CMAKE_BINARY_DIR}/include/${file}")
>>> + endif()
>>> + endforeach()
>>> + if (NOT found)
>>> + message(FATAL_ERROR "Failed to find ${path}")
>>> + endif()
>>> + endforeach()
>>> + add_custom_target(cxxabi_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
>>> + set(LIBCXX_CXX_ABI_DEPS cxxabi_headers)
>>> + include_directories("${CMAKE_BINARY_DIR}/include")
>>> + install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
>>> + DESTINATION include/c++/v1
>>> + FILES_MATCHING
>>> + PATTERN "*"
>>> + )
>>> +elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
>>> + set(LIBCXX_LIBCXXRT_INCLUDE_PATHS "${LIBCXX_LIBCXXRT_INCLUDE_PATHS}"
>>> + CACHE STRINGS
>>> + "Paths to libcxxrt include directories separate by ';'.")
>>> + set(LIBCXX_CXX_ABI_LIBRARIES cxxrt)
>>> + set(LIBCXX_LIBCXXRT_FILES
>>> + cxxabi.h
>>> + unwind.h
>>> + unwind-arm.h
>>> + unwind-itanium.h
>>> + )
>>> + file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
>>> + set(LIBCXX_LIBCXXRT_FILE_PATHS)
>>> + foreach(path ${LIBCXX_LIBCXXRT_FILES})
>>> + set(found FALSE)
>>> + foreach(incpath ${LIBCXX_LIBCXXRT_INCLUDE_PATHS})
>>> + if (EXISTS "${incpath}/${path}")
>>> + set(found TRUE)
>>> + get_filename_component(file ${path} NAME)
>>> + add_custom_command(
>>> + OUTPUT "${CMAKE_BINARY_DIR}/include/${file}"
>>> + COMMAND ${CMAKE_COMMAND} -E copy_if_different
>>> + "${incpath}/${path}"
>>> + "${CMAKE_BINARY_DIR}/include"
>>> + MAIN_DEPENDENCY "${incpath}/${path}"
>>> + )
>>> + list(APPEND LIBCXX_CXX_ABI_DEPS
>>> + "${CMAKE_BINARY_DIR}/include/${file}")
>>> + endif()
>>> + endforeach()
>>> + if (NOT found)
>>> + message(FATAL_ERROR "Failed to find ${path}")
>>> + endif()
>>> + endforeach()
>>> + add_custom_target(cxxrt_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
>>> + set(LIBCXX_CXX_ABI_DEPS cxxrt_headers)
>>> + include_directories("${CMAKE_BINARY_DIR}/include")
>>> + install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
>>> + DESTINATION include/c++/v1
>>> + FILES_MATCHING
>>> + PATTERN "*"
>>> + )
>>> + list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DLIBCXXRT)
>>> elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
>>> message(FATAL_ERROR
>>> "Currently only none and libsupc++ are supported for c++ abi.")
>>>
>>
>> This should go into a function/macro, as it's pretty much identical
>> between the supported ABIs.
>>
>> - Michael Spencer
>
More information about the cfe-commits
mailing list