Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Setup CMake to build for macOS
[xestiaab/.git] / source / CMakeFunctions / Application.cmake
1 set(MISC_TARGET_NAME misc)
3 set(MISC_FILE_LIST convert.cpp
4                    convert.h
5                    debug.h
6                    enums.h
7                    version.h)
9 add_library(${MISC_TARGET_NAME}
10             ${MISC_FILE_LIST})
12 set(FILE_LIST main.cpp
13               AppXestiaAddrBk.cpp
14               AppXestiaAddrBk.h
15               frmAbout.cpp
16               frmAbout.h
17               frmConflictResolution.cpp
18               frmConflictResolution.h
19               frmContact.cpp
20               frmContact.h
21               frmEditAccount.cpp
22               frmEditAccount.h
23               frmInvalidSSLCertificate.cpp
24               frmInvalidSSLCertificate.h
25               frmMain.cpp
26               frmMain.h
27               frmNewAccount.cpp
28               frmNewAccount.h
29               frmNewAccount-CardDAV2.cpp
30               frmPreferences.cpp
31               frmPreferences.h
32               frmSSLCertificate.cpp
33               frmSSLCertificate.h
34               frmUpdate.cpp
35               frmUpdate.h)
37 if(APPLE)
38     list(APPEND FILE_LIST frmEditAccount.mm
39                           frmNewAccount.mm
40                           frmMain.mm
41                           os/osx/XestiaAddressBook.icns)
42 endif()
44 list(APPEND LIBRARIES ${wxWidgets_LIBRARIES}
45                       ${LIBXML2_LIBRARY}
46                       sfml-audio
47                       CURL::libcurl
48                       actmgr
49                       carddav2
50                       common
51                       contacteditor
52                       export
53                       import
54                       misc
55                       search
56                       vcard
57                       widgets)
59 if (MSVC)
60     list(APPEND LIBRARIES wsock32
61                           wininet
62                           security
63                           cryptui
64                           crypt32)
65 endif()
67 if (MSVC)
68     list(APPEND FILE_LIST os/msw/xestiaab.rc)
69     add_executable(xestiaab WIN32
70         ${FILE_LIST})
71 elseif(APPLE)
72     # Main icons
73     set_source_files_properties(os/osx/XestiaAddressBook.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
74     set(MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/os/osx/Info.plist")
75     set(CMAKE_BUILD_PATH_USE_ORIGIN TRUE)
76     set(APPS "\${CMAKE_INSTALL_PREFIX}/xestiaab.app")
77     set(DIR ${CMAKE_BINARY_DIR})
78     
79     install(CODE "include(BundleUtilities)
80         fixup_bundle(\"${APPS}\" \"\" \"\")")
82     # Documentation
83     file(GLOB DocumentationFiles ${CMAKE_SOURCE_DIR}/../docs/*.fodt)
84     set_source_files_properties(${DocumentationFiles} 
85         PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
87     add_executable(xestiaab MACOSX_BUNDLE
88         ${FILE_LIST}
89         ${DocumentationFiles}
90         ${FrameworkFiles})
91     
92     install(TARGETS xestiaab
93         BUNDLE DESTINATION . COMPONENT Runtime
94         RUNTIME DESTINATION bin COMPONENT Runtime)
96     target_link_libraries(xestiaab LINK_PUBLIC
97                           stdc++
98                           objc
99                           ${COREFOUNDATION_FRAMEWORK}
100                           ${SECURITY_FRAMEWORK}
101                           ${SECURITYINTERFACE_FRAMEWORK}
102                           ${LIBRARIES})
104     set_target_properties(xestiaab PROPERTIES
105                           MACOSX_BUNDLE TRUE
106                           MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/os/osx/Info.plist)
107         
108     add_custom_command(
109         TARGET xestiaab
110         COMMAND ${CMAKE_COMMAND} -D SRC=$<TARGET_BUNDLE_DIR:xestiaab>/Contents/MacOS/xestiaab
111                                  -D DST=$<TARGET_BUNDLE_DIR:xestiaab>/Contents/Frameworks
112                                  -D SFML_FRAMEWORKS_LOCATION=${SFML_FRAMEWORKS_LOCATION}
113                                  -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeFunctions/CopyLibraries.cmake
114         POST_BUILD
115     )
116 else()
117     add_executable(xestiaab
118         ${FILE_LIST})
119 endif()
122 message("${RUNTIME_OUTPUT_NAME_bitmapcode}")
124 target_include_directories(xestiaab
125     PUBLIC
126     ".")
127     
128 add_dependencies(xestiaab bitmapcode)
130 file(GLOB DOCUMENTATION_INSTALL_FILES "${CMAKE_SOURCE_DIR}/../docs/*")
131 foreach(ITEM ${DOCUMENTATION_INSTALL_FILES})
132     if(IS_DIRECTORY "${ITEM}")
133         list(APPEND DOCUMENTATION_DEPLOY_FILES "${ITEM}")
134     else()
135         list(APPEND DOCUMENTATION_DEPLOY_DIRECTORIES "${ITEM}")
136     endif()
137 endforeach()
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy