Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions dokan_fuse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,42 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)

option(FUSE_PKG_CONFIG "Install a libfuse-compatible pkg-config file (fuse.pc)" ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -mwin32 -Wall")
add_definitions(-D_FILE_OFFSET_BITS=64)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../sys
)

if(FUSE_PKG_CONFIG)
# Defining helper-function to deal with setups that manually set an
# absolute path for CMAKE_INSTALL_(LIB|INCLUDE)DIR...
# We could also just make all paths absolute, but this way the
# pkg-config-file is more human-readable and pkg-config may be able to deal
# with varying prefixes.
# CMake does not have a ternary operator for generator expressions, so this
# looks more complicated than it is.
function ( make_pkg_config_absolute out_path in_path )
if(IS_ABSOLUTE "${${in_path}}")
set(${out_path} "${${in_path}}" PARENT_SCOPE)
else()
set(${out_path} "\${prefix}/${${in_path}}" PARENT_SCOPE)
endif()
endfunction()

set(pkg_config_file "${CMAKE_CURRENT_BINARY_DIR}/fuse.pc")
make_pkg_config_absolute(PKG_CONFIG_LIBDIR CMAKE_INSTALL_LIBDIR)
make_pkg_config_absolute(PKG_CONFIG_INCLUDEDIR CMAKE_INSTALL_INCLUDEDIR)

CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.in"
${pkg_config_file}
@ONLY
)
endif()

file(GLOB sources src/*.cpp src/*.c src/*.rc)
set(install_headers
include/fuse.h
Expand All @@ -30,6 +59,9 @@ add_library(dokanfuse1 SHARED ${sources})

INSTALL(FILES ${install_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fuse/)
INSTALL(FILES ${compat_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(FUSE_PKG_CONFIG)
INSTALL(FILES ${pkg_config_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
INSTALL(TARGETS dokanfuse1
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
4 changes: 2 additions & 2 deletions dokan_fuse/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $script:failed = 0
make install"
& C:\cygwin\bin\bash -lc "
cd '$currentPath' &&
gcc -o '$installDir'/mirror samples/fuse_mirror/fusexmp.c -I '$installDir/include' -D_FILE_OFFSET_BITS=64 -L $installDir/ -lcygdokanfuse1"
gcc -o '$installDir'/mirror samples/fuse_mirror/fusexmp.c `$(PKG_CONFIG_PATH='$installDir/lib/pkgconfig' pkg-config fuse --cflags --libs)"
if ($LASTEXITCODE -ne 0) {
$script:failed = $LASTEXITCODE
}
Expand All @@ -25,7 +25,7 @@ $script:failed = 0
make install"
& C:\cygwin64\bin\bash -lc "
cd '$currentPath' &&
gcc -o '$installDir'/mirror samples/fuse_mirror/fusexmp.c -I '$installDir/include' -D_FILE_OFFSET_BITS=64 -L $installDir/ -lcygdokanfuse1"
gcc -o '$installDir'/mirror samples/fuse_mirror/fusexmp.c `$(PKG_CONFIG_PATH='$installDir/lib/pkgconfig' pkg-config fuse --cflags --libs)"
if ($LASTEXITCODE -ne 0) {
$script:failed = $LASTEXITCODE
}
Expand Down
13 changes: 13 additions & 0 deletions dokan_fuse/pkg-config.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=@PKG_CONFIG_LIBDIR@
includedir=@PKG_CONFIG_INCLUDEDIR@

Name: Dokan FUSE
Description: FUSE-API compatibility library for the Dokan user mode filesystem driver for Windows
# Dokan FUSE provides compatibility with libfuse 2.6.x.
# The corresponding libfuse-version is therefore reported instead of the Dokan FUSE-version
Version: 2.6.0
URL: https://dokan-dev.github.io
Libs: -L${libdir} -l@PROJECT_NAME@
Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64