make it compile on windows

This commit is contained in:
lins05 2013-09-27 17:17:12 +08:00
parent b56387335e
commit 1e8cbf6590
7 changed files with 56 additions and 12 deletions

16
Application.manifest Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
</assembly>

View file

@ -6,6 +6,18 @@ INCLUDE(FindPkgConfig)
SET(CMAKE_BUILD_TYPE Debug)
IF (MSYS)
SET(EXTRA_LIBS ${EXTRA_LIBS} psapi)
# SET(CMAKE_RC_COMPILER_INIT windres)
# ENABLE_LANGUAGE(RC)
# SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
SET(EXTRA_SOURCES ${EXTRA_SOURCES} seafile-applet.rc)
ENDIF (MSYS)
####################
###### BEGIN: QT configuration
####################
@ -185,13 +197,11 @@ ADD_EXECUTABLE(seafile-applet
${moc_output}
${ui_output}
${resources_ouput}
${EXTRA_SOURCES}
)
INSTALL(TARGETS seafile-applet DESTINATION bin)
if (MSYS)
set(EXTRA_LIBS ${EXTRA_LIBS} psapi)
endif (MSYS)
TARGET_LINK_LIBRARIES(seafile-applet
${QT_LIBRARIES}
@ -209,4 +219,4 @@ set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
add_custom_target(dist
COMMAND git archive -v --prefix=${ARCHIVE_NAME}/ HEAD
| gzip > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

1
seafile-applet.rc Normal file
View file

@ -0,0 +1 @@
1 24 DISCARDABLE Application.manifest

View file

@ -11,6 +11,12 @@
#include "configurator.h"
#if defined(Q_WS_WIN)
#include <ShlObj.h>
#include <shlwapi.h>
#endif
namespace {
#if defined(Q_WS_WIN)

View file

@ -7,10 +7,14 @@
namespace {
#if defined(Q_WS_WIN)
#include <ShlObj.h>
#include <shlwapi.h>
static QString
get_largest_drive()
{
wchar_t drives[SEAF_PATH_MAX];
wchar_t drives[MAX_PATH];
wchar_t *p, *largest_drive;
ULARGE_INTEGER free_space;
ULARGE_INTEGER largest_free_space;
@ -34,8 +38,8 @@ get_largest_drive()
}
} else {
applet_warning ("failed to GetDiskFreeSpaceEx(), GLE=%lu\n",
GetLastError());
qDebug ("failed to GetDiskFreeSpaceEx(), GLE=%lu\n",
GetLastError());
}
}

View file

@ -1,8 +1,16 @@
#include "process.h"
#include <windows.h>
#include <psapi.h>
#include <assert.h>
#include <errno.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include "process.h"
namespace {
HANDLE
@ -87,8 +95,8 @@ void shutdown_process (const char *name)
int count_process (const char *process_name_in)
{
char name[SEAF_PATH_MAX];
char process_name[SEAF_PATH_MAX];
char name[MAX_PATH];
char process_name[MAX_PATH];
DWORD aProcesses[1024], cbNeeded, cProcesses;
HANDLE hProcess;
HMODULE hMods[1024];

View file

@ -3,7 +3,6 @@
#include <errno.h>
#include <dirent.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sqlite3.h>