summaryrefslogtreecommitdiff
path: root/absl/copts
diff options
context:
space:
mode:
Diffstat (limited to 'absl/copts')
-rw-r--r--absl/copts/AbseilConfigureCopts.cmake40
-rw-r--r--absl/copts/GENERATED_AbseilCopts.cmake25
-rw-r--r--absl/copts/GENERATED_copts.bzl25
-rw-r--r--absl/copts/configure_copts.bzl15
-rw-r--r--absl/copts/copts.py20
5 files changed, 34 insertions, 91 deletions
diff --git a/absl/copts/AbseilConfigureCopts.cmake b/absl/copts/AbseilConfigureCopts.cmake
index 4ece4c6f..77d4ace8 100644
--- a/absl/copts/AbseilConfigureCopts.cmake
+++ b/absl/copts/AbseilConfigureCopts.cmake
@@ -5,25 +5,46 @@ set(ABSL_LSAN_LINKOPTS "")
set(ABSL_HAVE_LSAN OFF)
set(ABSL_DEFAULT_LINKOPTS "")
+if (BUILD_SHARED_LIBS AND MSVC)
+ set(ABSL_BUILD_DLL TRUE)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+else()
+ set(ABSL_BUILD_DLL FALSE)
+endif()
+
+if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
+ if (MSVC)
+ set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_MSVC_X64_FLAGS}")
+ else()
+ set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_X64_FLAGS}")
+ endif()
+elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm.*|aarch64")
+ if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_ARM64_FLAGS}")
+ elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
+ set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_ARM32_FLAGS}")
+ else()
+ message(WARNING "Value of CMAKE_SIZEOF_VOID_P (${CMAKE_SIZEOF_VOID_P}) is not supported.")
+ endif()
+else()
+ message(WARNING "Value of CMAKE_SYSTEM_PROCESSOR (${CMAKE_SYSTEM_PROCESSOR}) is unknown and cannot be used to set ABSL_RANDOM_RANDEN_COPTS")
+ set(ABSL_RANDOM_RANDEN_COPTS "")
+endif()
+
+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(ABSL_DEFAULT_COPTS "${ABSL_GCC_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_GCC_FLAGS};${ABSL_GCC_TEST_FLAGS}")
- set(ABSL_EXCEPTIONS_FLAG "${ABSL_GCC_EXCEPTIONS_FLAGS}")
- set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_X64_FLAGS}")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# MATCHES so we get both Clang and AppleClang
if(MSVC)
# clang-cl is half MSVC, half LLVM
set(ABSL_DEFAULT_COPTS "${ABSL_CLANG_CL_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_CLANG_CL_FLAGS};${ABSL_CLANG_CL_TEST_FLAGS}")
- set(ABSL_EXCEPTIONS_FLAG "${ABSL_CLANG_CL_EXCEPTIONS_FLAGS}")
set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
- set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_MSVC_X64_FLAGS}")
else()
set(ABSL_DEFAULT_COPTS "${ABSL_LLVM_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_LLVM_FLAGS};${ABSL_LLVM_TEST_FLAGS}")
- set(ABSL_EXCEPTIONS_FLAG "${ABSL_LLVM_EXCEPTIONS_FLAGS}")
- set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_X64_FLAGS}")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# AppleClang doesn't have lsan
# https://developer.apple.com/documentation/code_diagnostics
@@ -36,20 +57,13 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(ABSL_DEFAULT_COPTS "${ABSL_MSVC_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_MSVC_FLAGS};${ABSL_MSVC_TEST_FLAGS}")
- set(ABSL_EXCEPTIONS_FLAG "${ABSL_MSVC_EXCEPTIONS_FLAGS}")
set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
- set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_MSVC_X64_FLAGS}")
else()
message(WARNING "Unknown compiler: ${CMAKE_CXX_COMPILER}. Building with no default flags")
set(ABSL_DEFAULT_COPTS "")
set(ABSL_TEST_COPTS "")
- set(ABSL_EXCEPTIONS_FLAG "")
- set(ABSL_RANDOM_RANDEN_COPTS "")
endif()
-# This flag is used internally for Bazel builds and is kept here for consistency
-set(ABSL_EXCEPTIONS_FLAG_LINKOPTS "")
-
if("${CMAKE_CXX_STANDARD}" EQUAL 98)
message(FATAL_ERROR "Abseil requires at least C++11")
elseif(NOT "${CMAKE_CXX_STANDARD}")
diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
index 01bd40b2..7ef6339b 100644
--- a/absl/copts/GENERATED_AbseilCopts.cmake
+++ b/absl/copts/GENERATED_AbseilCopts.cmake
@@ -3,12 +3,6 @@
# (1) Edit absl/copts/copts.py.
# (2) Run `python <path_to_absl>/copts/generate_copts.py`.
-list(APPEND ABSL_CLANG_CL_EXCEPTIONS_FLAGS
- "/U_HAS_EXCEPTIONS"
- "/D_HAS_EXCEPTIONS=1"
- "/EHsc"
-)
-
list(APPEND ABSL_CLANG_CL_FLAGS
"/W3"
"-Wno-c++98-compat-pedantic"
@@ -29,7 +23,6 @@ list(APPEND ABSL_CLANG_CL_FLAGS
"-Wno-gcc-compat"
"-Wno-global-constructors"
"-Wno-exit-time-destructors"
- "-Wno-nested-anon-types"
"-Wno-non-modular-include-in-module"
"-Wno-old-style-cast"
"-Wno-range-loop-analysis"
@@ -80,10 +73,6 @@ list(APPEND ABSL_CLANG_CL_TEST_FLAGS
"-Wno-gnu-zero-variadic-macro-arguments"
)
-list(APPEND ABSL_GCC_EXCEPTIONS_FLAGS
- "-fexceptions"
-)
-
list(APPEND ABSL_GCC_FLAGS
"-Wall"
"-Wextra"
@@ -111,10 +100,6 @@ list(APPEND ABSL_GCC_TEST_FLAGS
"-Wno-unused-private-field"
)
-list(APPEND ABSL_LLVM_EXCEPTIONS_FLAGS
- "-fexceptions"
-)
-
list(APPEND ABSL_LLVM_FLAGS
"-Wall"
"-Wextra"
@@ -137,7 +122,6 @@ list(APPEND ABSL_LLVM_FLAGS
"-Wno-gcc-compat"
"-Wno-global-constructors"
"-Wno-exit-time-destructors"
- "-Wno-nested-anon-types"
"-Wno-non-modular-include-in-module"
"-Wno-old-style-cast"
"-Wno-range-loop-analysis"
@@ -183,12 +167,6 @@ list(APPEND ABSL_LLVM_TEST_FLAGS
"-Wno-gnu-zero-variadic-macro-arguments"
)
-list(APPEND ABSL_MSVC_EXCEPTIONS_FLAGS
- "/U_HAS_EXCEPTIONS"
- "/D_HAS_EXCEPTIONS=1"
- "/EHsc"
-)
-
list(APPEND ABSL_MSVC_FLAGS
"/W3"
"/DNOMINMAX"
@@ -196,6 +174,7 @@ list(APPEND ABSL_MSVC_FLAGS
"/D_CRT_SECURE_NO_WARNINGS"
"/D_SCL_SECURE_NO_WARNINGS"
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE"
+ "/bigobj"
"/wd4005"
"/wd4068"
"/wd4180"
@@ -226,8 +205,6 @@ list(APPEND ABSL_RANDOM_HWAES_ARM64_FLAGS
)
list(APPEND ABSL_RANDOM_HWAES_MSVC_X64_FLAGS
- "/O2"
- "/Ob2"
)
list(APPEND ABSL_RANDOM_HWAES_X64_FLAGS
diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
index 82f332f4..3cc48784 100644
--- a/absl/copts/GENERATED_copts.bzl
+++ b/absl/copts/GENERATED_copts.bzl
@@ -4,12 +4,6 @@
(2) Run `python <path_to_absl>/copts/generate_copts.py`.
"""
-ABSL_CLANG_CL_EXCEPTIONS_FLAGS = [
- "/U_HAS_EXCEPTIONS",
- "/D_HAS_EXCEPTIONS=1",
- "/EHsc",
-]
-
ABSL_CLANG_CL_FLAGS = [
"/W3",
"-Wno-c++98-compat-pedantic",
@@ -30,7 +24,6 @@ ABSL_CLANG_CL_FLAGS = [
"-Wno-gcc-compat",
"-Wno-global-constructors",
"-Wno-exit-time-destructors",
- "-Wno-nested-anon-types",
"-Wno-non-modular-include-in-module",
"-Wno-old-style-cast",
"-Wno-range-loop-analysis",
@@ -81,10 +74,6 @@ ABSL_CLANG_CL_TEST_FLAGS = [
"-Wno-gnu-zero-variadic-macro-arguments",
]
-ABSL_GCC_EXCEPTIONS_FLAGS = [
- "-fexceptions",
-]
-
ABSL_GCC_FLAGS = [
"-Wall",
"-Wextra",
@@ -112,10 +101,6 @@ ABSL_GCC_TEST_FLAGS = [
"-Wno-unused-private-field",
]
-ABSL_LLVM_EXCEPTIONS_FLAGS = [
- "-fexceptions",
-]
-
ABSL_LLVM_FLAGS = [
"-Wall",
"-Wextra",
@@ -138,7 +123,6 @@ ABSL_LLVM_FLAGS = [
"-Wno-gcc-compat",
"-Wno-global-constructors",
"-Wno-exit-time-destructors",
- "-Wno-nested-anon-types",
"-Wno-non-modular-include-in-module",
"-Wno-old-style-cast",
"-Wno-range-loop-analysis",
@@ -184,12 +168,6 @@ ABSL_LLVM_TEST_FLAGS = [
"-Wno-gnu-zero-variadic-macro-arguments",
]
-ABSL_MSVC_EXCEPTIONS_FLAGS = [
- "/U_HAS_EXCEPTIONS",
- "/D_HAS_EXCEPTIONS=1",
- "/EHsc",
-]
-
ABSL_MSVC_FLAGS = [
"/W3",
"/DNOMINMAX",
@@ -197,6 +175,7 @@ ABSL_MSVC_FLAGS = [
"/D_CRT_SECURE_NO_WARNINGS",
"/D_SCL_SECURE_NO_WARNINGS",
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
+ "/bigobj",
"/wd4005",
"/wd4068",
"/wd4180",
@@ -227,8 +206,6 @@ ABSL_RANDOM_HWAES_ARM64_FLAGS = [
]
ABSL_RANDOM_HWAES_MSVC_X64_FLAGS = [
- "/O2",
- "/Ob2",
]
ABSL_RANDOM_HWAES_X64_FLAGS = [
diff --git a/absl/copts/configure_copts.bzl b/absl/copts/configure_copts.bzl
index 8c4efe77..9dd6bd0a 100644
--- a/absl/copts/configure_copts.bzl
+++ b/absl/copts/configure_copts.bzl
@@ -6,13 +6,12 @@ change Abseil copts, edit absl/copts/copts.py
load(
"//absl:copts/GENERATED_copts.bzl",
- "ABSL_GCC_EXCEPTIONS_FLAGS",
+ "ABSL_CLANG_CL_FLAGS",
+ "ABSL_CLANG_CL_TEST_FLAGS",
"ABSL_GCC_FLAGS",
"ABSL_GCC_TEST_FLAGS",
- "ABSL_LLVM_EXCEPTIONS_FLAGS",
"ABSL_LLVM_FLAGS",
"ABSL_LLVM_TEST_FLAGS",
- "ABSL_MSVC_EXCEPTIONS_FLAGS",
"ABSL_MSVC_FLAGS",
"ABSL_MSVC_LINKOPTS",
"ABSL_MSVC_TEST_FLAGS",
@@ -36,16 +35,6 @@ ABSL_TEST_COPTS = ABSL_DEFAULT_COPTS + select({
"//conditions:default": ABSL_GCC_TEST_FLAGS,
})
-ABSL_EXCEPTIONS_FLAG = select({
- "//absl:windows": ABSL_MSVC_EXCEPTIONS_FLAGS,
- "//absl:llvm_compiler": ABSL_LLVM_EXCEPTIONS_FLAGS,
- "//conditions:default": ABSL_GCC_EXCEPTIONS_FLAGS,
-})
-
-ABSL_EXCEPTIONS_FLAG_LINKOPTS = select({
- "//conditions:default": [],
-})
-
ABSL_DEFAULT_LINKOPTS = select({
"//absl:windows": ABSL_MSVC_LINKOPTS,
"//conditions:default": [],
diff --git a/absl/copts/copts.py b/absl/copts/copts.py
index 068abceb..704ef234 100644
--- a/absl/copts/copts.py
+++ b/absl/copts/copts.py
@@ -56,7 +56,6 @@ LLVM_DISABLE_WARNINGS_FLAGS = [
"-Wno-global-constructors",
"-Wno-exit-time-destructors",
###
- "-Wno-nested-anon-types",
"-Wno-non-modular-include-in-module",
"-Wno-old-style-cast",
# Warns on preferred usage of non-POD types such as string_view
@@ -109,12 +108,6 @@ LLVM_TEST_DISABLE_WARNINGS_FLAGS = [
"-Wno-gnu-zero-variadic-macro-arguments",
]
-MSVC_STYLE_EXCEPTIONS_FLAGS = [
- "/U_HAS_EXCEPTIONS",
- "/D_HAS_EXCEPTIONS=1",
- "/EHsc"
-]
-
MSVC_DEFINES = [
"/DNOMINMAX", # Don't define min and max macros (windows.h)
# Don't bloat namespace with incompatible winsock versions.
@@ -157,20 +150,18 @@ COPT_VARS = {
"-Wno-unused-parameter",
"-Wno-unused-private-field",
],
- "ABSL_GCC_EXCEPTIONS_FLAGS": ["-fexceptions"],
"ABSL_LLVM_FLAGS":
LLVM_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS,
"ABSL_LLVM_TEST_FLAGS":
LLVM_TEST_DISABLE_WARNINGS_FLAGS,
- "ABSL_LLVM_EXCEPTIONS_FLAGS": ["-fexceptions"],
"ABSL_CLANG_CL_FLAGS":
(MSVC_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS + MSVC_DEFINES),
"ABSL_CLANG_CL_TEST_FLAGS":
LLVM_TEST_DISABLE_WARNINGS_FLAGS,
- "ABSL_CLANG_CL_EXCEPTIONS_FLAGS":
- MSVC_STYLE_EXCEPTIONS_FLAGS,
"ABSL_MSVC_FLAGS":
MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + [
+ # Increase the number of sections available in object files
+ "/bigobj",
"/wd4005", # macro-redefinition
"/wd4068", # unknown pragma
# qualifier applied to function type has no meaning; ignored
@@ -191,8 +182,6 @@ COPT_VARS = {
"/wd4996", # use of deprecated symbol
"/DNOMINMAX", # disable the min() and max() macros from <windows.h>
],
- "ABSL_MSVC_EXCEPTIONS_FLAGS":
- MSVC_STYLE_EXCEPTIONS_FLAGS,
"ABSL_MSVC_LINKOPTS": [
# Object file doesn't export any previously undefined symbols
"-ignore:4221",
@@ -207,8 +196,5 @@ COPT_VARS = {
"-maes",
"-msse4.1",
],
- "ABSL_RANDOM_HWAES_MSVC_X64_FLAGS": [
- "/O2", # Maximize speed
- "/Ob2", # Aggressive inlining
- ],
+ "ABSL_RANDOM_HWAES_MSVC_X64_FLAGS": [],
}