FreeRDP/client/Mac/CMakeLists.txt
dev dd56308bde [client,mac] Simplify builder
* Build MacFreeRDP as normal application, let the bundling out of
  building
* Add a bunding script allowing to create a MacFreeRDP with all
  dependencies installed
2023-12-05 09:21:23 +01:00

106 lines
2.5 KiB
CMake

project(MacFreeRDP-library)
cmake_policy(SET CMP0026 OLD)
cmake_policy(SET CMP0045 OLD)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "project default" FORCE)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/)
include(PreventInSourceBuilds)
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
find_library(COCOA_LIBRARY Cocoa REQUIRED)
find_library(APPKIT_LIBRARY AppKit REQUIRED)
find_library(IOKIT_LIBRARY IOKit REQUIRED)
find_library(COREGRAPHICS_LIBRARY CoreGraphics REQUIRED)
set(EXTRA_LIBS ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY} ${IOKIT_LIBRARY})
set(XIBS
CertificateDialog.xib
PasswordDialog.xib)
set(SOURCES "")
set(OBJECTIVE_SOURCES
main.m
mf_client.m
MRDPCursor.m
MRDPView.m
Keyboard.m
Clipboard.m
CertificateDialog.m
PasswordDialog.m)
list(APPEND SOURCES ${OBJECTIVE_SOURCES})
set(HEADERS
mfreerdp.h
mf_client.h
MRDPCursor.h
MRDPView.h
Keyboard.h
Clipboard.h
CertificateDialog.h
PasswordDialog.h)
set(RESOURCES "en.lproj/InfoPlist.strings")
# Include XIB file in Xcode resources.
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}")
list(APPEND RESOURCES ${XIBS})
set(IS_XCODE ON)
endif()
add_library(${PROJECT_NAME}
../common/client.c
${SOURCES}
${HEADERS}
${RESOURCES})
set(LIBS
${EXTRA_LIBS}
freerdp-client
)
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}")
if (NOT IS_XCODE)
find_program(IBTOOL ibtool REQUIRED
HINTS
"/usr/bin"
"${OSX_DEVELOPER_ROOT}/usr/bin"
)
# Compile the .xib files using the 'ibtool' program with the destination being the app package
foreach(xib ${XIBS})
get_filename_component(XIB_WE ${xib} NAME_WE)
set(NIB ${CMAKE_CURRENT_BINARY_DIR}/${XIB_WE}.nib)
list(APPEND NIBS ${NIB})
add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
--compile ${NIB} ${CMAKE_CURRENT_SOURCE_DIR}/${xib}
COMMENT "Compiling ${xib}")
endforeach()
install(FILES ${NIBS} DESTINATION ${CMAKE_INSTALL_DATADIR})
endif()
install(TARGETS ${PROJECT_NAME}
COMPONENT client
RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR}
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(cli)