1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-30 17:20:26 +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

@@ -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