Add support for building libc++ as a 32 bit library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224096 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
01f6a1410c
commit
ae9fec0bdf
@ -43,6 +43,7 @@ option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
|||||||
option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
|
option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
|
||||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||||
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
|
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
|
||||||
|
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++" OFF)
|
||||||
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
||||||
"Build libc++ with support for a monotonic clock.
|
"Build libc++ with support for a monotonic clock.
|
||||||
This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
|
This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
|
||||||
@ -205,6 +206,14 @@ if (NOT LIBCXX_ENABLE_SHARED)
|
|||||||
list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
|
list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
||||||
|
if (LIBCXX_BUILD_32_BITS)
|
||||||
|
message(STATUS "Building 32 bits executables and libraries.")
|
||||||
|
list(APPEND LIBCXX_CXX_FLAGS "-m32")
|
||||||
|
endif()
|
||||||
|
elseif(LIBCXX_BUILD_32_BITS)
|
||||||
|
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
||||||
|
endif()
|
||||||
# This is the _ONLY_ place where add_definitions is called.
|
# This is the _ONLY_ place where add_definitions is called.
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
@ -30,6 +30,7 @@ if(PYTHONINTERP_FOUND)
|
|||||||
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
|
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
|
||||||
pythonize_bool(LIBCXX_ENABLE_RTTI)
|
pythonize_bool(LIBCXX_ENABLE_RTTI)
|
||||||
pythonize_bool(LIBCXX_ENABLE_SHARED)
|
pythonize_bool(LIBCXX_ENABLE_SHARED)
|
||||||
|
pythonize_bool(LIBCXX_BUILD_32_BITS)
|
||||||
pythonize_bool(LIBCXX_ENABLE_THREADS)
|
pythonize_bool(LIBCXX_ENABLE_THREADS)
|
||||||
pythonize_bool(LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
pythonize_bool(LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
||||||
|
|
||||||
|
@ -436,6 +436,9 @@ class Configuration(object):
|
|||||||
self.config.available_features.add('rtti')
|
self.config.available_features.add('rtti')
|
||||||
else:
|
else:
|
||||||
self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
|
self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
|
||||||
|
enable_32bit = self.get_lit_bool('enable_32bit', False)
|
||||||
|
if enable_32bit:
|
||||||
|
self.compile_flags += ['-m32']
|
||||||
# Configure threading features.
|
# Configure threading features.
|
||||||
enable_threads = self.get_lit_bool('enable_threads', True)
|
enable_threads = self.get_lit_bool('enable_threads', True)
|
||||||
enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock', True)
|
enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock', True)
|
||||||
|
@ -7,6 +7,7 @@ config.python_executable = "@PYTHON_EXECUTABLE@"
|
|||||||
config.enable_exceptions = "@LIBCXX_ENABLE_EXCEPTIONS@"
|
config.enable_exceptions = "@LIBCXX_ENABLE_EXCEPTIONS@"
|
||||||
config.enable_rtti = "@LIBCXX_ENABLE_RTTI@"
|
config.enable_rtti = "@LIBCXX_ENABLE_RTTI@"
|
||||||
config.enable_shared = "@LIBCXX_ENABLE_SHARED@"
|
config.enable_shared = "@LIBCXX_ENABLE_SHARED@"
|
||||||
|
config.enable_32bit = "@LIBCXX_BUILD_32_BITS@"
|
||||||
config.enable_threads = "@LIBCXX_ENABLE_THREADS@"
|
config.enable_threads = "@LIBCXX_ENABLE_THREADS@"
|
||||||
config.enable_monotonic_clock = "@LIBCXX_ENABLE_MONOTONIC_CLOCK@"
|
config.enable_monotonic_clock = "@LIBCXX_ENABLE_MONOTONIC_CLOCK@"
|
||||||
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
|
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user