CMake: more MinGW fixes
Summary: See individual commits. yuslepukhin siying Closes https://github.com/facebook/rocksdb/pull/2081 Differential Revision: D4824639 Pulled By: IslamAbdelRahman fbshipit-source-id: 2fc2b00
This commit is contained in:
parent
90cfd46458
commit
3450ac8c1b
@ -41,20 +41,19 @@ endif()
|
|||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||||
|
|
||||||
if(WIN32)
|
if(MSVC)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc)
|
||||||
else()
|
else()
|
||||||
option(WITH_JEMALLOC "build with JeMalloc" OFF)
|
option(WITH_JEMALLOC "build with JeMalloc" OFF)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
|
# FreeBSD has jemaloc as default malloc
|
||||||
|
set(WITH_JEMALLOC ON)
|
||||||
|
endif()
|
||||||
if(WITH_JEMALLOC)
|
if(WITH_JEMALLOC)
|
||||||
find_package(JeMalloc REQUIRED)
|
find_package(JeMalloc REQUIRED)
|
||||||
add_definitions(-DROCKSDB_JEMALLOC)
|
add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE)
|
||||||
include_directories(${JEMALLOC_INCLUDE_DIR})
|
include_directories(${JEMALLOC_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
||||||
# FreeBSD has jemaloc as default malloc
|
|
||||||
add_definitions(-DROCKSDB_JEMALLOC)
|
|
||||||
set(WITH_JEMALLOC ON)
|
|
||||||
endif()
|
|
||||||
option(WITH_SNAPPY "build with SNAPPY" OFF)
|
option(WITH_SNAPPY "build with SNAPPY" OFF)
|
||||||
if(WITH_SNAPPY)
|
if(WITH_SNAPPY)
|
||||||
find_package(snappy REQUIRED)
|
find_package(snappy REQUIRED)
|
||||||
|
4
Makefile
4
Makefile
@ -204,8 +204,8 @@ endif
|
|||||||
|
|
||||||
ifndef DISABLE_JEMALLOC
|
ifndef DISABLE_JEMALLOC
|
||||||
ifdef JEMALLOC
|
ifdef JEMALLOC
|
||||||
PLATFORM_CXXFLAGS += "-DROCKSDB_JEMALLOC"
|
PLATFORM_CXXFLAGS += "-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE "
|
||||||
PLATFORM_CCFLAGS += "-DROCKSDB_JEMALLOC"
|
PLATFORM_CCFLAGS += "-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE "
|
||||||
endif
|
endif
|
||||||
EXEC_LDFLAGS := $(JEMALLOC_LIB) $(EXEC_LDFLAGS)
|
EXEC_LDFLAGS := $(JEMALLOC_LIB) $(EXEC_LDFLAGS)
|
||||||
PLATFORM_CXXFLAGS += $(JEMALLOC_INCLUDE)
|
PLATFORM_CXXFLAGS += $(JEMALLOC_INCLUDE)
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
# - Find JeMalloc library
|
# - Find JeMalloc library
|
||||||
# Find the native JeMalloc includes and library
|
# Find the native JeMalloc includes and library
|
||||||
# This module defines
|
|
||||||
# JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when
|
|
||||||
# JEMALLOC_INCLUDE_DIR is found.
|
|
||||||
# JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc.
|
|
||||||
# JEMALLOC_FOUND, If false, do not try to use JeMalloc.
|
|
||||||
#
|
#
|
||||||
|
# JEMALLOC_INCLUDE_DIR - where to find jemalloc.h, etc.
|
||||||
|
# JEMALLOC_LIBRARIES - List of libraries when using jemalloc.
|
||||||
|
# JEMALLOC_FOUND - True if jemalloc found.
|
||||||
|
|
||||||
find_path(JEMALLOC_INCLUDE_DIR
|
find_path(JEMALLOC_INCLUDE_DIR
|
||||||
jemalloc/jemalloc.h)
|
NAMES jemalloc/jemalloc.h
|
||||||
|
HINTS ${JEMALLOC_ROOT_DIR}/include)
|
||||||
|
|
||||||
find_library(JEMALLOC_LIBRARIES
|
find_library(JEMALLOC_LIBRARIES
|
||||||
jemalloc)
|
NAMES jemalloc
|
||||||
|
HINTS ${JEMALLOC_ROOT_DIR}/lib)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
|
find_package_handle_standard_args(jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
|
||||||
JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
mark_as_advanced(
|
||||||
JEMALLOC_INCLUDE_DIR
|
|
||||||
JEMALLOC_LIBRARIES
|
JEMALLOC_LIBRARIES
|
||||||
)
|
JEMALLOC_INCLUDE_DIR)
|
||||||
|
@ -13,8 +13,6 @@ find_library(SNAPPY_LIBRARIES
|
|||||||
NAMES snappy
|
NAMES snappy
|
||||||
HINTS ${SNAPPY_ROOT_DIR}/lib)
|
HINTS ${SNAPPY_ROOT_DIR}/lib)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(snappy DEFAULT_MSG SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR)
|
find_package_handle_standard_args(snappy DEFAULT_MSG SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR)
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ static void DumpMallocStats(std::string* stats) {
|
|||||||
std::unique_ptr<char[]> buf{new char[kMallocStatusLen + 1]};
|
std::unique_ptr<char[]> buf{new char[kMallocStatusLen + 1]};
|
||||||
mstat.cur = buf.get();
|
mstat.cur = buf.get();
|
||||||
mstat.end = buf.get() + kMallocStatusLen;
|
mstat.end = buf.get() + kMallocStatusLen;
|
||||||
malloc_stats_print(GetJemallocStatus, &mstat, "");
|
je_malloc_stats_print(GetJemallocStatus, &mstat, "");
|
||||||
stats->append(buf.get());
|
stats->append(buf.get());
|
||||||
#endif // ROCKSDB_JEMALLOC
|
#endif // ROCKSDB_JEMALLOC
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ include ../make_config.mk
|
|||||||
|
|
||||||
ifndef DISABLE_JEMALLOC
|
ifndef DISABLE_JEMALLOC
|
||||||
ifdef JEMALLOC
|
ifdef JEMALLOC
|
||||||
PLATFORM_CXXFLAGS += "-DROCKSDB_JEMALLOC"
|
PLATFORM_CXXFLAGS += "-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE "
|
||||||
endif
|
endif
|
||||||
EXEC_LDFLAGS := $(JEMALLOC_LIB) $(EXEC_LDFLAGS) -lpthread
|
EXEC_LDFLAGS := $(JEMALLOC_LIB) $(EXEC_LDFLAGS) -lpthread
|
||||||
PLATFORM_CXXFLAGS += $(JEMALLOC_INCLUDE)
|
PLATFORM_CXXFLAGS += $(JEMALLOC_INCLUDE)
|
||||||
|
Loading…
Reference in New Issue
Block a user