fixed windows builds
This commit is contained in:
parent
a79416bab7
commit
efc341d768
@ -574,11 +574,6 @@ if (HAVE_PTHREAD)
|
||||
target_link_libraries (glog PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif (HAVE_PTHREAD)
|
||||
|
||||
if (WIN32 AND HAVE_SNPRINTF)
|
||||
set_property (SOURCE src/windows/port.cc APPEND PROPERTY COMPILE_DEFINITIONS
|
||||
HAVE_SNPRINTF)
|
||||
endif (WIN32 AND HAVE_SNPRINTF)
|
||||
|
||||
if (gflags_FOUND)
|
||||
target_link_libraries (glog PUBLIC gflags)
|
||||
|
||||
@ -614,12 +609,12 @@ if (WIN32)
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/windows)
|
||||
endif (WIN32)
|
||||
|
||||
set_target_properties (glog PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL)
|
||||
|
||||
generate_export_header (glog
|
||||
EXPORT_MACRO_NAME GOOGLE_GLOG_DLL_DECL
|
||||
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/glog/export.h)
|
||||
|
||||
set_target_properties (glog PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL)
|
||||
|
||||
# Unit testing
|
||||
|
||||
if (BUILD_TESTING)
|
||||
@ -737,12 +732,14 @@ if (BUILD_TESTING)
|
||||
)
|
||||
|
||||
add_test (NAME cmake_package_config_generate COMMAND ${CMAKE_COMMAND}
|
||||
-DPATH=$ENV{PATH}
|
||||
-DINITIAL_CACHE=${_INITIAL_CACHE}
|
||||
-DTEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_package_config/working_config
|
||||
-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/src/package_config_unittest/working_config
|
||||
-DPACKAGE_DIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-DGENERATOR=${CMAKE_GENERATOR}
|
||||
-DGENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
|
||||
-DGENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
|
||||
-DINITIAL_CACHE=${_INITIAL_CACHE}
|
||||
-DPACKAGE_DIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-DPATH=$ENV{PATH}
|
||||
-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/src/package_config_unittest/working_config
|
||||
-DTEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_package_config/working_config
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestPackageConfig.cmake
|
||||
)
|
||||
|
||||
@ -806,8 +803,9 @@ configure_package_config_file (glog-config.cmake.in
|
||||
INSTALL_DESTINATION ${_glog_CMake_INSTALLDIR}
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
|
||||
write_basic_package_version_file (glog-config-version.cmake VERSION
|
||||
${PROJECT_VERSION} COMPATIBILITY SameMajorVersion)
|
||||
write_basic_package_version_file (
|
||||
${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake)
|
||||
export (PACKAGE glog)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Google Logging Library
|
||||
======================
|
||||
|
||||
|Build Status| |Grunt status|
|
||||
|Build Status| |Grunt status| |Github actions|
|
||||
|
||||
Google Logging (glog) is a C++98 library that implements application-level
|
||||
logging. The library provides logging APIs based on C++-style streams and
|
||||
@ -811,3 +811,5 @@ Submitting a Patch
|
||||
:target: https://travis-ci.org/google/glog/builds
|
||||
.. |Grunt status| image:: https://img.shields.io/appveyor/ci/google-admin/glog/master.svg?label=Appveyor
|
||||
:target: https://ci.appveyor.com/project/google-admin/glog/history
|
||||
.. |Github actions| image:: https://github.com/google/glog/actions/workflows/windows-builds.yml/badge.svg
|
||||
:target: https://github.com/google/glog/actions
|
||||
|
||||
@ -48,9 +48,12 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
||||
|
||||
common_copts = [
|
||||
"-DGLOG_BAZEL_BUILD",
|
||||
# Inject a C++ namespace.
|
||||
"-DGOOGLE_NAMESPACE='%s'" % namespace,
|
||||
"-DHAVE_STDINT_H",
|
||||
"-DHAVE_STRING_H",
|
||||
"-DHAVE_UNWIND_H",
|
||||
"-I%s/glog_internal" % gendir,
|
||||
] + (["-DHAVE_LIB_GFLAGS"] if with_gflags else [])
|
||||
|
||||
wasm_copts = [
|
||||
@ -59,8 +62,6 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
||||
"-Wno-unused-function",
|
||||
"-Wno-unused-local-typedefs",
|
||||
"-Wno-unused-variable",
|
||||
# Inject a C++ namespace.
|
||||
"-DGOOGLE_NAMESPACE='%s'" % namespace,
|
||||
# Allows src/base/mutex.h to include pthread.h.
|
||||
"-DHAVE_PTHREAD",
|
||||
# Allows src/logging.cc to determine the host name.
|
||||
@ -72,7 +73,6 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
||||
# For logging.cc.
|
||||
"-DHAVE_PREAD",
|
||||
"-DHAVE___ATTRIBUTE__",
|
||||
"-I%s/glog_internal" % gendir,
|
||||
]
|
||||
|
||||
linux_or_darwin_copts = wasm_copts + [
|
||||
@ -93,13 +93,13 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
||||
]
|
||||
|
||||
windows_only_copts = [
|
||||
"-DGLOG_NO_ABBREVIATED_SEVERITIES",
|
||||
"-DHAVE_SNPRINTF",
|
||||
"-I" + src_windows,
|
||||
]
|
||||
|
||||
windows_only_srcs = [
|
||||
"src/glog/log_severity.h",
|
||||
"src/windows/config.h",
|
||||
"src/windows/dirent.h",
|
||||
"src/windows/port.cc",
|
||||
"src/windows/port.h",
|
||||
|
||||
@ -45,8 +45,12 @@ function (get_cache_variables _CACHEVARS)
|
||||
string (REPLACE "\"" "\\\"" _CACHEVARDOC "${_CACHEVARDOC}")
|
||||
# Escape ; in values
|
||||
string (REPLACE ";" "\\\;" _CACHEVARVAL "${_CACHEVARVAL}")
|
||||
# Escape backslash in values
|
||||
# Escape backslashes in values except those that are followed by a
|
||||
# quote.
|
||||
string (REGEX REPLACE "\\\\([^\"])" "\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}")
|
||||
# Escape backslashes in values that are followed by a letter to avoid
|
||||
# invalid escape sequence errors.
|
||||
string (REGEX REPLACE "\\\\([a-zA-Z])" "\\\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}")
|
||||
|
||||
if (NOT "${_CACHEVARTYPE}" STREQUAL BOOL)
|
||||
set (_CACHEVARVAL "\"${_CACHEVARVAL}\"")
|
||||
|
||||
@ -9,4 +9,3 @@ if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
|
||||
endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
|
||||
|
||||
file (WRITE ${INITIAL_CACHE} "${CACHEVARS}")
|
||||
|
||||
|
||||
@ -8,21 +8,28 @@ if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
|
||||
message (FATAL_ERROR "Failed to create build directory")
|
||||
endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
|
||||
|
||||
# Capture the PATH environment variable content set during project
|
||||
# generation stage. This is required because later during the build stage
|
||||
# the PATH is modified again (e.g., for MinGW AppVeyor CI builds) by adding
|
||||
# back the directory containing git.exe. Incidently, the Git installation
|
||||
# directory also contains sh.exe which causes MinGW Makefile generation to
|
||||
# fail.
|
||||
set (ENV{PATH} ${PATH})
|
||||
if (GENERATOR_TOOLSET)
|
||||
list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET})
|
||||
endif (GENERATOR_TOOLSET)
|
||||
|
||||
if (GENERATOR_PLATFORM)
|
||||
list (APPEND _ADDITIONAL_ARGS -A ${GENERATOR_PLATFORM})
|
||||
endif (GENERATOR_PLATFORM)
|
||||
|
||||
# Run CMake
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_COMMAND} -C ${INITIAL_CACHE}
|
||||
# Capture the PATH environment variable content set during project generation
|
||||
# stage. This is required because later during the build stage the PATH is
|
||||
# modified again (e.g., for MinGW AppVeyor CI builds) by adding back the
|
||||
# directory containing git.exe. Incidently, the Git installation directory
|
||||
# also contains sh.exe which causes MinGW Makefile generation to fail.
|
||||
COMMAND ${CMAKE_COMMAND} env PATH=${PATH}
|
||||
${CMAKE_COMMAND} -C ${INITIAL_CACHE}
|
||||
-G ${GENERATOR}
|
||||
-DCMAKE_PREFIX_PATH=${PACKAGE_DIR}
|
||||
${_ADDITIONAL_ARGS}
|
||||
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
|
||||
-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON
|
||||
-DCMAKE_PREFIX_PATH=${PACKAGE_DIR}
|
||||
${SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${TEST_BINARY_DIR}
|
||||
RESULT_VARIABLE _GENERATE_SUCCEEDED
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
// Copyright (c) 2008, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// ---
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// Author: Craig Silverstein
|
||||
// Copied from google-perftools and modified by Shinichiro Hamaji
|
||||
//
|
||||
// This file is needed for windows -- unittests are not part of the
|
||||
// glog dll, but still want to include config.h just like the
|
||||
// dll does, so they can use internal tools and APIs for testing.
|
||||
//
|
||||
// The problem is that config.h declares GOOGLE_GLOG_DLL_DECL to be
|
||||
// for exporting symbols, but the unittest needs to *import* symbols
|
||||
// (since it's not the dll).
|
||||
//
|
||||
// The solution is to have this file, which is just like config.h but
|
||||
// sets GOOGLE_GLOG_DLL_DECL to do a dllimport instead of a dllexport.
|
||||
//
|
||||
// The reason we need this extra GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS
|
||||
// variable is in case people want to set GOOGLE_GLOG_DLL_DECL explicitly
|
||||
// to something other than __declspec(dllexport). In that case, they
|
||||
// may want to use something other than __declspec(dllimport) for the
|
||||
// unittest case. For that, we allow folks to define both
|
||||
// GOOGLE_GLOG_DLL_DECL and GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS explicitly.
|
||||
//
|
||||
// NOTE: This file is equivalent to config.h on non-windows systems,
|
||||
// which never defined GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS and always
|
||||
// define GOOGLE_GLOG_DLL_DECL to the empty string.
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#undef GOOGLE_GLOG_DLL_DECL
|
||||
#ifdef GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS
|
||||
# define GOOGLE_GLOG_DLL_DECL GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS
|
||||
#else
|
||||
// if DLL_DECL_FOR_UNITTESTS isn't defined, use ""
|
||||
# define GOOGLE_GLOG_DLL_DECL
|
||||
#endif
|
||||
@ -29,7 +29,7 @@
|
||||
//
|
||||
// Author: Ray Sidney
|
||||
|
||||
#include "config_for_unittests.h"
|
||||
#include "config.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required (VERSION 3.1)
|
||||
project (glog_package_config)
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
project (glog_package_config LANGUAGES CXX)
|
||||
|
||||
find_package (glog REQUIRED NO_MODULE)
|
||||
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Namespace for Google classes */
|
||||
#define GOOGLE_NAMESPACE google
|
||||
|
||||
/* Stops putting the code inside the Google namespace */
|
||||
#define _END_GOOGLE_NAMESPACE_ }
|
||||
|
||||
/* Puts following code inside the Google namespace */
|
||||
#define _START_GOOGLE_NAMESPACE_ namespace google {
|
||||
|
||||
/* Always the empty-string on non-windows systems. On windows, should be
|
||||
"__declspec(dllexport)". This way, when we compile the dll, we export our
|
||||
functions/classes. It's safe to define this here because config.h is only
|
||||
used internally, to compile the DLL, and every DLL source file #includes
|
||||
"config.h" before anything else. */
|
||||
#ifndef GOOGLE_GLOG_DLL_DECL
|
||||
# define GOOGLE_GLOG_IS_A_DLL 1 /* not set if you're statically linking */
|
||||
# define GOOGLE_GLOG_DLL_DECL __declspec(dllexport)
|
||||
# define GOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
|
||||
#endif
|
||||
@ -62,6 +62,8 @@
|
||||
* used by both C and C++ code, so we put all the C++ together.
|
||||
*/
|
||||
|
||||
#include "glog/logging.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/* 4244: otherwise we get problems when substracting two size_t's to an int
|
||||
|
||||
Loading…
Reference in New Issue
Block a user