Skip to content

Commit

Permalink
fix(glog): configure macros
Browse files Browse the repository at this point in the history
specify use glog as dll or lib
  • Loading branch information
lotem committed Feb 25, 2024
1 parent 9ca2430 commit ab5d1d2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,19 @@ if(ENABLE_LOGGING)
find_package(Glog REQUIRED)
if(Glog_FOUND)
include_directories(${Glog_INCLUDE_PATH})
endif()
if(Glog_STATIC)
add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
if(WIN32)
add_compile_definitions("GLOG_DEPRECATED=__declspec(deprecated)")
add_compile_definitions(GLOG_NO_ABBREVIATED_SEVERITIES)
else()
add_compile_definitions("GLOG_DEPRECATED=__attribute__((deprecated))")
endif()
if(Glog_STATIC)
add_compile_definitions(GLOG_EXPORT=)
add_compile_definitions(GLOG_NO_EXPORT=)
else()
add_compile_definitions("GLOG_EXPORT=__attribute__((visibility(\"default\")))")
add_compile_definitions("GLOG_NO_EXPORT=__attribute__((visibility(\"default\")))")
endif()
endif()

set(RIME_ENABLE_LOGGING 1)
Expand Down
1 change: 0 additions & 1 deletion src/rime/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <boost/signals2/signal.hpp>

#ifdef RIME_ENABLE_LOGGING
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include <glog/logging.h>
#else
#include "no_logging.h"
Expand Down
5 changes: 2 additions & 3 deletions src/rime/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
#include <rime/build_config.h>

#ifdef RIME_ENABLE_LOGGING
#ifdef _WIN32
#define GLOG_NO_ABBREVIATED_SEVERITIES
#endif // _WIN32
#include <glog/logging.h>
#else
#include "no_logging.h"
#endif // RIME_ENABLE_LOGGING

#include <rime_api.h>
Expand Down

0 comments on commit ab5d1d2

Please sign in to comment.