Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Fix broken Linux and Windows builds
[xestiaab/.git] / source / CMakeFunctions / Application.cmake
index ddf96a4..aa8393d 100644 (file)
@@ -34,13 +34,93 @@ set(FILE_LIST main.cpp
               frmUpdate.cpp
               frmUpdate.h)
 
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
-    list(APPEND ${FILE_LIST} frmEditAccount.mm
-                             frmNewAccount.mm)
+if(APPLE)
+    list(APPEND FILE_LIST frmEditAccount.mm
+                          frmNewAccount.mm
+                          frmMain.mm
+                          os/osx/XestiaAddressBook.icns)
+endif()
+
+list(APPEND LIBRARIES ${wxWidgets_LIBRARIES}
+                      ${LIBXML2_LIBRARY}
+                      sfml-audio
+                      CURL::libcurl
+                      actmgr
+                      carddav2
+                      common
+                      contacteditor
+                      export
+                      import
+                      misc
+                      search
+                      vcard
+                      widgets)
+
+if (MSVC)
+    list(APPEND LIBRARIES wsock32
+                          wininet
+                          security
+                          cryptui
+                          crypt32)
+    list(APPEND FILE_LIST os/msw/xestiaab.rc)
+                          
+    add_executable(xestiaab WIN32
+                   ${FILE_LIST})
+    target_link_libraries(xestiaab LINK_PUBLIC
+                          ${LIBRARIES})
+elseif(APPLE)
+    # Main icons
+    set_source_files_properties(os/osx/XestiaAddressBook.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
+    set(MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/os/osx/Info.plist")
+    set(CMAKE_BUILD_PATH_USE_ORIGIN TRUE)
+    set(APPS "\${CMAKE_INSTALL_PREFIX}/xestiaab.app")
+    set(DIR ${CMAKE_BINARY_DIR})
+    
+    install(CODE "include(BundleUtilities)
+        fixup_bundle(\"${APPS}\" \"\" \"\")")
+
+    # Documentation
+    file(GLOB DocumentationFiles ${CMAKE_SOURCE_DIR}/../docs/*.fodt)
+    set_source_files_properties(${DocumentationFiles} 
+        PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+
+    add_executable(xestiaab MACOSX_BUNDLE
+        ${FILE_LIST}
+        ${DocumentationFiles}
+        ${FrameworkFiles})
+    
+    install(TARGETS xestiaab
+        BUNDLE DESTINATION . COMPONENT Runtime
+        RUNTIME DESTINATION bin COMPONENT Runtime)
+
+    target_link_libraries(xestiaab LINK_PUBLIC
+                          stdc++
+                          objc
+                          ${COREFOUNDATION_FRAMEWORK}
+                          ${SECURITY_FRAMEWORK}
+                          ${SECURITYINTERFACE_FRAMEWORK}
+                          ${LIBRARIES})
+
+    set_target_properties(xestiaab PROPERTIES
+                          MACOSX_BUNDLE TRUE
+                          MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/os/osx/Info.plist)
+        
+    add_custom_command(
+        TARGET xestiaab
+        COMMAND ${CMAKE_COMMAND} -D SRC=$<TARGET_BUNDLE_DIR:xestiaab>/Contents/MacOS/xestiaab
+                                 -D DST=$<TARGET_BUNDLE_DIR:xestiaab>/Contents/Frameworks
+                                 -D SFML_FRAMEWORKS_LOCATION=${SFML_FRAMEWORKS_LOCATION}
+                                 -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeFunctions/CopyLibraries.cmake
+        POST_BUILD
+    )
+else()
+    add_executable(xestiaab
+        ${FILE_LIST})
+
+    target_link_libraries(xestiaab LINK_PUBLIC
+                          ${LIBRARIES})
 endif()
 
-add_executable(xestiaab
-    ${FILE_LIST})
 
 message("${RUNTIME_OUTPUT_NAME_bitmapcode}")
 
@@ -49,23 +129,6 @@ target_include_directories(xestiaab
     ".")
     
 add_dependencies(xestiaab bitmapcode)
-    
-target_link_libraries(xestiaab
-    LINK_PUBLIC
-    ${wxWidgets_LIBRARIES}
-    ${LIBXML2_LIBRARY}
-    sfml-audio
-    CURL::libcurl
-    actmgr
-    carddav2
-    common
-    contacteditor
-    export
-    import
-    misc
-    search
-    vcard
-    widgets)
 
 file(GLOB DOCUMENTATION_INSTALL_FILES "${CMAKE_SOURCE_DIR}/../docs/*")
 foreach(ITEM ${DOCUMENTATION_INSTALL_FILES})
@@ -75,9 +138,3 @@ foreach(ITEM ${DOCUMENTATION_INSTALL_FILES})
         list(APPEND DOCUMENTATION_DEPLOY_DIRECTORIES "${ITEM}")
     endif()
 endforeach()
-
-install(TARGETS xestiaab RUNTIME DESTINATION bin)
-install(TARGETS odthelpbrowser RUNTIME DESTINATION bin)
-install(FILES ${CMAKE_SOURCE_DIR}/xestiaab.1 DESTINATION share/man/man1)
-install(FILES ${DOCUMENTATION_DEPLOY_FILES} DESTINATION share/doc/xestiaab)
-install(FILES ${DOCUMENTATION_DEPLOY_DIRECTORIES} DESTINATION share/doc/xestiaab)
\ No newline at end of file
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