diff --git a/CMakeLists.txt b/CMakeLists.txt index 46629c8ad..3d5c892db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,6 +216,9 @@ endif() add_subdirectory(coreapi) add_subdirectory(share) +if(ENABLE_CONSOLE_UI) + add_subdirectory(console) +endif() if(ENABLE_GTK_UI) add_subdirectory(gtk) add_subdirectory(pixmaps) diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt new file mode 100644 index 000000000..328fdbcf2 --- /dev/null +++ b/console/CMakeLists.txt @@ -0,0 +1,53 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2014 Belledonne Communications, Grenoble France +# +############################################################################ +# +# 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. +# +############################################################################ + +set(LINPHONEC_SOURCE_FILES + linphonec.c + linphonec.h + commands.c +) +set(LINPHONECSH_SOURCE_FILES + shell.c +) + +add_executable(linphonec ${LINPHONEC_SOURCE_FILES}) +target_link_libraries(linphonec linphone) + +if(WIN32) + add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES}) + target_link_libraries(linphoned linphone) +endif() + +add_executable(linphonecsh ${LINPHONECSH_SOURCE_FILES}) +target_link_libraries(linphonecsh linphone) + +set(INSTALL_TARGETS linphonec linphonecsh) +if(WIN32) + list(APPEND INSTALL_TARGETS linphoned) +endif() + +install(TARGETS ${INSTALL_TARGETS} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE +) diff --git a/console/commands.c b/console/commands.c index cd968f555..8f1ef2293 100644 --- a/console/commands.c +++ b/console/commands.c @@ -28,7 +28,6 @@ #include #ifndef _WIN32_WCE #include -#include #endif /*_WIN32_WCE*/ #include #include @@ -38,6 +37,7 @@ #ifndef WIN32 #include +#include #endif #define AUDIO 0 diff --git a/console/linphonec.c b/console/linphonec.c index 9fa4f4a9a..fb3c9d1ba 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -25,9 +25,7 @@ ****************************************************************************/ #include #ifndef _WIN32_WCE -#include #include -#include #include #include #include "private.h" /*coreapi/private.h, needed for LINPHONE_VERSION */ @@ -48,17 +46,19 @@ #endif /*_WIN32_WCE*/ #else #include +#include #include #include #include +#include #endif -#if defined(_WIN32_WCE) - #if !defined(PATH_MAX) #define PATH_MAX 256 #endif /*PATH_MAX*/ +#if defined(_WIN32_WCE) + #if !defined(strdup) #define strdup _strdup #endif /*strdup*/ @@ -661,6 +661,12 @@ main (int argc, char *argv[]) { exit(EXIT_SUCCESS); /* should never reach here */ } +#ifdef _MSC_VER +int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { + return main(__argc, __argv); +} +#endif + /* * Initialize linphonec */ @@ -1214,15 +1220,21 @@ linphonec_parse_cmdline(int argc, char **argv) else if (strncmp ("-c", argv[arg_num], 2) == 0) { if ( ++arg_num >= argc ) print_usage(EXIT_FAILURE); +#ifdef _MSC_VER + if (strcmp(argv[arg_num], "NUL") != 0) { +#endif #if !defined(_WIN32_WCE) - if (access(argv[arg_num],F_OK)!=0 ) - { - fprintf (stderr, - "Cannot open config file %s.\n", - argv[arg_num]); - exit(EXIT_FAILURE); - } + if (access(argv[arg_num], F_OK) != 0) + { + fprintf(stderr, + "Cannot open config file %s.\n", + argv[arg_num]); + exit(EXIT_FAILURE); + } #endif /*_WIN32_WCE*/ +#ifdef _MSC_VER + } +#endif snprintf(configfile_name, PATH_MAX, "%s", argv[arg_num]); } else if (strncmp ("-b", argv[arg_num], 2) == 0) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 761bdcd63..662637bba 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -183,7 +183,7 @@ typedef enum _LinphoneReason LinphoneReason; * Converts a LinphoneReason enum to a string. * @ingroup misc **/ -const char *linphone_reason_to_string(LinphoneReason err); +LINPHONE_PUBLIC const char *linphone_reason_to_string(LinphoneReason err); /** * Object representing full details about a signaling error or status. @@ -1623,7 +1623,7 @@ typedef enum _LinphoneGlobalState{ LinphoneGlobalConfiguring }LinphoneGlobalState; -const char *linphone_global_state_to_string(LinphoneGlobalState gs); +LINPHONE_PUBLIC const char *linphone_global_state_to_string(LinphoneGlobalState gs); /** * LinphoneCoreLogCollectionUploadState is used to notify if log collection upload have been succesfully delivered or not. @@ -2770,10 +2770,10 @@ LINPHONE_PUBLIC void linphone_core_enable_mic(LinphoneCore *lc, bool_t enable); **/ LINPHONE_PUBLIC bool_t linphone_core_mic_enabled(LinphoneCore *lc); -bool_t linphone_core_is_rtp_muted(LinphoneCore *lc); +LINPHONE_PUBLIC bool_t linphone_core_is_rtp_muted(LinphoneCore *lc); -bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc); -void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val); +LINPHONE_PUBLIC bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val); /******************************************************************************* @@ -3129,7 +3129,7 @@ LINPHONE_PUBLIC int linphone_core_get_calls_nb(const LinphoneCore *lc); LINPHONE_PUBLIC const MSList *linphone_core_get_calls(LinphoneCore *lc); -LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc); +LINPHONE_PUBLIC LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc); /** * force registration refresh to be initiated upon next iterate * @ingroup proxies