[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2190: Fix compilation with CMake under MinGW. (in trunk: . src/torcontrol src/vidalia src/vidalia/config)
Author: edmanm
Date: 2007-12-06 23:43:50 -0500 (Thu, 06 Dec 2007)
New Revision: 2190
Modified:
trunk/VidaliaMacros.cmake
trunk/src/torcontrol/torservice.cpp
trunk/src/vidalia/CMakeLists.txt
trunk/src/vidalia/config/advancedpage.cpp
Log:
Fix compilation with CMake under MinGW.
Modified: trunk/VidaliaMacros.cmake
===================================================================
--- trunk/VidaliaMacros.cmake 2007-12-07 02:52:20 UTC (rev 2189)
+++ trunk/VidaliaMacros.cmake 2007-12-07 04:43:50 UTC (rev 2190)
@@ -31,6 +31,17 @@
endif(NOT lrelease_CMD)
+## We need windres.exe when building on MinGW to compile the .rc file
+if (MINGW)
+ find_program(windres_CMD NAMES windres.exe ${QT_BINARY_DIR})
+ if (NOT windres_CMD)
+ message(FATAL_ERR
+ "Vidalia could not find windres. Please make sure MinGW is installed."
+ )
+ endif(NOT windres_CMD)
+endif(MINGW)
+
+
## Wraps the supplied .ts files in lrelease commands
macro(QT4_ADD_TRANSLATIONS outfiles)
foreach (it ${ARGN})
@@ -47,3 +58,23 @@
endforeach(it)
endmacro(QT4_ADD_TRANSLATIONS)
+
+if (MINGW)
+ ## Wraps the supplied .rc files in windres commands
+ macro(MINGW_WRAP_RC outfiles)
+ foreach(it ${ARGN})
+ get_filename_component(it ${it} ABSOLUTE)
+ get_filename_component(outfile ${it} NAME_WE)
+ get_filename_component(rc_path ${it} PATH)
+
+ set(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}_res.o)
+ add_custom_command(OUTPUT ${outfile}
+ COMMAND ${windres_CMD}
+ ARGS -i ${it} -o ${outfile} --include-dir=${rc_path}
+ MAIN_DEPENDENCY ${it}
+ )
+ set(${outfiles} ${${outfiles}} ${outfile})
+ endforeach(it)
+ endmacro(MINGW_WRAP_RC)
+endif(MINGW)
+
Modified: trunk/src/torcontrol/torservice.cpp
===================================================================
--- trunk/src/torcontrol/torservice.cpp 2007-12-07 02:52:20 UTC (rev 2189)
+++ trunk/src/torcontrol/torservice.cpp 2007-12-07 04:43:50 UTC (rev 2190)
@@ -26,7 +26,6 @@
*/
#include <QLibrary>
-#include <vidalia.h>
#include "torservice.h"
@@ -70,7 +69,6 @@
#define LOAD_SERVICE_FN(f) do { \
void *fn; \
if (!((fn = QLibrary::resolve("advapi32", #f)))) { \
- vWarn("Unable to load NT service function: %1").arg(#f); \
return false; \
} else { \
_service_fns.f = (f ## _fn) fn; \
@@ -151,7 +149,7 @@
SC_HANDLE service = openService();
if (!service) {
- vWarn("Bug: We tried to start the Tor service, but it is not installed.");
+// vWarn("Bug: We tried to start the Tor service, but it is not installed.");
emit startFailed(tr("The Tor service is not installed."));
return;
}
@@ -159,7 +157,7 @@
/* Starting a service can take up to 30 seconds! */
if (status() != SERVICE_RUNNING) {
int tries = 0;
- vNotice("Starting the Tor service.");
+// vNotice("Starting the Tor service.");
_service_fns.StartServiceA(service, 0, NULL);
while ((status() != SERVICE_RUNNING) && ++tries <= 5)
@@ -169,7 +167,7 @@
if (status() == SERVICE_RUNNING) {
emit started();
} else {
- vWarn("Unable to start the Tor service.");
+// vWarn("Unable to start the Tor service.");
emit startFailed(tr("Unable to start the Tor service."));
}
closeHandle(service);
@@ -187,7 +185,7 @@
if (status() != SERVICE_STOPPED) {
SERVICE_STATUS stat;
stat.dwCurrentState = SERVICE_RUNNING;
- vNotice("Stopping the Tor service.");
+// vNotice("Stopping the Tor service.");
if (_service_fns.ControlService(service, SERVICE_CONTROL_STOP, &stat)) {
/* XXX Five seconds isn't long enough to wait when we're stopping a Tor
* that is running as a server, but we don't want to block for 30
@@ -206,7 +204,7 @@
return true;
}
/* XXX This needs an actual reason message. */
- vWarn("Unable to stop the Tor service.");
+// vWarn("Unable to stop the Tor service.");
return false;
}
@@ -263,8 +261,8 @@
.arg(torrc)
.arg(controlPort);
- vNotice("Installing the Tor service using the command line '%1'")
- .arg(command);
+// vNotice("Installing the Tor service using the command line '%1'")
+// .arg(command);
service = _service_fns.CreateServiceA(_scm,
(LPCTSTR)TOR_SERVICE_NAME, (LPCTSTR)TOR_SERVICE_DISP,
TOR_SERVICE_ACCESS, SERVICE_WIN32_OWN_PROCESS,
@@ -273,7 +271,7 @@
NULL, NULL);
if (!service) {
/* XXX This needs an actual reason message. */
- vWarn("Failed to install the Tor service.");
+// vWarn("Failed to install the Tor service.");
return false;
}
@@ -296,13 +294,13 @@
if (service) {
stop();
- vNotice("Removing the Tor service.");
+// vNotice("Removing the Tor service.");
removed = _service_fns.DeleteService(service);
closeHandle(service);
}
if (!removed) {
/* XXX This needs an actual reason message. */
- vWarn("Failed to remove the Tor service.");
+// vWarn("Failed to remove the Tor service.");
}
return removed;
}
Modified: trunk/src/vidalia/CMakeLists.txt
===================================================================
--- trunk/src/vidalia/CMakeLists.txt 2007-12-07 02:52:20 UTC (rev 2189)
+++ trunk/src/vidalia/CMakeLists.txt 2007-12-07 04:43:50 UTC (rev 2190)
@@ -151,7 +151,7 @@
qt4_wrap_cpp(vidalia_SRCS tray/trayicon.h)
if(WIN32)
set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_win.cpp)
- qt4_wrap_cpp(vidlaia_SRCS tray/trayicon_win.h)
+ qt4_wrap_cpp(vidalia_SRCS tray/trayicon_win.h)
else(WIN32)
if(APPLE)
set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_mac.cpp)
@@ -219,7 +219,11 @@
else(APPLE)
if (WIN32)
## Create a Windows binary
- qt4_add_resources(vidalia_SRCS res/vidalia_win.rc)
+ if (MINGW)
+ mingw_wrap_rc(vidalia_SRCS res/vidalia_win.rc)
+ else (MINGW)
+ qt4_add_resources(vidalia_SRCS res/vidalia_win.rc)
+ endif(MINGW)
add_executable(vidalia WIN32 ${vidalia_SRCS})
else (WIN32)
## Non-Windows, non-Mac
@@ -234,6 +238,14 @@
torcontrol
util
)
+if (MINGW)
+ target_link_libraries(vidalia
+ ole32
+ oleaut32
+ uuid
+ winspool
+ )
+endif(MINGW)
## Specify the files to be installed
install(TARGETS vidalia DESTINATION bin)
Modified: trunk/src/vidalia/config/advancedpage.cpp
===================================================================
--- trunk/src/vidalia/config/advancedpage.cpp 2007-12-07 02:52:20 UTC (rev 2189)
+++ trunk/src/vidalia/config/advancedpage.cpp 2007-12-07 04:43:50 UTC (rev 2190)
@@ -36,7 +36,7 @@
#include "advancedpage.h"
#if defined(Q_WS_WIN)
-#include <control/torservice.h>
+#include <torservice.h>
#endif