2023-12-21 19:24:43 +03:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2013-08-08 23:49:24 +04:00
|
|
|
|
2023-12-21 19:24:43 +03:00
|
|
|
if (NOT FREERDP_DEFAULT_PROJECT_VERSION)
|
|
|
|
set(FREERDP_DEFAULT_PROJECT_VERSION "1.0.0.0")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
project(MacFreeRDP
|
|
|
|
VERSION ${FREERDP_DEFAULT_PROJECT_VERSION}
|
|
|
|
)
|
|
|
|
|
|
|
|
message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2023-11-07 17:41:01 +03:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/)
|
2023-12-21 11:27:19 +03:00
|
|
|
include(CommonConfigOptions)
|
2023-11-07 17:41:01 +03:00
|
|
|
|
2013-05-31 20:48:40 +04:00
|
|
|
# Import libraries
|
2023-12-01 12:51:28 +03:00
|
|
|
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
|
|
|
|
find_library(COCOA_LIBRARY Cocoa REQUIRED)
|
|
|
|
find_library(APPKIT_LIBRARY AppKit REQUIRED)
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2018-11-29 17:46:37 +03:00
|
|
|
string(TIMESTAMP VERSION_YEAR "%Y")
|
2013-06-23 08:18:55 +04:00
|
|
|
set(MACOSX_BUNDLE_INFO_STRING "MacFreeRDP")
|
2013-05-31 20:48:40 +04:00
|
|
|
set(MACOSX_BUNDLE_ICON_FILE "FreeRDP.icns")
|
|
|
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.freerdp.mac")
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_IDENTIFIER "FreeRDP-client.Mac")
|
2018-11-29 17:46:37 +03:00
|
|
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING "MacFreeRDP Client Version ${FREERDP_VERSION}")
|
2013-05-31 20:48:40 +04:00
|
|
|
set(MACOSX_BUNDLE_BUNDLE_NAME "MacFreeRDP")
|
2018-11-29 17:46:37 +03:00
|
|
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${FREERDP_VERSION})
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_VERSION ${FREERDP_VERSION})
|
|
|
|
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013-${VERSION_YEAR}. All Rights Reserved.")
|
2013-05-31 20:48:40 +04:00
|
|
|
|
|
|
|
set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "MainMenu")
|
|
|
|
set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication")
|
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
set(XIBS MainMenu.xib)
|
2013-08-08 23:49:24 +04:00
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
set(SOURCES "")
|
2013-08-08 23:49:24 +04:00
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
set(OBJECTIVE_SOURCES
|
2013-08-08 23:49:24 +04:00
|
|
|
main.m
|
2023-12-01 12:51:28 +03:00
|
|
|
AppDelegate.m
|
|
|
|
)
|
2013-08-08 23:49:24 +04:00
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
list(APPEND SOURCES ${OBJECTIVE_SOURCES})
|
2013-08-08 23:49:24 +04:00
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
set(HEADERS
|
|
|
|
AppDelegate.h
|
|
|
|
)
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
set(RESOURCES
|
|
|
|
"en.lproj/InfoPlist.strings"
|
|
|
|
${MACOSX_BUNDLE_ICON_FILE}
|
|
|
|
)
|
2023-11-07 17:41:01 +03:00
|
|
|
# Include XIB file in Xcode resources.
|
2013-05-31 20:48:40 +04:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
2023-12-01 12:51:28 +03:00
|
|
|
message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}")
|
|
|
|
list(APPEND RESOURCES ${XIBS})
|
|
|
|
set(IS_XCODE ON)
|
2013-08-08 23:49:24 +04:00
|
|
|
endif()
|
2013-05-31 20:48:40 +04:00
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PkgInfo.in ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo @ONLY)
|
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
${HEADERS}
|
|
|
|
${SOURCES}
|
|
|
|
${RESOURCES})
|
|
|
|
|
2023-12-21 19:27:54 +03:00
|
|
|
if (WITH_BINARY_VERSIONING)
|
2023-12-22 14:51:30 +03:00
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}")
|
2023-12-21 19:27:54 +03:00
|
|
|
endif()
|
2023-12-01 12:51:28 +03:00
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}")
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
|
|
${COCOA_LIBRARY}
|
|
|
|
${FOUNDATION_LIBRARY}
|
|
|
|
${APPKIT_LIBRARY}
|
|
|
|
MacFreeRDP-library
|
|
|
|
)
|
|
|
|
|
|
|
|
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})
|
2022-12-15 01:34:54 +03:00
|
|
|
endif()
|
|
|
|
|
2023-12-01 12:51:28 +03:00
|
|
|
install(TARGETS ${PROJECT_NAME}
|
|
|
|
COMPONENT client
|
|
|
|
RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR}
|
|
|
|
)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX})
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PkgInfo DESTINATION ${CMAKE_INSTALL_PREFIX})
|