mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
x11: update cmake file to build with fuse2/fuse3 or without fuse
This commit is contained in:
parent
1de1f113ed
commit
7f043ebb52
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
|||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install libxrandr-dev libxinerama-dev libusb-1.0-0-dev xserver-xorg-dev libswscale-dev libswresample-dev libavutil-dev libavcodec-dev libcups2-dev libpulse-dev libasound2-dev libpcsclite-dev xsltproc libxcb-cursor-dev libxcursor-dev libcairo2-dev libfaac-dev libfaad-dev libjpeg-dev libgsm1-dev ninja-build libxfixes-dev libxkbcommon-dev libwayland-dev libpam0g-dev libxdamage-dev libxcb-damage0-dev ccache libxtst-dev
|
sudo apt install libxrandr-dev libxinerama-dev libusb-1.0-0-dev xserver-xorg-dev libswscale-dev libswresample-dev libavutil-dev libavcodec-dev libcups2-dev libpulse-dev libasound2-dev libpcsclite-dev xsltproc libxcb-cursor-dev libxcursor-dev libcairo2-dev libfaac-dev libfaad-dev libjpeg-dev libgsm1-dev ninja-build libxfixes-dev libxkbcommon-dev libwayland-dev libpam0g-dev libxdamage-dev libxcb-damage0-dev ccache libxtst-dev libfuse-dev
|
||||||
cmake -GNinja -DWITH_SERVER=ON -DWITH_SAMPLE=ON -DBUILD_TESTING=ON .
|
cmake -GNinja -DWITH_SERVER=ON -DWITH_SAMPLE=ON -DBUILD_TESTING=ON .
|
||||||
cmake --build .
|
cmake --build .
|
||||||
|
|
||||||
|
@ -168,6 +168,11 @@ set(XFIXES_FEATURE_TYPE "RECOMMENDED")
|
|||||||
set(XFIXES_FEATURE_PURPOSE "X11 xfixes extension")
|
set(XFIXES_FEATURE_PURPOSE "X11 xfixes extension")
|
||||||
set(XFIXES_FEATURE_DESCRIPTION "Useful additions to the X11 core protocol")
|
set(XFIXES_FEATURE_DESCRIPTION "Useful additions to the X11 core protocol")
|
||||||
|
|
||||||
|
set(FUSE_FEATURE_TYPE "RECOMMENDED")
|
||||||
|
set(FUSE_FEATURE_PURPOSE "Remote to local file copy")
|
||||||
|
set(FUSE_FEATURE_DESCRIPTION "use -DWITH_FUSE2 or -DWITH_FUSE3 to specify fuse version")
|
||||||
|
|
||||||
|
|
||||||
find_feature(XShm ${XSHM_FEATURE_TYPE} ${XSHM_FEATURE_PURPOSE} ${XSHM_FEATURE_DESCRIPTION})
|
find_feature(XShm ${XSHM_FEATURE_TYPE} ${XSHM_FEATURE_PURPOSE} ${XSHM_FEATURE_DESCRIPTION})
|
||||||
find_feature(Xinerama ${XINERAMA_FEATURE_TYPE} ${XINERAMA_FEATURE_PURPOSE} ${XINERAMA_FEATURE_DESCRIPTION})
|
find_feature(Xinerama ${XINERAMA_FEATURE_TYPE} ${XINERAMA_FEATURE_PURPOSE} ${XINERAMA_FEATURE_DESCRIPTION})
|
||||||
find_feature(Xext ${XEXT_FEATURE_TYPE} ${XEXT_FEATURE_PURPOSE} ${XEXT_FEATURE_DESCRIPTION})
|
find_feature(Xext ${XEXT_FEATURE_TYPE} ${XEXT_FEATURE_PURPOSE} ${XEXT_FEATURE_DESCRIPTION})
|
||||||
@ -177,6 +182,7 @@ find_feature(Xi ${XI_FEATURE_TYPE} ${XI_FEATURE_PURPOSE} ${XI_FEATURE_DESCRIPTIO
|
|||||||
find_feature(Xrender ${XRENDER_FEATURE_TYPE} ${XRENDER_FEATURE_PURPOSE} ${XRENDER_FEATURE_DESCRIPTION})
|
find_feature(Xrender ${XRENDER_FEATURE_TYPE} ${XRENDER_FEATURE_PURPOSE} ${XRENDER_FEATURE_DESCRIPTION})
|
||||||
find_feature(XRandR ${XRANDR_FEATURE_TYPE} ${XRANDR_FEATURE_PURPOSE} ${XRANDR_FEATURE_DESCRIPTION})
|
find_feature(XRandR ${XRANDR_FEATURE_TYPE} ${XRANDR_FEATURE_PURPOSE} ${XRANDR_FEATURE_DESCRIPTION})
|
||||||
find_feature(Xfixes ${XFIXES_FEATURE_TYPE} ${XFIXES_FEATURE_PURPOSE} ${XFIXES_FEATURE_DESCRIPTION})
|
find_feature(Xfixes ${XFIXES_FEATURE_TYPE} ${XFIXES_FEATURE_PURPOSE} ${XFIXES_FEATURE_DESCRIPTION})
|
||||||
|
find_feature(FUSE ${FUSE_FEATURE_TYPE} ${FUSE_FEATURE_PURPOSE} ${FUSE_FEATURE_DESCRIPTION} )
|
||||||
|
|
||||||
if(WITH_XINERAMA)
|
if(WITH_XINERAMA)
|
||||||
add_definitions(-DWITH_XINERAMA)
|
add_definitions(-DWITH_XINERAMA)
|
||||||
@ -226,9 +232,12 @@ if(WITH_XFIXES)
|
|||||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XFIXES_LIBRARIES})
|
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XFIXES_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(FUSE REQUIRED)
|
if(WITH_FUSE)
|
||||||
include_directories(${FUSE_INCLUDE_DIR})
|
add_definitions(-DWITH_FUSE)
|
||||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${FUSE_LIBRARIES})
|
add_definitions(-DFUSE_API_VERSION=${FUSE_API_VERSION})
|
||||||
|
include_directories(${FUSE_INCLUDE_DIR})
|
||||||
|
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${FUSE_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/resources)
|
include_directories(${CMAKE_SOURCE_DIR}/resources)
|
||||||
|
|
||||||
|
@ -31,13 +31,19 @@
|
|||||||
#include <X11/extensions/Xfixes.h>
|
#include <X11/extensions/Xfixes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FUSE_USE_VERSION 26
|
#ifdef WITH_FUSE
|
||||||
|
#define FUSE_USE_VERSION FUSE_API_VERSION
|
||||||
|
#if FUSE_USE_VERSION >= 30
|
||||||
|
#include <fuse3/fuse_lowlevel.h>
|
||||||
|
#else
|
||||||
#include <fuse/fuse_lowlevel.h>
|
#include <fuse/fuse_lowlevel.h>
|
||||||
|
#endif
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#define WIN32_FILETIME_TO_UNIX_EPOCH_USEC UINT64_C(116444736000000000)
|
#define WIN32_FILETIME_TO_UNIX_EPOCH_USEC UINT64_C(116444736000000000)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
#include <winpr/image.h>
|
#include <winpr/image.h>
|
||||||
@ -64,6 +70,7 @@ struct xf_cliprdr_format
|
|||||||
};
|
};
|
||||||
typedef struct xf_cliprdr_format xfCliprdrFormat;
|
typedef struct xf_cliprdr_format xfCliprdrFormat;
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
struct xf_cliprdr_fuse_stream
|
struct xf_cliprdr_fuse_stream
|
||||||
{
|
{
|
||||||
UINT32 stream_id;
|
UINT32 stream_id;
|
||||||
@ -103,6 +110,7 @@ void xf_cliprdr_fuse_inode_free(void* obj)
|
|||||||
free(inode);
|
free(inode);
|
||||||
inode = NULL;
|
inode = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct xf_clipboard
|
struct xf_clipboard
|
||||||
{
|
{
|
||||||
@ -160,7 +168,7 @@ struct xf_clipboard
|
|||||||
/* File clipping */
|
/* File clipping */
|
||||||
BOOL streams_supported;
|
BOOL streams_supported;
|
||||||
BOOL file_formats_registered;
|
BOOL file_formats_registered;
|
||||||
|
#ifdef WITH_FUSE
|
||||||
/* FUSE related**/
|
/* FUSE related**/
|
||||||
HANDLE fuse_thread;
|
HANDLE fuse_thread;
|
||||||
struct fuse_session* fuse_sess;
|
struct fuse_session* fuse_sess;
|
||||||
@ -169,6 +177,7 @@ struct xf_clipboard
|
|||||||
wArrayList* stream_list;
|
wArrayList* stream_list;
|
||||||
UINT32 current_stream_id;
|
UINT32 current_stream_id;
|
||||||
wArrayList* ino_list;
|
wArrayList* ino_list;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT xf_cliprdr_send_client_format_list(xfClipboard* clipboard);
|
static UINT xf_cliprdr_send_client_format_list(xfClipboard* clipboard);
|
||||||
@ -882,7 +891,7 @@ static void xf_cliprdr_clear_cached_data(xfClipboard* clipboard)
|
|||||||
}
|
}
|
||||||
|
|
||||||
clipboard->data_raw_length = 0;
|
clipboard->data_raw_length = 0;
|
||||||
|
#ifdef WITH_FUSE
|
||||||
if (clipboard->stream_list)
|
if (clipboard->stream_list)
|
||||||
{
|
{
|
||||||
size_t index;
|
size_t index;
|
||||||
@ -905,6 +914,7 @@ static void xf_cliprdr_clear_cached_data(xfClipboard* clipboard)
|
|||||||
{
|
{
|
||||||
ArrayList_Clear(clipboard->ino_list);
|
ArrayList_Clear(clipboard->ino_list);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
|
static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
|
||||||
@ -1239,6 +1249,7 @@ static UINT xf_cliprdr_send_client_format_list_response(xfClipboard* clipboard,
|
|||||||
return clipboard->context->ClientFormatListResponse(clipboard->context, &formatListResponse);
|
return clipboard->context->ClientFormatListResponse(clipboard->context, &formatListResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
/**
|
/**
|
||||||
* Function description
|
* Function description
|
||||||
*
|
*
|
||||||
@ -1353,6 +1364,7 @@ xf_cliprdr_server_file_contents_response(CliprdrClientContext* context,
|
|||||||
ArrayList_Unlock(clipboard->stream_list);
|
ArrayList_Unlock(clipboard->stream_list);
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function description
|
* Function description
|
||||||
@ -1585,6 +1597,7 @@ xf_cliprdr_server_format_data_request(CliprdrClientContext* context,
|
|||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
static char* xf_cliprdr_fuse_split_basename(char* name, int len)
|
static char* xf_cliprdr_fuse_split_basename(char* name, int len)
|
||||||
{
|
{
|
||||||
int s = len - 1;
|
int s = len - 1;
|
||||||
@ -1838,6 +1851,7 @@ error:
|
|||||||
Stream_Free(s, FALSE);
|
Stream_Free(s, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function description
|
* Function description
|
||||||
@ -1886,12 +1900,14 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
|||||||
|
|
||||||
if (strcmp(clipboard->data_format_name, "FileGroupDescriptorW") == 0)
|
if (strcmp(clipboard->data_format_name, "FileGroupDescriptorW") == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_FUSE
|
||||||
/* Build inode table for FILEDESCRIPTORW*/
|
/* Build inode table for FILEDESCRIPTORW*/
|
||||||
if (xf_cliprdr_fuse_generate_list(clipboard, data, size) == FALSE)
|
if (xf_cliprdr_fuse_generate_list(clipboard, data, size) == FALSE)
|
||||||
{
|
{
|
||||||
/* just continue */
|
/* just continue */
|
||||||
WLog_WARN(TAG, "fail to generate list for FILEDESCRIPTOR");
|
WLog_WARN(TAG, "fail to generate list for FILEDESCRIPTOR");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
srcFormatId = ClipboardGetFormatId(clipboard->system, "FileGroupDescriptorW");
|
srcFormatId = ClipboardGetFormatId(clipboard->system, "FileGroupDescriptorW");
|
||||||
dstTargetFormat =
|
dstTargetFormat =
|
||||||
@ -2148,6 +2164,7 @@ static UINT xf_cliprdr_clipboard_file_range_failure(wClipboardDelegate* delegate
|
|||||||
return clipboard->context->ClientFileContentsResponse(clipboard->context, &response);
|
return clipboard->context->ClientFileContentsResponse(clipboard->context, &response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
/* For better understanding the relationship between ino and index of arraylist*/
|
/* For better understanding the relationship between ino and index of arraylist*/
|
||||||
static inline xfCliprdrFuseInode* xf_cliprdr_get_inode(wArrayList* ino_list, fuse_ino_t ino)
|
static inline xfCliprdrFuseInode* xf_cliprdr_get_inode(wArrayList* ino_list, fuse_ino_t ino)
|
||||||
{
|
{
|
||||||
@ -2515,8 +2532,21 @@ static DWORD WINAPI xf_cliprdr_fuse_thread(LPVOID arg)
|
|||||||
}
|
}
|
||||||
clipboard->delegate->basePath = basePath;
|
clipboard->delegate->basePath = basePath;
|
||||||
|
|
||||||
struct fuse_chan* ch;
|
|
||||||
struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
|
struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
|
||||||
|
#if FUSE_USE_VERSION >= 30
|
||||||
|
fuse_opt_add_arg(&args, clipboard->delegate->basePath);
|
||||||
|
if ((clipboard->fuse_sess = fuse_session_new(
|
||||||
|
&args, &xf_cliprdr_fuse_oper, sizeof(xf_cliprdr_fuse_oper), (void*)clipboard)) != NULL)
|
||||||
|
{
|
||||||
|
if (0 == fuse_session_mount(clipboard->fuse_sess, clipboard->delegate->basePath))
|
||||||
|
{
|
||||||
|
fuse_session_loop(clipboard->fuse_sess);
|
||||||
|
fuse_session_unmount(clipboard->fuse_sess);
|
||||||
|
}
|
||||||
|
fuse_session_destroy(clipboard->fuse_sess);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
struct fuse_chan* ch;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((ch = fuse_mount(clipboard->delegate->basePath, &args)) != NULL)
|
if ((ch = fuse_mount(clipboard->delegate->basePath, &args)) != NULL)
|
||||||
@ -2525,17 +2555,14 @@ static DWORD WINAPI xf_cliprdr_fuse_thread(LPVOID arg)
|
|||||||
sizeof(xf_cliprdr_fuse_oper), (void*)clipboard);
|
sizeof(xf_cliprdr_fuse_oper), (void*)clipboard);
|
||||||
if (clipboard->fuse_sess != NULL)
|
if (clipboard->fuse_sess != NULL)
|
||||||
{
|
{
|
||||||
if (fuse_set_signal_handlers(clipboard->fuse_sess) != -1)
|
fuse_session_add_chan(clipboard->fuse_sess, ch);
|
||||||
{
|
err = fuse_session_loop(clipboard->fuse_sess);
|
||||||
fuse_session_add_chan(clipboard->fuse_sess, ch);
|
fuse_session_remove_chan(ch);
|
||||||
err = fuse_session_loop(clipboard->fuse_sess);
|
|
||||||
fuse_remove_signal_handlers(clipboard->fuse_sess);
|
|
||||||
fuse_session_remove_chan(ch);
|
|
||||||
}
|
|
||||||
fuse_session_destroy(clipboard->fuse_sess);
|
fuse_session_destroy(clipboard->fuse_sess);
|
||||||
}
|
}
|
||||||
fuse_unmount(clipboard->delegate->basePath, ch);
|
fuse_unmount(clipboard->delegate->basePath, ch);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
fuse_opt_free_args(&args);
|
fuse_opt_free_args(&args);
|
||||||
|
|
||||||
RemoveDirectoryA(clipboard->delegate->basePath);
|
RemoveDirectoryA(clipboard->delegate->basePath);
|
||||||
@ -2543,6 +2570,7 @@ static DWORD WINAPI xf_cliprdr_fuse_thread(LPVOID arg)
|
|||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
xfClipboard* xf_clipboard_new(xfContext* xfc)
|
xfClipboard* xf_clipboard_new(xfContext* xfc)
|
||||||
{
|
{
|
||||||
@ -2697,6 +2725,7 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
|
|||||||
clipboard->delegate = ClipboardGetDelegate(clipboard->system);
|
clipboard->delegate = ClipboardGetDelegate(clipboard->system);
|
||||||
clipboard->delegate->custom = clipboard;
|
clipboard->delegate->custom = clipboard;
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
clipboard->current_stream_id = 0;
|
clipboard->current_stream_id = 0;
|
||||||
clipboard->stream_list = ArrayList_New(TRUE);
|
clipboard->stream_list = ArrayList_New(TRUE);
|
||||||
if (!clipboard->stream_list)
|
if (!clipboard->stream_list)
|
||||||
@ -2721,6 +2750,7 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
|
|||||||
{
|
{
|
||||||
goto error3;
|
goto error3;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
clipboard->delegate->ClipboardFileSizeSuccess = xf_cliprdr_clipboard_file_size_success;
|
clipboard->delegate->ClipboardFileSizeSuccess = xf_cliprdr_clipboard_file_size_success;
|
||||||
clipboard->delegate->ClipboardFileSizeFailure = xf_cliprdr_clipboard_file_size_failure;
|
clipboard->delegate->ClipboardFileSizeFailure = xf_cliprdr_clipboard_file_size_failure;
|
||||||
@ -2728,12 +2758,14 @@ xfClipboard* xf_clipboard_new(xfContext* xfc)
|
|||||||
clipboard->delegate->ClipboardFileRangeFailure = xf_cliprdr_clipboard_file_range_failure;
|
clipboard->delegate->ClipboardFileRangeFailure = xf_cliprdr_clipboard_file_range_failure;
|
||||||
return clipboard;
|
return clipboard;
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
error3:
|
error3:
|
||||||
|
|
||||||
ArrayList_Free(clipboard->ino_list);
|
ArrayList_Free(clipboard->ino_list);
|
||||||
error2:
|
error2:
|
||||||
|
|
||||||
ArrayList_Free(clipboard->stream_list);
|
ArrayList_Free(clipboard->stream_list);
|
||||||
|
#endif
|
||||||
error:
|
error:
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
@ -2766,6 +2798,7 @@ void xf_clipboard_free(xfClipboard* clipboard)
|
|||||||
free(clipboard->clientFormats[i].formatName);
|
free(clipboard->clientFormats[i].formatName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_FUSE
|
||||||
if (clipboard->fuse_thread)
|
if (clipboard->fuse_thread)
|
||||||
{
|
{
|
||||||
if (clipboard->fuse_sess)
|
if (clipboard->fuse_sess)
|
||||||
@ -2786,6 +2819,7 @@ void xf_clipboard_free(xfClipboard* clipboard)
|
|||||||
// fuse related
|
// fuse related
|
||||||
ArrayList_Free(clipboard->stream_list);
|
ArrayList_Free(clipboard->stream_list);
|
||||||
ArrayList_Free(clipboard->ino_list);
|
ArrayList_Free(clipboard->ino_list);
|
||||||
|
#endif
|
||||||
|
|
||||||
ClipboardDestroy(clipboard->system);
|
ClipboardDestroy(clipboard->system);
|
||||||
free(clipboard->data);
|
free(clipboard->data);
|
||||||
@ -2807,7 +2841,9 @@ void xf_cliprdr_init(xfContext* xfc, CliprdrClientContext* cliprdr)
|
|||||||
cliprdr->ServerFormatDataRequest = xf_cliprdr_server_format_data_request;
|
cliprdr->ServerFormatDataRequest = xf_cliprdr_server_format_data_request;
|
||||||
cliprdr->ServerFormatDataResponse = xf_cliprdr_server_format_data_response;
|
cliprdr->ServerFormatDataResponse = xf_cliprdr_server_format_data_response;
|
||||||
cliprdr->ServerFileContentsRequest = xf_cliprdr_server_file_contents_request;
|
cliprdr->ServerFileContentsRequest = xf_cliprdr_server_file_contents_request;
|
||||||
|
#ifdef WITH_FUSE
|
||||||
cliprdr->ServerFileContentsResponse = xf_cliprdr_server_file_contents_response;
|
cliprdr->ServerFileContentsResponse = xf_cliprdr_server_file_contents_response;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void xf_cliprdr_uninit(xfContext* xfc, CliprdrClientContext* cliprdr)
|
void xf_cliprdr_uninit(xfContext* xfc, CliprdrClientContext* cliprdr)
|
||||||
|
@ -9,26 +9,78 @@ IF (FUSE_INCLUDE_DIR)
|
|||||||
SET (FUSE_FIND_QUIETLY TRUE)
|
SET (FUSE_FIND_QUIETLY TRUE)
|
||||||
ENDIF (FUSE_INCLUDE_DIR)
|
ENDIF (FUSE_INCLUDE_DIR)
|
||||||
|
|
||||||
# find includes
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PATH (FUSE_INCLUDE_DIR fuse.h
|
|
||||||
/usr/local/include/osxfuse
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include
|
|
||||||
)
|
|
||||||
|
|
||||||
# find lib
|
macro(find_fuse2)
|
||||||
if (APPLE)
|
find_path(FUSE_INCLUDE_DIR fuse/fuse_lowlevel.h
|
||||||
SET(FUSE_NAMES libosxfuse.dylib fuse)
|
/usr/local/include/osxfuse
|
||||||
else (APPLE)
|
/usr/local/include
|
||||||
SET(FUSE_NAMES fuse)
|
/usr/include
|
||||||
endif (APPLE)
|
)
|
||||||
FIND_LIBRARY(FUSE_LIBRARIES
|
if (APPLE)
|
||||||
NAMES ${FUSE_NAMES}
|
SET(FUSE_NAMES libosxfuse.dylib fuse)
|
||||||
PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu
|
else ()
|
||||||
)
|
SET(FUSE_NAMES fuse)
|
||||||
|
endif ()
|
||||||
|
FIND_LIBRARY(FUSE_LIBRARIES
|
||||||
|
NAMES ${FUSE_NAMES}
|
||||||
|
PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu
|
||||||
|
)
|
||||||
|
|
||||||
|
if(FUSE_INCLUDE_DIR)
|
||||||
|
file(READ "${FUSE_INCLUDE_DIR}/fuse/fuse_common.h" _FUSE_COMMON_H_CONTENTS)
|
||||||
|
string(REGEX REPLACE "^(.*\n)?#define[ \t]+FUSE_MINOR_VERSION[ \t]+([0-9]+).*"
|
||||||
|
"\\2" FUSE_MINOR_VERSION ${_FUSE_COMMON_H_CONTENTS})
|
||||||
|
if( FUSE_MINOR_VERSION GREATER_EQUAL 6)
|
||||||
|
set(FUSE_API_VERSION 26)
|
||||||
|
else()
|
||||||
|
set(FUSE_API_VERSION 21)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(find_fuse3)
|
||||||
|
find_path(FUSE_INCLUDE_DIR fuse3/fuse_lowlevel.h
|
||||||
|
/usr/local/include/osxfuse
|
||||||
|
/usr/local/include
|
||||||
|
/usr/include
|
||||||
|
)
|
||||||
|
if (APPLE)
|
||||||
|
SET(FUSE_NAMES libosxfuse.dylib fuse3)
|
||||||
|
else ()
|
||||||
|
SET(FUSE_NAMES fuse3)
|
||||||
|
endif ()
|
||||||
|
FIND_LIBRARY(FUSE_LIBRARIES
|
||||||
|
NAMES ${FUSE_NAMES}
|
||||||
|
PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu
|
||||||
|
)
|
||||||
|
|
||||||
|
if(FUSE_INCLUDE_DIR)
|
||||||
|
file(READ "${FUSE_INCLUDE_DIR}/fuse3/fuse_common.h" _FUSE_COMMON_H_CONTENTS)
|
||||||
|
string(REGEX REPLACE "^(.*\n)?#define[ \t]+FUSE_MINOR_VERSION[ \t]+([0-9]+).*"
|
||||||
|
"\\2" FUSE_MINOR_VERSION ${_FUSE_COMMON_H_CONTENTS})
|
||||||
|
if( FUSE_MINOR_VERSION GREATER_EQUAL 5)
|
||||||
|
set(FUSE_API_VERSION 35)
|
||||||
|
else()
|
||||||
|
set(FUSE_API_VERSION 30)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(WITH_FUSE3)
|
||||||
|
find_fuse3()
|
||||||
|
elseif(WITH_FUSE2)
|
||||||
|
find_fuse2()
|
||||||
|
else()
|
||||||
|
find_fuse3()
|
||||||
|
if (NOT FUSE_INCLUDE_DIR)
|
||||||
|
find_fuse2()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include ("FindPackageHandleStandardArgs")
|
|
||||||
find_package_handle_standard_args ("FUSE" DEFAULT_MSG
|
find_package_handle_standard_args ("FUSE" DEFAULT_MSG
|
||||||
FUSE_INCLUDE_DIR FUSE_LIBRARIES)
|
FUSE_LIBRARIES FUSE_INCLUDE_DIR FUSE_API_VERSION)
|
||||||
|
|
||||||
|
|
||||||
mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES)
|
mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES)
|
Loading…
Reference in New Issue
Block a user