xfreerdp-server: split into library/executable

This commit is contained in:
Marc-André Moreau 2013-04-29 16:37:11 -04:00
parent 037d6edd19
commit 983f42254d
9 changed files with 79 additions and 15 deletions

View File

@ -120,7 +120,9 @@ endif()
# Compiler-specific flags
if(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
endif()
endif()
@ -151,9 +153,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
endif()
if(${CMAKE_VERSION} VERSION_LESS 2.8.9)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif()
if(WITH_SSE2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
endif()

View File

@ -53,6 +53,7 @@ if(WITH_CLIENT_INTERFACE)
else()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/xfreerdp.c cli/xfreerdp.h)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp")
endif()
set(${MODULE_PREFIX}_LIBS
@ -146,7 +147,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHI
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
if(WITH_IPP)
target_link_libraries(xfreerdp ${IPP_LIBRARY_LIST})
target_link_libraries(${MODULE_NAME} ${IPP_LIBRARY_LIST})
endif()
if(WITH_CLIENT_INTERFACE)

View File

@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(MODULE_NAME "xfreerdp")
set(MODULE_NAME "xfreerdp-cli")
set(MODULE_PREFIX "FREERDP_CLIENT_X11")
include_directories(..)
@ -24,6 +24,7 @@ set(${MODULE_PREFIX}_SRCS
xfreerdp.c)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp")
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} xfreerdp-client)

View File

@ -16,7 +16,7 @@
# limitations under the License.
set(MODULE_NAME "xfreerdp-server")
set(MODULE_PREFIX "FREERDP_SERVER_X11")
set(MODULE_PREFIX "FREERDP_SERVER_X11_CONTROL")
include_directories(${X11_INCLUDE_DIRS})
include_directories("../../winpr/tools/makecert")
@ -30,10 +30,20 @@ set(${MODULE_PREFIX}_SRCS
xf_encode.h
xf_interface.c
xf_interface.h
xfreerdp.c
xfreerdp.h)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
if(WITH_SERVER_INTERFACE)
if(SERVER_INTERFACE_SHARED)
add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
else()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
endif()
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION} PREFIX "lib")
else()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/xfreerdp.c)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp-server")
endif()
set(XEXT_FEATURE_TYPE "RECOMMENDED")
set(XEXT_FEATURE_PURPOSE "X11 extension")
@ -106,7 +116,13 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-makecert-tool)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
if(WITH_SERVER_INTERFACE)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
add_subdirectory(cli)
else()
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/X11")

View File

@ -0,0 +1,36 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP X11 cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(MODULE_NAME "xfreerdp-server-cli")
set(MODULE_PREFIX "FREERDP_SERVER_X11")
include_directories(..)
set(${MODULE_PREFIX}_SRCS
xfreerdp.c)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "xfreerdp-server")
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} xfreerdp-server)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/X11")

BIN
server/X11/cli/xfreerdp-server Executable file

Binary file not shown.

View File

@ -21,11 +21,11 @@
#include "config.h"
#endif
#include "xf_peer.h"
#include "xfreerdp.h"
#include "xf_interface.h"
int main(int argc, char* argv[])
{
HANDLE thread;
xfServer* server;
DWORD dwExitCode;
@ -38,9 +38,11 @@ int main(int argc, char* argv[])
freerdp_server_start(server);
WaitForSingleObject(server->thread, INFINITE);
thread = freerdp_server_get_thread(server);
GetExitCodeThread(server->thread, &dwExitCode);
WaitForSingleObject(thread, INFINITE);
GetExitCodeThread(thread, &dwExitCode);
freerdp_server_free(server);

View File

@ -117,7 +117,7 @@ int freerdp_server_start(xfServer* server)
{
if (server->listener->Open(server->listener, NULL, 3389))
{
server->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) xf_thread, (void*) server, 0, NULL);
server->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) xf_server_thread, (void*) server, 0, NULL);
}
return 0;
@ -128,6 +128,11 @@ int freerdp_server_stop(xfServer* server)
return 0;
}
HANDLE freerdp_server_get_thread(xfServer* server)
{
return server->thread;
}
xfServer* freerdp_server_new(int argc, char** argv)
{
xfServer* server;

View File

@ -20,6 +20,8 @@
#ifndef XFREERDP_SERVER_INTERFACE_H
#define XFREERDP_SERVER_INTERFACE_H
#include <winpr/crt.h>
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
@ -40,6 +42,8 @@ FREERDP_API int freerdp_server_global_uninit();
FREERDP_API int freerdp_server_start(xfServer* server);
FREERDP_API int freerdp_server_stop(xfServer* server);
FREERDP_API HANDLE freerdp_server_get_thread(xfServer* server);
FREERDP_API xfServer* freerdp_server_new(int argc, char** argv);
FREERDP_API void freerdp_server_free(xfServer* server);