Commit e389e34c authored by Ghislain MARY's avatar Ghislain MARY

Fix build of C++ wrapper on Windows.

parent 6735f6e7
......@@ -27,6 +27,7 @@
#include "linphone/lpconfig.h"
#include "belle-sip/belle-sip.h"
#include "ortp/b64.h"
#include "linphone/wrapper_utils.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
......
......@@ -22,8 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "belcard/belcard_parser.hpp"
#include "sal/sal.h"
#include <bctoolbox/crypto.h>
#include "linphone/core.h"
#include "private.h"
#include "linphone/wrapper_utils.h"
#define VCARD_MD5_HASH_SIZE 16
......
......@@ -2167,7 +2167,7 @@ LINPHONE_PUBLIC void linphone_core_set_sip_transport_timeout(LinphoneCore *lc, i
* @return The SIP transport timeout in milliseconds.
* @ingroup media_parameters
*/
int linphone_core_get_sip_transport_timeout(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_get_sip_transport_timeout(LinphoneCore *lc);
/**
* Enable or disable DNS SRV resolution.
......
......@@ -83,12 +83,12 @@ LINPHONE_PUBLIC int linphone_core_stop_echo_tester(LinphoneCore *lc);
* @ingroup IOS
* Special function to warm up dtmf feeback stream. #linphone_core_stop_dtmf_stream must() be called before entering FG mode
*/
void linphone_core_start_dtmf_stream(LinphoneCore* lc);
LINPHONE_PUBLIC void linphone_core_start_dtmf_stream(LinphoneCore* lc);
/**
* @ingroup IOS
* Special function to stop dtmf feed back function. Must be called before entering BG mode
*/
void linphone_core_stop_dtmf_stream(LinphoneCore* lc);
LINPHONE_PUBLIC void linphone_core_stop_dtmf_stream(LinphoneCore* lc);
typedef bool_t (*LinphoneCoreIterateHook)(void *data);
......
......@@ -549,7 +549,7 @@ LINPHONE_PUBLIC void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *l
* @param fr the linphone friend to save
* @param lc the linphone core
*/
void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc);
/**
* @}
......
......@@ -252,7 +252,7 @@ LINPHONE_PUBLIC void linphone_friend_list_set_uri(LinphoneFriendList *list, cons
* @param[in] list LinphoneFriendList object.
* @param[in] rev The revision
*/
void linphone_friend_list_update_revision(LinphoneFriendList *list, int rev);
LINPHONE_PUBLIC void linphone_friend_list_update_revision(LinphoneFriendList *list, int rev);
/**
* An object to handle the callbacks for LinphoneFriend synchronization.
......@@ -389,7 +389,7 @@ LINPHONE_PUBLIC void linphone_friend_list_synchronize_friends_from_server(Linpho
* Goes through all the LinphoneFriend that are dirty and does a CardDAV PUT to update the server.
* @param[in] list LinphoneFriendList object.
*/
void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list);
LINPHONE_PUBLIC void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list);
/**
* Returns the LinphoneCore object attached to this LinphoneFriendList.
......
......@@ -5,7 +5,7 @@ configure_file(LinphoneCxxConfig.cmake.in LinphoneCxxConfig.cmake @ONLY)
add_custom_command(OUTPUT CMakeLists.txt include/linphone.hh
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/xml"
DEPENDS *.py *.mustache linphone-doc
DEPENDS abstractapi.py genwrapper.py class_header.mustache class_impl.mustache enums_header.mustache main_header.mustache linphone-doc
"${PROJECT_BINARY_DIR}/coreapi/help/doc/xml/index.xml"
"${CMAKE_CURRENT_BINARY_DIR}/c_make_lists.mustache"
)
......
......@@ -25,15 +25,16 @@
#
# It defines the following variables:
#
# LINPHONE_CXX_FOUND - system has linphone++
# LINPHONE_CXX_INCLUDE_DIRS - the linphone++ include directory
# LINPHONE_CXX_LIBRARIES - The libraries needed to use linphone++
# LINPHONE_CXX_LDFLAGS - The linking flags needed to use linphone++
# LINPHONECXX_FOUND - system has linphone++
# LINPHONECXX_INCLUDE_DIRS - the linphone++ include directory
# LINPHONECXX_LIBRARIES - The libraries needed to use linphone++
# LINPHONECXX_LDFLAGS - The linking flags needed to use linphone++
find_package(BelleSIP)
find_package(Linphone)
include("${CMAKE_CURRENT_LIST_DIR}/LinphoneCxxTargets.cmake")
get_filename_component(LINPHONE_CXX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(LINPHONE_CXX_INCLUDE_DIRS "${LINPHONE_CXX_CMAKE_DIR}/../../../include")
set(LINPHONE_CXX_LDFLAGS "")
set(LINPHONE_CXX_LIBRARIES linphone++ ${BELLESIP_LIBRARIES})
get_filename_component(LINPHONECXX_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(LINPHONECXX_INCLUDE_DIRS "${LINPHONECXX_CMAKE_DIR}/../../../include" "${BELLESIP_INCLUDE_DIRS}" "${LINPHONE_INCLUDE_DIRS}")
set(LINPHONECXX_LDFLAGS "")
set(LINPHONECXX_LIBRARIES linphone++ ${BELLESIP_LIBRARIES} ${LINPHONE_LIBRARIES})
......@@ -4,6 +4,8 @@ project(LinphoneCxx VERSION @LINPHONE_VERSION@)
include(GNUInstallDirs)
find_package(BelleSIP REQUIRED)
set(CMAKE_CXX_STANDARD 11)
set(GENERATED_SOURCES
......@@ -30,8 +32,13 @@ set(HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/object.hh
)
add_definitions("-DLINPHONECXX_EXPORTS")
add_library(linphone++ SHARED ${SOURCES})
target_link_libraries(linphone++ PRIVATE @PROJECT_BINARY_DIR@/coreapi/liblinphone.so.@LINPHONE_SO_VERSION@)
if(WIN32)
target_link_libraries(linphone++ PRIVATE @PROJECT_BINARY_DIR@/coreapi/${CMAKE_BUILD_TYPE}/linphone.lib ${BELLESIP_LIBRARIES})
else()
target_link_libraries(linphone++ PRIVATE @PROJECT_BINARY_DIR@/coreapi/liblinphone.so.@LINPHONE_SO_VERSION@)
endif()
target_include_directories(linphone++
PUBLIC include
PRIVATE @PROJECT_SOURCE_DIR@/include
......@@ -42,6 +49,7 @@ set_target_properties(linphone++
)
install(TARGETS linphone++ EXPORT LinphoneCxxTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(FILES ${HEADERS}
......
......@@ -40,6 +40,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/linphonecore_utils.h"
#include "linphone/wrapper_utils.h"
#ifndef LINPHONECXX_PUBLIC
#if defined(_MSC_VER)
#ifdef LINPHONECXX_EXPORTS
#define LINPHONECXX_PUBLIC __declspec(dllexport)
#else
#define LINPHONECXX_PUBLIC __declspec(dllimport)
#endif
#else
#define LINPHONECXX_PUBLIC
#endif
#endif
namespace linphone {
{{#priorDeclarations}}
......@@ -58,21 +70,21 @@ namespace linphone {
{{/isNotListener}}
{{#ismonolistenable}}
LINPHONE_PUBLIC void setListener(const std::shared_ptr<{{{listenerClassName}}}> &listener);
LINPHONECXX_PUBLIC void setListener(const std::shared_ptr<{{{listenerClassName}}}> &listener);
{{/ismonolistenable}}
{{#ismultilistenable}}
LINPHONE_PUBLIC void addListener(std::shared_ptr<{{{listenerClassName}}}> &listener);
LINPHONE_PUBLIC void removeListener(std::shared_ptr<{{{listenerClassName}}}> &listener);
LINPHONECXX_PUBLIC void addListener(std::shared_ptr<{{{listenerClassName}}}> &listener);
LINPHONECXX_PUBLIC void removeListener(std::shared_ptr<{{{listenerClassName}}}> &listener);
{{/ismultilistenable}}
public:
{{#isfactory}}
LINPHONE_PUBLIC std::shared_ptr<Core> createCore(const std::shared_ptr<CoreListener> & cbs, const std::string & configPath, const std::string & factoryConfigPath) const;
LINPHONE_PUBLIC std::shared_ptr<Core> createCoreWithConfig(const std::shared_ptr<CoreListener> & cbs, const std::shared_ptr<Config> & config) const;
LINPHONECXX_PUBLIC std::shared_ptr<Core> createCore(const std::shared_ptr<CoreListener> & cbs, const std::string & configPath, const std::string & factoryConfigPath) const;
LINPHONECXX_PUBLIC std::shared_ptr<Core> createCoreWithConfig(const std::shared_ptr<CoreListener> & cbs, const std::shared_ptr<Config> & config) const;
{{/isfactory}}
{{#isVcard}}
LINPHONE_PUBLIC std::shared_ptr<belcard::BelCard> &getVcard();
LINPHONECXX_PUBLIC std::shared_ptr<belcard::BelCard> &getVcard();
{{/isVcard}}
{{#methods}}
......
../../tools/genapixml.py
\ No newline at end of file
......@@ -21,6 +21,9 @@ import pystache
import re
import argparse
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'tools'))
print(sys.path)
import genapixml as CApi
import abstractapi as AbsApi
......@@ -215,7 +218,7 @@ class CppTranslator(object):
methodElems['deprecated'] = 'LINPHONE_DEPRECATED ' if method.deprecated else ''
methodDict = {}
methodDict['prototype'] = 'LINPHONE_PUBLIC {deprecated}{methodType}{return} {name}({params}){const}{semicolon}'.format(**methodElems)
methodDict['prototype'] = 'LINPHONECXX_PUBLIC {deprecated}{methodType}{return} {name}({params}){const}{semicolon}'.format(**methodElems)
if genImpl:
if not CppTranslator.is_ambigous_type(self, method.returnType):
......
......@@ -26,6 +26,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <belle-sip/object.h>
#include <bctoolbox/list.h>
#ifndef LINPHONECXX_PUBLIC
#if defined(_MSC_VER)
#ifdef LINPHONECXX_EXPORTS
#define LINPHONECXX_PUBLIC __declspec(dllexport)
#else
#define LINPHONECXX_PUBLIC __declspec(dllimport)
#endif
#else
#define LINPHONECXX_PUBLIC
#endif
#endif
namespace linphone {
class Object;
......@@ -79,8 +91,8 @@ namespace linphone {
return *(T *)ptr;
}
}
void unsetData(const std::string &key);
bool dataExists(const std::string &key);
LINPHONECXX_PUBLIC void unsetData(const std::string &key);
LINPHONECXX_PUBLIC bool dataExists(const std::string &key);
public:
template <class T>
......@@ -117,7 +129,7 @@ namespace linphone {
static std::list<std::string> cStringArrayToCppList(const char **cArray);
private:
std::map<std::string,void *> &getUserData() const;
LINPHONECXX_PUBLIC std::map<std::string,void *> &getUserData() const;
template <class T> static void deleteSharedPtr(std::shared_ptr<T> *ptr) {if (ptr != NULL) delete ptr;}
static void deleteString(std::string *str) {if (str != NULL) delete str;}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment