Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dokan_fuse build system enhancements #337

Merged
merged 12 commits into from
Sep 20, 2016
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ReleasePS
/dokan_wix/Bootstrapper/Redist
/*.opendb
/dokan_wix/msbuild.log
/dokan_fuse/build/
/dokan_fuse/CMakeFiles
/dokan_fuse/CMakeCache.txt
/dokan_fuse/cygdokanfuse1.dll
Expand Down
49 changes: 28 additions & 21 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@ set PATH=%PATH%;%PROGRAMFILES(x86)%\MSBuild\14.0\Bin
set VCTargetsPath=%PROGRAMFILES%
IF %processor_architecture%==AMD64 set VCTargetsPath=%PROGRAMFILES(x86)%
set VCTargetsPath=%VCTargetsPath%\MSBuild\Microsoft.Cpp\v4.0\V140
SET failed=0

REM Build
msbuild dokan.sln /p:Configuration=Release /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration=Release /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win7 Release" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win7 Release" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win8 Release" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win8 Release" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win8.1 Release" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win8.1 Release" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win10 Release" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win10 Release" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration=Release /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration=Release /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win7 Release" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win7 Release" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8 Release" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8 Release" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8.1 Release" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8.1 Release" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win10 Release" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win10 Release" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%

msbuild dokan.sln /p:Configuration=Debug /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration=Debug /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win7 Debug" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win7 Debug" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win8 Debug" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win8 Debug" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win8.1 Debug" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win8.1 Debug" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration="Win10 Debug" /p:Platform=Win32 /t:Build
msbuild dokan.sln /p:Configuration="Win10 Debug" /p:Platform=x64 /t:Build
msbuild dokan.sln /p:Configuration=Debug /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration=Debug /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win7 Debug" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win7 Debug" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8 Debug" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8 Debug" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8.1 Debug" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win8.1 Debug" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win10 Debug" /p:Platform=Win32 /t:Build || set failed=%ERRORLEVEL%
msbuild dokan.sln /p:Configuration="Win10 Debug" /p:Platform=x64 /t:Build || set failed=%ERRORLEVEL%

IF EXIST C:\cygwin ( Powershell.exe -executionpolicy remotesigned -File dokan_fuse/build.ps1 || set failed=%ERRORLEVEL% ) ELSE ( echo "Cygwin/Msys2 build disabled" )

@if %failed% neq 0 (
echo At least one build-command failed. The last command that failed returned with error %failed% 1>&2
exit /b %failed%
)

IF EXIST C:\cygwin ( Powershell.exe -executionpolicy remotesigned -File dokan_fuse/build.ps1 ) ELSE ( echo "Cygwin/Msys2 build disabled" )
44 changes: 32 additions & 12 deletions dokan_fuse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
cmake_minimum_required(VERSION 2.8.4)
cmake_minimum_required(VERSION 2.8.5)
project(dokanfuse1)
include(GNUInstallDirs)

project (dokanfuse1)

set(CMAKE_LEGACY_CYGWIN_WIN32 0)

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -mwin32")
if(NOT CMAKE_BUILD_TYPE)
message("No CMAKE_BUILD_TYPE specified, defaulting to Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)

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
)

file(GLOB source src/*.cpp src/*.c)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../sys)
file(GLOB sources src/*.cpp src/*.c src/*.rc)
set(install_headers
include/fuse.h
include/fuse_common.h
include/fuse_opt.h
include/fuse_sem_fix.h
include/fuse_win.h
include/utils.h
)
set(compat_headers
include/old/fuse.h
)
add_library(dokanfuse1 SHARED ${sources})

add_library(dokanfuse1 SHARED ${source})
INSTALL(FILES ${install_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fuse/)
INSTALL(FILES ${compat_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
INSTALL(TARGETS dokanfuse1
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
100 changes: 63 additions & 37 deletions dokan_fuse/build.ps1
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,39 +1,65 @@
$currentPath=Get-Location
$script:failed = 0
& {
$buildDir="dokan_fuse/build/Win32/Cygwin/"
$installDir="Win32/Cygwin/"
New-Item -Force -Type Directory $buildDir
& C:\cygwin\bin\bash -lc "
cd '$currentPath'/'$buildDir' &&
cmake ../../../ -DCMAKE_INSTALL_PREFIX='../../../../$installDir' -DCMAKE_INSTALL_BINDIR=. &&
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"
if ($LASTEXITCODE -ne 0) {
$script:failed = $LASTEXITCODE
}
}
& {
$buildDir="dokan_fuse/build/x64/Cygwin/"
$installDir="x64/Cygwin/"
New-Item -Force -Type Directory $buildDir
& C:\cygwin64\bin\bash -lc "
cd '$currentPath'/'$buildDir' &&
cmake ../../../ -DCMAKE_INSTALL_PREFIX='../../../../$installDir' -DCMAKE_INSTALL_BINDIR=. &&
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"
if ($LASTEXITCODE -ne 0) {
$script:failed = $LASTEXITCODE
}
}
& {
$buildDir="dokan_fuse/build/Win32/Msys2/"
$installDir="Win32/Msys2/"
New-Item -Force -Type Directory $buildDir
$env:MSYSTEM = "MINGW32"
& C:\msys64\usr\bin\bash -lc "
cd '$currentPath'/'$buildDir' &&
cmake ../../../ -DCMAKE_INSTALL_PREFIX='../../../../$installDir' -DCMAKE_INSTALL_BINDIR=. -G 'MSYS Makefiles' &&
make install"
}
Remove-Item Env:\MSYSTEM
if ($LASTEXITCODE -ne 0) {
$script:failed = $LASTEXITCODE
}
& {
$buildDir="dokan_fuse/build/x64/Msys2/"
$installDir="x64/Msys2/"
New-Item -Force -Type Directory $buildDir
$env:MSYSTEM = "MINGW64"
& C:\msys64\usr\bin\bash -lc "
cd '$currentPath'/'$buildDir' &&
cmake ../../../ -DCMAKE_INSTALL_PREFIX='../../../../$installDir' -DCMAKE_INSTALL_BINDIR=. -G 'MSYS Makefiles' &&
make install"
Remove-Item Env:\MSYSTEM
if ($LASTEXITCODE -ne 0) {
$script:failed = $LASTEXITCODE
}
}

& dokan_fuse/cleancmake.bat
Write-Host "Build Cygwin x86..."
& C:\cygwin\bin\bash -lc "cd '$currentPath'/dokan_fuse/ && cmake . && make"
& C:\cygwin\bin\bash -lc "cd '$currentPath'/samples/fuse_mirror/ && gcc -o mirror fusexmp.c -I../../dokan_fuse/include -D_FILE_OFFSET_BITS=64 -L../../dokan_fuse -lcygdokanfuse1"
New-Item -Force -Type Directory "Win32/Cygwin/"
copy-item "dokan_fuse/cygdokanfuse1.dll" "Win32/Cygwin/"
copy-item "samples/fuse_mirror/mirror.exe" "Win32/Cygwin/"
Remove-Item "dokan_fuse/cygdokanfuse1.dll"
Remove-Item "samples/fuse_mirror/mirror.exe"
Write-Host "Build Cygwin x86 - Done" -ForegroundColor Green

& dokan_fuse/cleancmake.bat
Write-Host "Build Cygwin x64..."
& C:\cygwin64\bin\bash -lc "cd '$currentPath'/dokan_fuse/ && cmake . && make"
& C:\cygwin64\bin\bash -lc "cd '$currentPath'/samples/fuse_mirror/ && gcc -o mirror fusexmp.c -I../../dokan_fuse/include -D_FILE_OFFSET_BITS=64 -L../../dokan_fuse -lcygdokanfuse1"
New-Item -Force -Type Directory "x64/Cygwin/"
copy-item "dokan_fuse/cygdokanfuse1.dll" "x64/Cygwin/"
copy-item "samples/fuse_mirror/mirror.exe" "x64/Cygwin/"
Remove-Item "dokan_fuse/cygdokanfuse1.dll"
Remove-Item "samples/fuse_mirror/mirror.exe"
Write-Host "Build Cygwin x64 - Done" -ForegroundColor Green

& dokan_fuse/cleancmake.bat
Write-Host "Build Msys2 x86..."
& C:\msys64\msys2_shell.cmd -mingw32 -lc "cd '$currentPath'/dokan_fuse/ && cmake . -G 'MSYS Makefiles' && make" | Out-Host
New-Item -Force -Type Directory "Win32/Msys2/"
copy-item "dokan_fuse/libdokanfuse1.dll" "Win32/Msys2/"
Remove-Item "dokan_fuse/libdokanfuse1.dll"
Write-Host "Build Msys2 x86 - Done" -ForegroundColor Green

& dokan_fuse/cleancmake.bat
Write-Host "Build Msys2 x64..."
& C:\msys64\msys2_shell.cmd -mingw64 -lc "cd '$currentPath'/dokan_fuse/ && cmake . -G 'MSYS Makefiles' && make" | Out-Host
New-Item -Force -Type Directory "x64/Msys2/"
copy-item "dokan_fuse/libdokanfuse1.dll" "x64/Msys2/"
Remove-Item "dokan_fuse/libdokanfuse1.dll"
Write-Host "Build Msys2 x64 - Done" -ForegroundColor Green
if ($LASTEXITCODE -ne 0) {
Write-Error "At least one build-command failed. The last command that failed returned with error $script:failed"
Exit $script:failed
}
Loading