Skip to content

Commit

Permalink
feat: use standard mutexes (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud authored Jan 1, 2024
1 parent ac8f8da commit 8ff1a7d
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 414 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ if (Threads_FOUND)
set (CMAKE_REQUIRED_LIBRARIES Threads::Threads)
endif (Threads_FOUND)

check_cxx_symbol_exists (pthread_rwlock_destroy pthread.h HAVE_RWLOCK_DESTROY)
check_cxx_symbol_exists (pthread_rwlock_init pthread.h HAVE_RWLOCK_INIT)
check_cxx_symbol_exists (pthread_rwlock_rdlock pthread.h HAVE_RWLOCK_RDLOCK)
check_cxx_symbol_exists (pthread_rwlock_unlock pthread.h HAVE_RWLOCK_UNLOCK)
check_cxx_symbol_exists (pthread_rwlock_wrlock pthread.h HAVE_RWLOCK_WRLOCK)
check_cxx_symbol_exists (pthread_threadid_np pthread.h HAVE_PTHREAD_THREADID_NP)

cmake_pop_check_state ()
Expand Down Expand Up @@ -391,7 +386,6 @@ set (GLOG_SRCS
${GLOG_PUBLIC_H}
src/base/commandlineflags.h
src/base/googleinit.h
src/base/mutex.h
src/demangle.cc
src/demangle.h
src/logging.cc
Expand Down Expand Up @@ -440,6 +434,13 @@ set (glog_libraries_options_for_static_linking)
# CMake always uses the generated export header
target_compile_definitions (glog PUBLIC GLOG_USE_GLOG_EXPORT)

if (WIN32)
# Do not define min and max as macros
target_compile_definitions (glog PRIVATE NOMINMAX)
# Exclude unnecessary funcitonality
target_compile_definitions (glog PRIVATE WIN32_LEAN_AND_MEAN)
endif (WIN32)

if (HAVE_LIB_GFLAGS)
target_compile_definitions (glog PUBLIC GLOG_USE_GFLAGS)
endif (HAVE_LIB_GFLAGS)
Expand Down
3 changes: 1 addition & 2 deletions bazel/glog.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def glog_library(with_gflags = 1, **kwargs):
"-Wno-unused-function",
"-Wno-unused-local-typedefs",
"-Wno-unused-variable",
# Allows src/base/mutex.h to include pthread.h.
# Allows to include pthread.h.
"-DHAVE_PTHREAD",
# Allows src/logging.cc to determine the host name.
"-DHAVE_SYS_UTSNAME_H",
Expand Down Expand Up @@ -154,7 +154,6 @@ def glog_library(with_gflags = 1, **kwargs):
name = "shared_headers",
srcs = [
"src/base/commandlineflags.h",
"src/base/mutex.h",
"src/stacktrace.h",
"src/utilities.h",
]
Expand Down
Loading

0 comments on commit 8ff1a7d

Please sign in to comment.