1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-31 09:32:03 +02:00

Build portfwd dynamically

This commit is contained in:
Dominik Schmidt
2011-05-21 12:12:07 +02:00
parent 8dc7bca9dd
commit 864dc8d096
6 changed files with 59 additions and 14 deletions

View File

@@ -59,7 +59,7 @@ macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://develo
# this installs headers and such and should really be handled in a separate package by packagers
IF( INTERNAL_JREEN )
ADD_SUBDIRECTORY( thirdparty/jreen )
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/jreen )
SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
SET( LIBJREEN_LIBRARY jreen )
SET( LIBJREEN_LIBRARIES ${LIBJREEN_LIBRARY} )
@@ -72,7 +72,7 @@ macro_log_feature(LIBJREEN_FOUND "Jreen" "Qt XMPP Library" "http://gitorious.org
# this installs headers and such and should really be handled in a separate package by packagers
IF( INTERNAL_QTWEETLIB )
ADD_SUBDIRECTORY( thirdparty/qtweetlib )
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/qtweetlib )
# copy headers to build/QTweetLib so we can use proper includes inside the code
FILE( COPY ${CMAKE_SOURCE_DIR}/thirdparty/qtweetlib/QTweetLib/src/ DESTINATION ${CMAKE_BINARY_DIR}/QTweetLib )
SET( QTWEETLIB_INCLUDE_DIR ${CMAKE_BINARY_DIR} )
@@ -85,6 +85,11 @@ ELSE( INTERNAL_QTWEETLIB )
ENDIF( INTERNAL_QTWEETLIB )
macro_log_feature(QTWEETLIB_FOUND "QTweetLib" "Qt Twitter Library" "https://github.com/minimoog/QTweetLib" FALSE "" "QTweetLib is needed for the Twitter SIP plugin. \n\n Use -DINTERNAL_QTWEETLIB=ON to build the git submodule inside Tomahawk \n")
### libportfwd
SET( LIBPORTFWD_INCLUDE_DIR ${THIRDPARTY_DIR}/libportfwd/include )
SET( LIBPORTFWD_LIBRARY tomahawk_portfwd )
SET( LIBPORTFWD_LIBRARIES ${LIBPORTFWD_LIBRARY} )
ADD_SUBDIRECTORY( ${THIRDPARTY_DIR}/libportfwd )
# we need pthreads too
find_package(Threads)

View File

@@ -359,7 +359,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
playlist
${THIRDPARTY_DIR}/libportfwd/include
${LIBPORTFWD_INCLUDE_DIR}
${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb
${THIRDPARTY_DIR}/jdns
${THIRDPARTY_DIR}/jdns/jdns
@@ -422,7 +422,7 @@ target_link_libraries( tomahawklib
tomahawk_jdns
# Thirdparty shipped with tomahawk
portfwd
${LIBPORTFWD_LIBRARIES}
# External deps
${QJSON_LIBRARIES}

View File

@@ -1,4 +1,3 @@
ADD_SUBDIRECTORY( jdns )
ADD_SUBDIRECTORY( libportfwd )
ADD_SUBDIRECTORY( qxt )
ADD_SUBDIRECTORY( liblastfm2 )

View File

@@ -6,9 +6,6 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(MINIUPNP_DIR "third-party/miniupnpc-1.4.20100609/")
SET(NATPMP_DIR "third-party/libnatpmp-20100202")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
ADD_DEFINITIONS(-Wall -O2 -DNDEBUG)
IF(WIN32)
ADD_DEFINITIONS(-DWIN32 -DMINIUPNP_EXPORTS )
@@ -16,10 +13,11 @@ ELSE()
ADD_DEFINITIONS(-fPIC)
ENDIF()
INCLUDE_DIRECTORIES(${MINIUPNP_DIR} include)
SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} )
ADD_LIBRARY(portfwd STATIC
ADD_DEFINITIONS( -DPORTFWDDLLEXPORT_PRO )
ADD_LIBRARY(tomahawk_portfwd SHARED
# the needed bits of miniupnpc (no python module, no tests, no cli)
${MINIUPNP_DIR}/connecthostport.c
@@ -29,8 +27,8 @@ ADD_LIBRARY(portfwd STATIC
${MINIUPNP_DIR}/miniupnpc.c
${MINIUPNP_DIR}/miniwget.c
${MINIUPNP_DIR}/minixml.c
${MINIUPNP_DIR}/minixmlvalid.c
${MINIUPNP_DIR}/upnpc.c
#${MINIUPNP_DIR}/minixmlvalid.c - contains main() like upnp.c, so building a shared lib fails
#${MINIUPNP_DIR}/upnpc.c
${MINIUPNP_DIR}/upnpcommands.c
${MINIUPNP_DIR}/upnperrors.c
${MINIUPNP_DIR}/upnpreplyparse.c
@@ -40,9 +38,17 @@ ADD_LIBRARY(portfwd STATIC
)
IF(WIN32)
TARGET_LINK_LIBRARIES( portfwd "ws2_32.dll" "iphlpapi.a" )
TARGET_LINK_LIBRARIES( tomahawk_portfwd "ws2_32.dll" "iphlpapi.a" )
ENDIF()
INSTALL( TARGETS tomahawk_portfwd
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
BUNDLE DESTINATION library
)
#INSTALL(FILES include/portfwd/portfwddllmacro.h include/portfwd/portfwd.h DESTINATION include/portfwd)
#ADD_EXECUTABLE(portfwd-demo
# src/main.cpp
# )

View File

@@ -17,6 +17,9 @@
#ifndef LIBPORTFWD_PORTFWD_H
#define LIBPORTFWD_PORTFWD_H true
#include "portfwddllmacro.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -26,7 +29,7 @@
struct UPNPUrls;
struct IGDdatas;
class Portfwd
class PORTFWDDLLEXPORT Portfwd
{
public:
Portfwd();

View File

@@ -0,0 +1,32 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Dominik Schmidt <dev@dominik-schmidt.de>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PORTFWDDLLMACRO_H
#define PORTFWDDLLMACRO_H
#include <QtCore/qglobal.h>
#ifndef PORTFWDDLLEXPORT
# if defined (PORTFWDDLLEXPORT_PRO)
# define PORTFWDDLLEXPORT Q_DECL_EXPORT
# else
# define PORTFWDDLLEXPORT Q_DECL_IMPORT
# endif
#endif
#endif