2013-08-08 23:49:24 +04:00
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
project(MacFreeRDP-library)
|
2012-10-19 07:10:45 +04:00
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
set(MODULE_NAME "MacFreeRDP-library")
|
2013-06-23 08:18:55 +04:00
|
|
|
set(MODULE_OUTPUT_NAME "MacFreeRDP")
|
2013-08-08 23:49:24 +04:00
|
|
|
set(MODULE_PREFIX "FREERDP_CLIENT_MAC_LIBRARY")
|
2013-03-11 08:35:15 +04:00
|
|
|
|
2012-10-19 07:10:45 +04:00
|
|
|
find_library(FOUNDATION_LIBRARY Foundation)
|
|
|
|
find_library(COCOA_LIBRARY Cocoa)
|
|
|
|
find_library(APPKIT_LIBRARY AppKit)
|
2014-03-04 23:01:01 +04:00
|
|
|
find_library(IOKIT_LIBRARY IOKit)
|
2012-11-01 07:30:52 +04:00
|
|
|
|
2013-05-31 22:57:48 +04:00
|
|
|
mark_as_advanced(COCOA_LIBRARY FOUNDATION_LIBRARY APPKIT_LIBRARY)
|
2014-03-04 23:01:01 +04:00
|
|
|
set(EXTRA_LIBS ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY} ${IOKIT_LIBRARY})
|
2013-05-31 22:57:48 +04:00
|
|
|
|
2013-06-23 08:18:55 +04:00
|
|
|
set(MACOSX_BUNDLE_INFO_STRING "${MODULE_OUTPUT_NAME}")
|
2012-10-19 07:10:45 +04:00
|
|
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.freerdp.mac")
|
2013-05-31 20:48:40 +04:00
|
|
|
set(MACOSX_BUNDLE_BUNDLE_IDENTIFIER "FreeRDP-library.Mac")
|
|
|
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING "MacFreeRDP library Version 1.1")
|
2013-06-23 08:18:55 +04:00
|
|
|
set(MACOSX_BUNDLE_BUNDLE_NAME "${MODULE_OUTPUT_NAME}")
|
2013-05-31 20:48:40 +04:00
|
|
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING 1.1.0)
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_VERSION 1.1.0)
|
|
|
|
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013. All Rights Reserved.")
|
2013-03-11 08:35:15 +04:00
|
|
|
|
2013-08-08 23:49:24 +04:00
|
|
|
set(${MODULE_PREFIX}_XIBS PasswordDialog.xib)
|
|
|
|
|
|
|
|
set(${MODULE_PREFIX}_SOURCES "")
|
|
|
|
|
|
|
|
set(${MODULE_PREFIX}_OBJECTIVE_SOURCES
|
|
|
|
main.m
|
|
|
|
mf_client.m
|
|
|
|
MRDPCursor.m
|
|
|
|
MRDPView.m
|
2014-03-04 23:01:01 +04:00
|
|
|
Keyboard.m
|
2013-08-08 23:49:24 +04:00
|
|
|
PasswordDialog.m)
|
2013-04-12 02:09:28 +04:00
|
|
|
|
2013-08-08 23:49:24 +04:00
|
|
|
list(APPEND ${MODULE_PREFIX}_SOURCES ${${MODULE_PREFIX}_OBJECTIVE_SOURCES})
|
2013-04-12 02:09:28 +04:00
|
|
|
|
2013-08-08 23:49:24 +04:00
|
|
|
set(${MODULE_PREFIX}_HEADERS
|
|
|
|
mfreerdp.h
|
|
|
|
mf_client.h
|
|
|
|
MRDPCursor.h
|
|
|
|
MRDPView.h
|
2014-03-04 23:01:01 +04:00
|
|
|
Keyboard.h
|
2013-08-08 23:49:24 +04:00
|
|
|
PasswordDialog.h)
|
2013-06-11 22:56:43 +04:00
|
|
|
|
2013-08-08 23:49:24 +04:00
|
|
|
set(${MODULE_PREFIX}_RESOURCES "en.lproj/InfoPlist.strings")
|
2013-06-11 22:56:43 +04:00
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
# Include XIB file in Xcode resources.
|
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
|
|
|
message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}")
|
2013-08-08 23:49:24 +04:00
|
|
|
set(${MODULE_PREFIX}_RESOURCES ${${MODULE_PREFIX}_RESOURCES} ${${MODULE_PREFIX}_XIBS})
|
2013-06-23 08:18:55 +04:00
|
|
|
endif()
|
2013-04-12 02:09:28 +04:00
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
add_library(${MODULE_NAME}
|
|
|
|
SHARED
|
2013-06-14 00:18:19 +04:00
|
|
|
../common/client.c
|
2013-08-08 23:49:24 +04:00
|
|
|
${${MODULE_PREFIX}_SOURCES}
|
|
|
|
${${MODULE_PREFIX}_HEADERS}
|
|
|
|
${${MODULE_PREFIX}_RESOURCES})
|
2012-05-11 00:18:29 +04:00
|
|
|
|
2013-06-23 08:18:55 +04:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME "${MODULE_OUTPUT_NAME}")
|
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
# configures the framework to always be looked for in the application bundle in the Frameworks sub-folder.
|
2013-08-08 23:49:24 +04:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_INSTALL_PATH @executable_path/../Frameworks/)
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2013-05-31 22:57:48 +04:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH}
|
2013-05-31 21:51:50 +04:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
|
2012-05-11 00:18:29 +04:00
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES
|
|
|
|
FRAMEWORK TRUE
|
|
|
|
MACOSX_FRAMEWORK_IDENTIFIER com.awakecoding.${MODULE_NAME}
|
|
|
|
FRAMEWORK_VERSION 1.1.0
|
|
|
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING 1.1.0
|
2013-07-22 20:38:15 +04:00
|
|
|
MACOSX_FRAMEWORK_BUNDLE_BUNDLE_VERSION 1.1.0
|
|
|
|
INSTALL_NAME_DIR "@executable_path/../Frameworks"
|
2013-05-31 21:51:50 +04:00
|
|
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
|
|
|
|
BUILD_WITH_INSTALL_RPATH 1)
|
2013-05-31 20:48:40 +04:00
|
|
|
|
|
|
|
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS} freerdp-client)
|
|
|
|
|
2012-10-19 07:10:45 +04:00
|
|
|
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD}
|
|
|
|
MODULE freerdp
|
2013-01-19 02:32:58 +04:00
|
|
|
MODULES freerdp-core freerdp-cache freerdp-gdi freerdp-codec freerdp-primitives freerdp-rail freerdp-utils)
|
2012-10-19 07:10:45 +04:00
|
|
|
|
2012-11-01 07:30:52 +04:00
|
|
|
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD}
|
|
|
|
MODULE winpr
|
2013-03-11 08:35:15 +04:00
|
|
|
MODULES winpr-input winpr-crt winpr-utils)
|
2012-11-01 07:30:52 +04:00
|
|
|
|
2012-10-19 07:10:45 +04:00
|
|
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
2012-10-01 19:48:53 +04:00
|
|
|
|
2013-05-31 22:57:48 +04:00
|
|
|
# Set a list of the dependent targets used by the application. There should be a way to get this list automatically
|
|
|
|
# from cmake, but for now I put it down manually. I got the references by calling "otool -L MacFreeRDP-client"
|
|
|
|
|
|
|
|
set(DEPENDENCIES "")
|
|
|
|
|
|
|
|
foreach(LIB ${${MODULE_PREFIX}_LIBS})
|
|
|
|
get_target_property(LOCATION ${LIB} LOCATION)
|
|
|
|
if(NOT ${LOCATION} MATCHES ".*-NOTFOUND")
|
|
|
|
list(APPEND DEPENDENCIES ${LIB})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2013-03-11 08:35:15 +04:00
|
|
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Mac")
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2013-06-11 22:56:43 +04:00
|
|
|
if (${BUILD_SHARED_LIBS})
|
|
|
|
# Add a post-build event to copy the dependent libraries in the framework bundle
|
|
|
|
# Call install_name_tool to reassign the library install name
|
|
|
|
foreach(LIB ${DEPENDENCIES})
|
|
|
|
# message("adding post-build dependency: ${LIB}")
|
|
|
|
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy
|
|
|
|
"$<TARGET_FILE:${LIB}>"
|
2013-06-26 00:05:37 +04:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
|
2013-06-11 22:56:43 +04:00
|
|
|
COMMENT "Copying ${LIB} to output directory"
|
2013-06-23 08:18:55 +04:00
|
|
|
COMMAND install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>"
|
2013-06-26 00:05:37 +04:00
|
|
|
"@executable_path/../Frameworks/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/${MODULE_NAME}"
|
2013-06-11 22:56:43 +04:00
|
|
|
COMMENT Setting install name for ${LIB}
|
2013-06-23 08:18:55 +04:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E echo install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>"
|
2013-06-26 00:05:37 +04:00
|
|
|
"@executable_path/../Frameworks/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/${MODULE_NAME}")
|
2013-06-11 22:56:43 +04:00
|
|
|
endforeach()
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2013-06-11 22:56:43 +04:00
|
|
|
# Call install_name_tool to reassign the library install names in dependent libraries
|
|
|
|
foreach(DEST ${DEPENDENCIES})
|
2013-06-23 08:18:55 +04:00
|
|
|
foreach(LIB ${DEPENDENCIES})
|
|
|
|
# message("adding post-build dependency: ${LIB}")
|
|
|
|
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
|
|
|
|
COMMAND install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>"
|
2013-06-26 00:05:37 +04:00
|
|
|
"@executable_path/../Frameworks/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${DEST}>"
|
2013-06-23 08:18:55 +04:00
|
|
|
COMMENT Setting install name for ${LIB} in module ${DEST})
|
|
|
|
endforeach()
|
2013-06-11 22:56:43 +04:00
|
|
|
endforeach()
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2013-06-11 22:56:43 +04:00
|
|
|
endif()
|
2013-05-31 20:48:40 +04:00
|
|
|
|
|
|
|
# Add post-build NIB file generation in unix makefiles. XCode handles this implicitly.
|
2013-07-16 20:16:44 +04:00
|
|
|
# if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
|
2013-05-31 20:48:40 +04:00
|
|
|
message(STATUS "Adding post-build NIB file generation event for ${MODULE_NAME}")
|
|
|
|
|
|
|
|
# Make sure we can find the 'ibtool' program. If we can NOT find it we
|
|
|
|
# skip generation of this project
|
|
|
|
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
|
|
|
|
if (${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
|
2013-06-23 08:18:55 +04:00
|
|
|
message(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. It should have been installed with
|
|
|
|
the Apple developer tools. The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin")
|
2013-05-31 20:48:40 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Make sure the 'Resources' Directory is correctly created before we build
|
2013-06-23 08:18:55 +04:00
|
|
|
add_custom_command(TARGET ${MODULE_NAME} PRE_BUILD
|
2013-06-26 00:05:37 +04:00
|
|
|
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Versions/${MACOSX_BUNDLE_SHORT_VERSION_STRING}/Resources)
|
2013-05-31 20:48:40 +04:00
|
|
|
|
|
|
|
# Compile the .xib files using the 'ibtool' program with the destination being the app package
|
2013-09-18 01:12:33 +04:00
|
|
|
foreach(xib ${${MODULE_PREFIX}_XIBS})
|
2013-05-31 20:48:40 +04:00
|
|
|
get_filename_component(XIB_WE ${xib} NAME_WE)
|
|
|
|
|
|
|
|
add_custom_command (TARGET ${MODULE_NAME} POST_BUILD
|
|
|
|
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
|
2013-08-10 05:23:08 +04:00
|
|
|
--compile ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Versions/${MACOSX_BUNDLE_SHORT_VERSION_STRING}/Resources/${XIB_WE}.nib ${CMAKE_CURRENT_SOURCE_DIR}/${xib}
|
2013-05-31 20:48:40 +04:00
|
|
|
COMMENT "Compiling ${xib}")
|
|
|
|
endforeach()
|
2013-07-16 20:16:44 +04:00
|
|
|
# endif()
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2013-06-15 00:19:03 +04:00
|
|
|
# Copy the public header files into the framework
|
2013-08-08 23:49:24 +04:00
|
|
|
foreach(HEADER ${${MODULE_PREFIX}_HEADERS})
|
2013-06-23 08:18:55 +04:00
|
|
|
# message("adding post-build dependency: ${LIB}")
|
|
|
|
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
|
2013-08-09 00:38:50 +04:00
|
|
|
COMMAND ditto ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Headers/
|
2013-06-23 08:18:55 +04:00
|
|
|
COMMENT Copying public header files to ${MODULE_NAME})
|
2013-06-15 00:19:03 +04:00
|
|
|
endforeach()
|
2013-06-11 22:56:43 +04:00
|
|
|
|
2013-06-15 00:19:03 +04:00
|
|
|
# Copy the FreeRDP header files into the framework
|
|
|
|
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
|
2013-06-26 00:05:37 +04:00
|
|
|
COMMAND ditto ${CMAKE_SOURCE_DIR}/include/freerdp ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Headers/freerdp
|
2013-07-22 20:38:15 +04:00
|
|
|
COMMAND ditto ${CMAKE_SOURCE_DIR}/winpr/include/winpr ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Headers/winpr
|
2013-06-23 08:18:55 +04:00
|
|
|
COMMENT Copying FreeRDP header files to ${MODULE_NAME})
|
2013-06-11 22:56:43 +04:00
|
|
|
|
2013-06-23 08:18:55 +04:00
|
|
|
add_subdirectory(cli)
|