## ## $Id$ ## ## This file is part of Vidalia, and is subject to the license terms in the ## LICENSE file, found in the top level directory of this distribution. If ## you did not receive the LICENSE file with this file, you may obtain it ## from the Vidalia source package distributed by the Vidalia Project at ## http://www.vidalia-project.net/. No part of Vidalia, including this file, ## may be copied, modified, propagated, or distributed except according to ## the terms described in the LICENSE file. ## include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/config ${CMAKE_CURRENT_SOURCE_DIR}/help/browser ${MARBLE_INCLUDE_DIR} ) if (APPLE OR WIN32) ## ## XXX: The Marble build system on OS X currently doesn't actually install the ## required include files to /usr/local/include or similar. Instead, we have ## to pluck them directly from the source tree. Ick. ## include_directories( ${MARBLE_INCLUDE_DIR}/AbstractLayer ${MARBLE_INCLUDE_DIR}/geodata ${MARBLE_INCLUDE_DIR}/geodata/data ${MARBLE_INCLUDE_DIR}/geodata/handlers ${MARBLE_INCLUDE_DIR}/geodata/parser ${MARBLE_INCLUDE_DIR}/geodata/scene ${MARBLE_INCLUDE_DIR}/Projections ) endif(APPLE OR WIN32) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc.in ${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/i18n/vidalia_i18n.qrc ${CMAKE_CURRENT_BINARY_DIR}/i18n/vidalia_i18n.qrc ) ## Process the translation files add_subdirectory(i18n) ## About dialog sources set(vidalia_SRCS about/aboutdialog.cpp about/licensedialog.cpp ) qt4_wrap_cpp(vidalia_SRCS about/aboutdialog.h about/licensedialog.h ) ## Bandwidth graph sources set(vidalia_SRCS ${vidalia_SRCS} bwgraph/bwgraph.cpp bwgraph/graphframe.cpp ) qt4_wrap_cpp(vidalia_SRCS bwgraph/bwgraph.h bwgraph/graphframe.h ) ## Configuration dialog sources set(vidalia_SRCS ${vidalia_SRCS} config/abstracttorsettings.cpp config/advancedpage.cpp config/appearancepage.cpp config/bridgeusagedialog.cpp config/configdialog.cpp config/configpagestack.cpp config/domainvalidator.cpp config/exitpolicy.cpp config/generalpage.cpp config/ipvalidator.cpp config/networkpage.cpp config/networksettings.cpp config/nicknamevalidator.cpp config/policy.cpp config/portvalidator.cpp config/serverpage.cpp config/serversettings.cpp config/service.cpp config/servicelist.cpp config/servicepage.cpp config/servicesettings.cpp config/torsettings.cpp config/vidaliasettings.cpp config/vsettings.cpp ) qt4_wrap_cpp(vidalia_SRCS config/abstracttorsettings.h config/advancedpage.h config/appearancepage.h config/bridgeusagedialog.h config/configdialog.h config/configpage.h config/configpagestack.h config/domainvalidator.h config/generalpage.h config/networkpage.h config/networksettings.h config/nicknamevalidator.h config/portvalidator.h config/serverpage.h config/serversettings.h config/servicepage.h config/torsettings.h config/vidaliasettings.h config/vsettings.h ) if (USE_MINIUPNPC) include_directories(${MINIUPNPC_INCLUDE_DIR}) set(vidalia_SRCS ${vidalia_SRCS} config/upnpcontrol.cpp config/upnpcontrolthread.cpp config/upnptestdialog.cpp ) qt4_wrap_cpp(vidalia_SRCS config/upnpcontrol.h config/upnpcontrolthread.h config/upnptestdialog.h ) endif(USE_MINIUPNPC) ## Help browser sources set(vidalia_SRCS ${vidalia_SRCS} help/browser/helpbrowser.cpp help/browser/helptextbrowser.cpp ) qt4_wrap_cpp(vidalia_SRCS help/browser/helpbrowser.h help/browser/helptextbrowser.h ) ## Message log sources set(vidalia_SRCS ${vidalia_SRCS} log/logfile.cpp log/logheaderview.cpp log/logmessagecolumndelegate.cpp log/logtreeitem.cpp log/logtreewidget.cpp log/messagelog.cpp ) qt4_wrap_cpp(vidalia_SRCS log/logfile.h log/logheaderview.h log/logtreewidget.h log/messagelog.h ) ## Network map sources set(vidalia_SRCS ${vidalia_SRCS} network/circuititem.cpp network/circuitlistwidget.cpp network/geoipcache.cpp network/geoipcacheitem.cpp network/geoip.cpp network/geoiprequest.cpp network/geoipresolver.cpp network/geoipresponse.cpp network/netviewer.cpp network/routerdescriptorview.cpp network/routerinfodialog.cpp network/routerlistitem.cpp network/routerlistwidget.cpp network/streamitem.cpp ) qt4_wrap_cpp(vidalia_SRCS network/circuitlistwidget.h network/geoipresolver.h network/netviewer.h network/routerdescriptorview.h network/routerinfodialog.h network/routerlistwidget.h ) if (USE_MARBLE) set(vidalia_SRCS ${vidalia_SRCS} network/tormapwidget.cpp network/tormapwidgetinputhandler.cpp network/tormapwidgetpopupmenu.cpp ) qt4_wrap_cpp(vidalia_SRCS network/tormapwidget.h network/tormapwidgetinputhandler.h network/tormapwidgetpopupmenu.h ) else(USE_MARBLE) set(vidalia_SRCS ${vidalia_SRCS} network/tormapimageview.cpp network/zimageview.cpp ) qt4_wrap_cpp(vidalia_SRCS network/tormapimageview.h network/zimageview.h ) endif(USE_MARBLE) ## Choose the correct tray icon implementation for the current platform set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon.cpp) qt4_wrap_cpp(vidalia_SRCS tray/trayicon.h) if(APPLE) set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_mac.cpp) qt4_wrap_cpp(vidalia_SRCS tray/trayicon_mac.h) else(APPLE) ## Use Qt's QSystemTrayIcon implementation set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_qt.cpp) qt4_wrap_cpp(vidalia_SRCS tray/trayicon_qt.h) endif(APPLE) ## Main Vidalia sources set(vidalia_SRCS ${vidalia_SRCS} main.cpp vidalia.cpp languagesupport.cpp mainwindow.cpp vclicklabel.cpp vidaliawindow.cpp vmessagebox.cpp helperprocess.cpp controlpasswordinputdialog.cpp ) qt4_wrap_cpp(vidalia_SRCS vidalia.h mainwindow.h vclicklabel.h vidaliawindow.h vmessagebox.h helperprocess.h controlpasswordinputdialog.h ) ## Specify all the Qt Designer .ui files qt4_wrap_ui(vidalia_SRCS controlpasswordinputdialog.ui mainwindow.ui about/aboutdialog.ui about/licensedialog.ui bwgraph/bwgraph.ui config/advancedpage.ui config/appearancepage.ui config/bridgeusagedialog.ui config/configdialog.ui config/generalpage.ui config/networkpage.ui config/serverpage.ui config/servicepage.ui help/browser/helpbrowser.ui log/messagelog.ui network/netviewer.ui network/routerinfodialog.ui ) if (USE_MINIUPNPC) qt4_wrap_ui(vidalia_SRCS config/upnptestdialog.ui) endif(USE_MINIUPNPC) if (USE_AUTOUPDATE) set(vidalia_SRCS ${vidalia_SRCS} packageinfo.cpp updateprocess.cpp updateprogressdialog.cpp updatesavailabledialog.cpp ) qt4_wrap_cpp(vidalia_SRCS updateprocess.h updateprogressdialog.h updatesavailabledialog.h ) qt4_wrap_ui(vidalia_SRCS updateprogressdialog.ui updatesavailabledialog.ui ) endif(USE_AUTOUPDATE) ## Add the resource files (icons, etc.) qt4_add_resources(vidalia_SRCS res/vidalia.qrc help/content/content.qrc ${CMAKE_CURRENT_BINARY_DIR}/i18n/vidalia_i18n.qrc ) ## Specify the map data Marble will need set(marble_DATA landcolors.leg seacolors.leg maps/earth/bluemarble/bluemarble.dgml maps/earth/citylights/citylights.dgml maps/earth/srtm/srtm.dgml maps/earth/srtm/srtm.jpg mwdbii/DATELINE.PNT mwdbii/PAUST.PNT mwdbii/PBORDER.PNT mwdbii/PCANPROV.PNT mwdbii/PCOAST.PNT mwdbii/PDIFFBORDER.PNT mwdbii/PGLACIER.PNT mwdbii/PISLAND.PNT mwdbii/PLAKE.PNT mwdbii/PLAKEISLAND.PNT mwdbii/PMEXICO.PNT mwdbii/PUSA48.DIFF.PNT mwdbii/PUSA48.PNT mwdbii/RIVER.PNT placemarks/baseplacemarks.cache placemarks/boundaryplacemarks.cache placemarks/elevplacemarks.cache stars/stars.dat svg/worldmap.svg ) ## Set the appropriate executable target for the current platform if (APPLE) ## Set the output file name (make it uppercase on OS X) set(vidalia_BIN Vidalia) ## Create an OS X application bundle set(MACOSX_BUNDLE_BUNDLE_NAME Vidalia) set(MACOSX_BUNDLE_BUNDLE_VERSION ${VERSION}) set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${VERSION}) set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${VERSION}") set(MACOSX_BUNDLE_ICON_FILE vidalia.icns) set(MACOSX_BUNDLE_GUI_IDENTIFIER "net.vidalia-project.vidalia") set(MACOSX_BUNDLE_INFO_STRING "Vidalia ${VERSION}") ## Put everything inside the application bundle set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/) add_executable(${vidalia_BIN} MACOSX_BUNDLE ${vidalia_SRCS}) ## Include the bundle resource files add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources COMMAND cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/res/icons/*.icns ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/ ) if (USE_MARBLE) ## Copy the Marble data into the bundle set(outdir ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/MacOS) foreach(it ${marble_DATA}) get_filename_component(outdir ${it} PATH) get_filename_component(outfile ${it} NAME) set(outdir Vidalia.app/Contents/Resources/data/${outdir}) add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir} COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${MARBLE_DATA_DIR}/${it} ${CMAKE_CURRENT_BINARY_DIR}/${outdir}/${outfile} ) endforeach(it) ## Create the Marble plugins directory and copy in any wanted plugins if (MARBLE_PLUGINS) add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins ) foreach(it ${MARBLE_PLUGINS}) add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${it} ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins/ ) endforeach(it) endif(MARBLE_PLUGINS) endif(USE_MARBLE) else(APPLE) ## Set the output file name set(vidalia_BIN vidalia) if (WIN32) ## Create a Windows binary win32_wrap_rc(vidalia_SRCS res/vidalia_win.rc) add_executable(${vidalia_BIN} WIN32 ${vidalia_SRCS}) ## Copy the Marble data into the data/ directory under the binary if (USE_MARBLE) foreach(it ${marble_DATA}) get_filename_component(outdir ${it} PATH) get_filename_component(outfile ${it} NAME) add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir} COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${MARBLE_DATA_DIR}/${it} ${CMAKE_CURRENT_BINARY_DIR}/data/${it} ) endforeach(it) ## Create the Marble plugins directory and copy in any wanted plugins if (MARBLE_PLUGINS) add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/plugins/marble ) foreach(it ${MARBLE_PLUGINS}) add_custom_command(TARGET ${vidalia_BIN} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${it} ${CMAKE_CURRENT_BINARY_DIR}/plugins/marble/ ) endforeach(it) endif(MARBLE_PLUGINS) endif(USE_MARBLE) else (WIN32) ## Non-Windows, non-Mac add_executable(${vidalia_BIN} ${vidalia_SRCS}) endif(WIN32) endif(APPLE) add_dependencies(${vidalia_BIN} i18n) ## Link to the Qt libraries and other libraries built as a part of Vidalia target_link_libraries(${vidalia_BIN} ${QT_LIBRARIES} ${MARBLE_LIBRARIES} common torcontrol ) if (USE_MINIUPNPC) target_link_libraries(${vidalia_BIN} miniupnpc) endif(USE_MINIUPNPC) if (USE_MARBLE) target_link_libraries(${vidalia_BIN} ${MARBLE_LIBRARIES}) endif(USE_MARBLE) if (WIN32) target_link_libraries(${vidalia_BIN} ${QT_QTMAIN_LIBRARY} ) endif(WIN32) if (APPLE) target_link_libraries(${vidalia_BIN} "-framework AppKit" iconv ) endif(APPLE) ## Specify the files to be installed install(TARGETS ${vidalia_BIN} DESTINATION bin) if(NOT WIN32 AND NOT APPLE) install(FILES vidalia.desktop DESTINATION share/applications) install(FILES res/16x16/tor-logo.png RENAME vidalia.png DESTINATION share/icons/hicolor/16x16/apps) install(FILES res/22x22/tor-logo.png RENAME vidalia.png DESTINATION share/icons/hicolor/22x22/apps) install(FILES res/32x32/tor-logo.png RENAME vidalia.png DESTINATION share/icons/hicolor/32x32/apps) install(FILES res/48x48/tor-logo.png RENAME vidalia.png DESTINATION share/icons/hicolor/48x48/apps) install(FILES res/64x64/tor-logo.png RENAME vidalia.png DESTINATION share/icons/hicolor/64x64/apps) install(FILES res/128x128/tor-logo.png RENAME vidalia.png DESTINATION share/icons/hicolor/128x128/apps) endif(NOT WIN32 AND NOT APPLE)