Changeset 2476

Show
Ignore:
Timestamp:
04/01/08 22:00:36 (9 months ago)
Author:
edmanm
Message:

r290@lysithea: edmanm | 2008-04-01 22:00:19 -0400
Make UPnP support optional (off by default). Add a FindMiniUPnPc.cmake for
checking for the miniupnpc library and location of header files.

Location:
vidalia/trunk
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • vidalia/trunk/CMakeLists.txt

    r2464 r2476  
    6363endif(USE_QSSLSOCKET) 
    6464 
     65## UPnP support is currently optional (disabled by default) 
     66option(USE_MINIUPNPC "Enable UPnP support using the MiniUPnPc library." OFF) 
     67if (USE_MINIUPNPC) 
     68  include(${CMAKE_SOURCE_DIR}/cmake/FindMiniUPnPc.cmake) 
     69endif(USE_MINIUPNPC) 
     70 
    6571## Check for system header files 
    6672check_include_file("limits.h" HAVE_LIMITS_H) 
  • vidalia/trunk/config.h.in

    r2446 r2476  
    2727#cmakedefine SIZEOF_INT @SIZEOF_INT@ 
    2828 
     29#cmakedefine HAVE_MINIUPNPC_H 
     30 
     31#cmakedefine USE_MINIUPNPC 
     32 
    2933#endif 
    3034 
  • vidalia/trunk/src/vidalia/CMakeLists.txt

    r2475 r2476  
    1717  ${CMAKE_CURRENT_SOURCE_DIR}/config 
    1818  ${CMAKE_CURRENT_SOURCE_DIR}/help/browser 
    19   ${MINIUPNPC_INCLUDE_DIR} 
    2019) 
    2120configure_file( 
     
    6362  config/serverpage.cpp 
    6463  config/serversettings.cpp 
    65   config/upnpcontrol.cpp 
    6664  config/torsettings.cpp 
    6765  config/vidaliasettings.cpp 
     
    8381  config/serverpage.h 
    8482  config/serversettings.h 
    85   config/upnpcontrol.h 
    8683  config/torsettings.h 
    8784  config/vidaliasettings.h 
    8885  config/vsettings.h 
    8986) 
     87if (USE_MINIUPNPC) 
     88  include_directories(${MINIUPNPC_INCLUDE_DIR}) 
     89  set(vidalia_SRCS ${vidalia_SRCS} 
     90    config/upnpcontrol.cpp 
     91  ) 
     92  qt4_wrap_cpp(vidalia_SRCS 
     93    config/upnpcontrol.h 
     94  ) 
     95endif(USE_MINIUPNPC) 
    9096 
    9197## Help browser sources 
     
    238244add_dependencies(${vidalia_BIN} translations) 
    239245 
    240 ## Link in miniupnpc 
    241 find_library(MINIUPNPC 
    242     NAMES miniupnpc 
    243     PATHS ${MINIUPNPC_LIBRARY_DIR} 
    244 ) 
    245246 
    246247## Link to the Qt libraries and other libraries built as a part of Vidalia 
    247248target_link_libraries(${vidalia_BIN} 
    248249  ${QT_LIBRARIES} 
    249   ${MINIUPNPC} 
    250250  torcontrol 
    251251  util 
    252252) 
     253if (USE_MINIUPNPC) 
     254  target_link_libraries(${vidalia_BIN} ${MINIUPNPC_LIBRARY}) 
     255endif(USE_MINIUPNPC) 
     256 
    253257if (MINGW) 
    254258  target_link_libraries(${vidalia_BIN} 
  • vidalia/trunk/src/vidalia/config/serversettings.cpp

    r2475 r2476  
    1818#include <net.h> 
    1919#include <stringutil.h> 
     20#include <config.h> 
    2021 
    2122#include "serversettings.h" 
    2223#include "torsettings.h" 
     24 
     25#ifdef USE_MINIUPNPC 
    2326#include "upnpcontrol.h" 
     27#endif 
    2428 
    2529/** Define the set of characters that are valid in a nickname. */ 
     
    164168ServerSettings::configurePortForwarding() 
    165169{ 
     170#ifdef USE_MINIUPNPC 
    166171  UPNPControl *pUNPControl = UPNPControl::Instance(); 
    167172  pUNPControl->forwardPort(getORPort()); 
     173#endif 
    168174} 
    169175