Commit eb3b78a4 authored by Andreas Schuh's avatar Andreas Schuh

Merge remote-tracking branch 'google/release'

parents 0c150281 ef5c5474
......@@ -8,7 +8,7 @@ include (utils)
# ----------------------------------------------------------------------------
# package information
set (PACKAGE_NAME "gflags")
set (PACKAGE_VERSION "2.1.0")
set (PACKAGE_VERSION "2.1.1")
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set (PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set (PACKAGE_BUGREPORT "https://code.google.com/p/gflags/issues/")
......@@ -24,7 +24,15 @@ version_numbers (
# ----------------------------------------------------------------------------
# options
set (GFLAGS_NAMESPACE "${PACKAGE_NAME}" CACHE STRING "C++ namespace identifier of gflags library.")
set (GFLAGS_NAMESPACE "${PACKAGE_NAME}" CACHE STRING "C++ namespace identifier of gflags library.")
set (GFLAGS_INCLUDE_DIR "${PACKAGE_NAME}" CACHE STRING "Include subdirectory of gflags header files.")
if (IS_ABSOLUTE GFLAGS_INCLUDE_DIR)
message (FATAL_ERROR "GFLAGS_INCLUDE_DIR must be a path relative to CMAKE_INSTALL_PREFIX/include")
endif ()
if (GFLAGS_INCLUDE_DIR MATCHES "^\\.\\.[/\\]")
message (FATAL_ERROR "GFLAGS_INCLUDE_DIR must not start with parent directory reference (../)")
endif ()
option (BUILD_SHARED_LIBS "Request build of shared libraries." OFF)
option (BUILD_STATIC_LIBS "Request build of static libraries (default if BUILD_SHARED_LIBS is OFF)." OFF)
......@@ -38,6 +46,7 @@ option (INSTALL_HEADERS "Request packaging of headers and other devel
mark_as_advanced (CLEAR CMAKE_INSTALL_PREFIX)
mark_as_advanced (CMAKE_CONFIGURATION_TYPES
GFLAGS_NAMESPACE
GFLAGS_INCLUDE_DIR
BUILD_STATIC_LIBS
BUILD_NC_TESTS
INSTALL_HEADERS)
......@@ -197,13 +206,22 @@ else ()
set (GFLAGS_ATTRIBUTE_UNUSED)
endif ()
# whenever we build a shared library (DLL on Windows), configure the public
# headers of the API for use of this library rather than the optionally
# also build statically linked library; users can override GFLAGS_DLL_DECL
if (BUILD_SHARED_LIBS)
set (GFLAGS_IS_A_DLL 1)
else ()
set (GFLAGS_IS_A_DLL 0)
endif ()
configure_headers (PUBLIC_HDRS ${PUBLIC_HDRS})
configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS})
configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS})
include_directories ("${PROJECT_SOURCE_DIR}/src")
include_directories ("${PROJECT_BINARY_DIR}/include")
include_directories ("${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}")
include_directories ("${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}")
# ----------------------------------------------------------------------------
# output directories
......@@ -273,7 +291,7 @@ configure_file (cmake/version.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-co
install (TARGETS ${TARGETS} DESTINATION ${LIBRARY_INSTALL_DIR} EXPORT gflags-lib)
if (INSTALL_HEADERS)
install (FILES ${PUBLIC_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/${GFLAGS_NAMESPACE})
install (FILES ${PUBLIC_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/${GFLAGS_INCLUDE_DIR})
install (
FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake"
RENAME ${PACKAGE_NAME}-config.cmake
......@@ -374,21 +392,27 @@ if (BUILD_PACKAGING)
set (CPACK_SYSTEM_NAME "win32")
endif ()
set (CPACK_PACKAGE_ARCHITECTURE)
elseif (APPLE)
set (CPACK_PACKAGE_ARCHITECTURE darwin)
else ()
string (TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME)
execute_process (
COMMAND dpkg --print-architecture
RESULT_VARIABLE RV
OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE
)
if (RV EQUAL 0)
string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)
if (CMAKE_CXX_FLAGS MATCHES "-m32")
set (CPACK_PACKAGE_ARCHITECTURE i386)
else ()
execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64")
set (CPACK_PACKAGE_ARCHITECTURE amd64)
execute_process (
COMMAND dpkg --print-architecture
RESULT_VARIABLE RV
OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE
)
if (RV EQUAL 0)
string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)
else ()
set (CPACK_PACKAGE_ARCHITECTURE i386)
execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64")
set (CPACK_PACKAGE_ARCHITECTURE amd64)
else ()
set (CPACK_PACKAGE_ARCHITECTURE i386)
endif ()
endif ()
endif ()
endif ()
......
=== 30 March 2014 ===
I've just released gflags 2.1.1.
This release fixes a few bugs in the configuration of gflags_declare.h
and adds a separate GFLAGS_INCLUDE_DIR CMake variable to the build configuration.
Setting GFLAGS_NAMESPACE to "google" no longer changes also the include
path of the public header files. This allows the use of the library with
other Google projects such as glog which still use the deprecated "google"
namespace for the gflags library, but include it as "gflags/gflags.h".
=== 20 March 2014 ===
I've just released gflags 2.1.0.
I've just released gflags 2.1.
The major changes are the use of CMake for the build configuration instead
of the autotools and packaging support through CPack. This release compiles
with all major compilers without warnings and passed the unit tests on
Ubuntu 12.04, Windows 7 (Visual Studio 2008 and 2010, Cygwin, MinGW), and
Mac OS X (Xcode 5.1).
of the autotools and packaging support through CPack. The default namespace
of all C++ symbols is now "gflags" instead of "google". This can be
configured via the GFLAGS_NAMESPACE variable.
This release compiles with all major compilers without warnings and passed
the unit tests on Ubuntu 12.04, Windows 7 (Visual Studio 2008 and 2010,
Cygwin, MinGW), and Mac OS X (Xcode 5.1).
The SVN repository on Google Code is now frozen and replaced by a Git
repository such that it can be used as Git submodule by projects. The main
......@@ -21,9 +35,7 @@ For the further development, I am following the
with feature branch names prefixed by "feature/" and bugfix branch names
prefixed by "bugfix/", respectively.
Binary and source distribution packages can be downloaded from
[https://github.com/schuhschuh/gflags GitHub] as Google Code no longer
permits the upload of such download packages.
Binary and source [https://github.com/schuhschuh/gflags/releases packages] are available on GitHub.
=== 14 January 2013 ===
......
......@@ -2,5 +2,3 @@ This package contains a library that implements commandline flags
processing. As such it's a replacement for getopt(). It has increased
flexibility, including built-in support for C++ types like string, and
the ability to define flags in the source file in which they're used.
The devel package contains static and debug libraries and header files
for developing applications that use the gflags package.
......@@ -47,11 +47,11 @@ function (configure_headers out)
set (tmp)
foreach (src IN LISTS ARGN)
if (EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}" @ONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}")
else ()
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}" "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}" COPYONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" COPYONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}")
endif ()
endforeach ()
set (${out} "${tmp}" PARENT_SCOPE)
......@@ -63,8 +63,8 @@ function (configure_sources out)
set (tmp)
foreach (src IN LISTS ARGN)
if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}" @ONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}")
else ()
list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}")
endif ()
......
......@@ -113,13 +113,13 @@ typedef std::string clstring;
DECLARE_VARIABLE(bool, B, name)
#define DECLARE_int32(name) \
DECLARE_VARIABLE(GFLAGS_NAMESPACE::int32, I, name)
DECLARE_VARIABLE(::@GFLAGS_NAMESPACE@::int32, I, name)
#define DECLARE_int64(name) \
DECLARE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, name)
DECLARE_VARIABLE(::@GFLAGS_NAMESPACE@::int64, I64, name)
#define DECLARE_uint64(name) \
DECLARE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, name)
DECLARE_VARIABLE(::@GFLAGS_NAMESPACE@::uint64, U64, name)
#define DECLARE_double(name) \
DECLARE_VARIABLE(double, D, name)
......
......@@ -154,6 +154,13 @@ add_gflags_test(always_fail 1 "ERROR: failed validation of new value 'true' for
# debugger abort() intervention in case of Debug configuration.
#add_gflags_test(deadlock_if_cant_lock 0 "PASS" "" gflags_unittest --deadlock_if_cant_lock)
# ----------------------------------------------------------------------------
# use gflags_declare.h
add_executable (gflags_declare_test gflags_declare_test.cc gflags_declare_flags.cc)
add_test(NAME gflags_declare COMMAND gflags_declare_test --message "Hello gflags!")
set_tests_properties(gflags_declare PROPERTIES PASS_REGULAR_EXPRESSION "Hello gflags!")
# ----------------------------------------------------------------------------
# (negative) compilation tests
if (BUILD_NC_TESTS)
......
#include <iostream>
#include <gflags/gflags_declare.h>
DECLARE_string(message); // in gflags_delcare_test.cc
void print_message()
{
std::cout << FLAGS_message << std::endl;
}
#include <gflags/gflags.h>
DEFINE_string(message, "", "The message to print");
void print_message(); // in gflags_declare_flags.cc
int main(int argc, char **argv)
{
gflags::SetUsageMessage("Test compilation and use of gflags_declare.h");
gflags::ParseCommandLineFlags(&argc, &argv, true);
print_message();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment