tester: fix compilation on iOS

parent 276d1e31
...@@ -20,7 +20,13 @@ ...@@ -20,7 +20,13 @@
# #
############################################################################ ############################################################################
set(TESTER_SOURCES if(ENABLE_STATIC)
set(PROJECT_LIBS bellesip-static)
else()
set(PROJECT_LIBS bellesip)
endif()
set(SOURCE_FILES_C
auth_helper_tester.c auth_helper_tester.c
belle_generic_uri_tester.c belle_generic_uri_tester.c
belle_http_tester.c belle_http_tester.c
...@@ -39,14 +45,19 @@ set(TESTER_SOURCES ...@@ -39,14 +45,19 @@ set(TESTER_SOURCES
register_tester.h register_tester.h
) )
set(SOURCE_FILES_OBJC )
if (IOS)
list(APPEND SOURCE_FILES_OBJC belle_sip_tester_ios.m)
endif()
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}") string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
apply_compile_flags(TESTER_SOURCES "CPP" "C") apply_compile_flags(SOURCE_FILES_C "CPP" "C")
apply_compile_flags(SOURCE_FILES_OBJC "CPP" "OBJC")
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_library(belle_sip_tester_static STATIC ${SOURCE_FILES_C})
add_library(belle_sip_tester_static STATIC ${TESTER_SOURCES})
target_include_directories(belle_sip_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) target_include_directories(belle_sip_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(belle_sip_tester_static ${BCTOOLBOX_TESTER_LIBRARIES} bellesip) target_link_libraries(belle_sip_tester_static ${BCTOOLBOX_TESTER_LIBRARIES} ${PROJECT_LIBS})
set(RUNTIME_COMPONENT_SOURCES set(RUNTIME_COMPONENT_SOURCES
belle_sip_tester_windows.cpp belle_sip_tester_windows.cpp
...@@ -71,35 +82,38 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ...@@ -71,35 +82,38 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
endif() endif()
else() else()
set(USE_BUNDLE )
if (IOS)
set(USE_BUNDLE MACOSX_BUNDLE)
endif()
add_executable(belle_sip_tester ${USE_BUNDLE} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
add_executable(belle_sip_tester ${TESTER_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "") if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif() endif()
target_include_directories(belle_sip_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS}) target_include_directories(belle_sip_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(belle_sip_tester ${BCTOOLBOX_TESTER_LIBRARIES} bellesip) target_link_libraries(belle_sip_tester ${BCTOOLBOX_TESTER_LIBRARIES} ${PROJECT_LIBS})
add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose) add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
set(OBJECT_DESCRIBE_SOURCES describe.c) set(OBJECT_DESCRIBE_SOURCES describe.c)
apply_compile_flags(OBJECT_DESCRIBE_SOURCES "CPP" "C") apply_compile_flags(OBJECT_DESCRIBE_SOURCES "CPP" "C")
add_executable(belle_sip_object_describe ${OBJECT_DESCRIBE_SOURCES}) add_executable(belle_sip_object_describe ${USE_BUNDLE} ${OBJECT_DESCRIBE_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "") if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif() endif()
target_link_libraries(belle_sip_object_describe bellesip) target_link_libraries(belle_sip_object_describe ${PROJECT_LIBS})
set(PARSE_SOURCES parse.c) set(PARSE_SOURCES parse.c)
apply_compile_flags(PARSE_SOURCES "CPP" "C") apply_compile_flags(PARSE_SOURCES "CPP" "C")
add_executable(belle_sip_parse ${PARSE_SOURCES}) add_executable(belle_sip_parse ${USE_BUNDLE} ${PARSE_SOURCES})
if(NOT "${LINK_FLAGS_STR}" STREQUAL "") if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
endif() endif()
target_link_libraries(belle_sip_parse bellesip) target_link_libraries(belle_sip_parse ${PROJECT_LIBS})
endif() endif()
/*
linphone library - modular sound and video processing and streaming
Copyright (C) 2006-2014 Belledonne Communications, Grenoble
This program 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 2
of the License, or (at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if TARGET_OS_IPHONE
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#include <CoreFoundation/CFRunLoop.h>
#include "belle_sip_tester.h"
int g_argc;
char** g_argv;
void stop_handler(int sig) {
return;
}
static void* _apple_main(void* data) {
NSString *bundlePath = [[[NSBundle mainBundle] bundlePath] retain];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = [[paths objectAtIndex:0] retain];
NSLog(@"Bundle path: %@", bundlePath);
NSLog(@"Document path: %@", documentPath);
bc_tester_set_resource_dir_prefix(bundlePath.UTF8String);
bc_tester_set_writable_dir_prefix(documentPath.UTF8String);
belle_sip_tester_init(NULL);
bc_tester_start(NULL);
belle_sip_tester_uninit();
[bundlePath release];
[documentPath release];
return NULL;
}
int main(int argc, char * argv[]) {
pthread_t main_thread;
g_argc=argc;
g_argv=argv;
pthread_create(&main_thread,NULL,_apple_main,NULL);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int value = UIApplicationMain(0, nil, nil, nil);
[pool release];
return value;
pthread_join(main_thread,NULL);
return 0;
}
#endif // target IPHONE
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