Skip to content

Commit

Permalink
fix building install
Browse files Browse the repository at this point in the history
  • Loading branch information
young-scott committed Nov 15, 2023
1 parent 09a4678 commit ef4e1e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
23 changes: 3 additions & 20 deletions contrib/cubefs-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
cmake_minimum_required(VERSION 3.20)
project(libsdk)
set(CUBEFS_DIR "${ClickHouse_SOURCE_DIR}/contrib/cubefs")
execute_process(
COMMAND make libsdk
WORKING_DIRECTORY ${CUBEFS_DIR})
set(FILE_PATH "${CUBEFS_DIR}/libsdk/libcfs.h")
# Add configuration to ignore warnings in the header file
file(STRINGS ${FILE_PATH} FILE_CONTENTS)
list(FIND FILE_CONTENTS "#pragma GCC diagnostic push" PRAGMA_INDEX)
if (PRAGMA_INDEX EQUAL -1)
execute_process(
COMMAND sh -c "echo '#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wreserved-identifier\"\n#pragma GCC diagnostic ignored \"-Wmacro-redefined\"\n' | cat - ${FILE_PATH}"
OUTPUT_FILE "${FILE_PATH}.tmp"
)
execute_process(
COMMAND sh -c "echo '#pragma GCC diagnostic pop' >> ${FILE_PATH}.tmp"
)
execute_process(
COMMAND mv "${FILE_PATH}.tmp" "${FILE_PATH}"
)
endif()


COMMAND make libsdk
WORKING_DIRECTORY ${CUBEFS_DIR})
9 changes: 9 additions & 0 deletions src/Disks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
if (ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()

set(CUBEFS_DIR "${ClickHouse_SOURCE_DIR}/contrib/cubefs")

add_library(sdk SHARED ${CUBEFS_DIR}/build/bin/libcfs.a)
install(
TARGETS sdk
EXPORT global
LIBRARY DESTINATION lib
)
10 changes: 9 additions & 1 deletion src/Disks/CubeFS/sdkLoader.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#pragma once
#include <base/logger_useful.h>
#include <base/types.h>
#include <libcfs.h>


extern "C"
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreserved-identifier"
#pragma GCC diagnostic ignored "-Wmacro-redefined"
#include <libcfs.h>
#pragma GCC diagnostic pop
}
namespace DB
{
class SdkLoader
Expand Down

0 comments on commit ef4e1e7

Please sign in to comment.