Add Dokan to the build system on Windows

This commit is contained in:
Sebastian Messmer 2018-09-15 17:42:32 -07:00
parent 347be60ba6
commit 61451069e8
3 changed files with 26 additions and 7 deletions

View File

@ -19,6 +19,10 @@ option(BUILD_TESTING "build test cases" OFF)
option(CRYFS_UPDATE_CHECKS "let cryfs check for updates and security vulnerabilities" ON)
option(DISABLE_OPENMP "allow building without OpenMP libraries. This will cause performance degradations." OFF)
if (MSVC)
option(DOKAN_LIB_PATH "Location of the Dokan library, e.g. C:\\Program Files\\Dokan\\DokanLibrary-1.1.0" "")
endif()
# Default value is to build in release mode
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE INTERNAL "CMAKE_BUILD_TYPE")

View File

@ -71,6 +71,16 @@ You can pass the following variables to the *cmake* command (using *-Dvariablena
- **-DBUILD_TESTING**=[on|off]: Whether to build the test cases (can take a long time). Default: off
- **-DCRYFS_UPDATE_CHECKS**=off: Build a CryFS that doesn't check online for updates and security vulnerabilities.
Building on Windows (experimental)
---------------
Build with Visual Studio 2017 and pass in the following flags to CMake:
-DDOKAN_LIB_PATH=[dokan library location, e.g. "C:\Program Files\Dokan\DokanLibrary-1.1.0"]
-DCURL_LIBRARY=[path to libcurl.dll.a, e.g. "C:\ProgramData\chocolatey\lib\curl\tools\curl-7.61.1-win64-mingw\lib\libcurl.dll.a"]
-DCURL_INCLUDE_DIR=[path to libcurl include files, e.g. "C:\ProgramData\chocolatey\lib\curl\tools\curl-7.61.1-win64-mingw\include"]
-DBOOST_ROOT=[path to root of boost installation]
Troubleshooting
---------------

View File

@ -15,12 +15,17 @@ target_add_boost(${PROJECT_NAME} filesystem system thread chrono)
target_enable_style_warnings(${PROJECT_NAME})
target_activate_cpp14(${PROJECT_NAME})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_include_directories(${PROJECT_NAME} PUBLIC "${DOKAN_LIB_PATH}\\include")
target_link_libraries(${PROJECT_NAME} PUBLIC "${DOKAN_LIB_PATH}\\lib\\dokan1.lib")
#target_link_libraries(${PROJECT_NAME} PUBLIC "${DOKAN_LIB_PATH}\\lib\\dokannp1.lib")
target_link_libraries(${PROJECT_NAME} PUBLIC "${DOKAN_LIB_PATH}\\lib\\dokanfuse1.lib")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_FIND_FRAMEWORK LAST)
set(FUSE_LIB_NAME "osxfuse")
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(FUSE_LIB_NAME "fuse")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library_with_path(FUSE "osxfuse" FUSE_LIB_PATH)
target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})
else() # Linux
find_library_with_path(FUSE "fuse" FUSE_LIB_PATH)
target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})
endif()
find_library_with_path(FUSE ${FUSE_LIB_NAME} FUSE_LIB_PATH)
target_link_libraries(${PROJECT_NAME} PUBLIC ${FUSE})