|
1 | | -# Copyright (C) 2019 - 2022 by Pedro Mendes, Rector and Visitors of the |
| 1 | +# Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the |
2 | 2 | # University of Virginia, University of Heidelberg, and University |
3 | 3 | # of Connecticut School of Medicine. |
4 | 4 | # All rights reserved. |
@@ -69,9 +69,57 @@ if (BUILD_STATIC_COPASISE) |
69 | 69 | set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) |
70 | 70 | endif (BUILD_STATIC_COPASISE) |
71 | 71 |
|
72 | | -add_executable(CopasiUI ${COPASI_UI_FLAGS} ${SOURCES} ${HEADERS}) |
| 72 | +# need to bundle resource files for apple |
| 73 | +set (RESOURCES) |
| 74 | +if (APPLE) |
| 75 | + file(GLOB_RECURSE WIZARD_RESOURCES "${CMAKE_SOURCE_DIR}/copasi/wizard/help_html/*") |
| 76 | + file(GLOB_RECURSE EXAMPLES_RESOURCES "${CMAKE_SOURCE_DIR}/TestSuite/distribution/*") |
| 77 | + set (ICNS_FILE "${CMAKE_SOURCE_DIR}/copasi.icns") |
| 78 | + set (RESOURCES ${WIZARD_RESOURCES} ${EXAMPLES_RESOURCES} ${ICNS_FILE}) |
| 79 | +endif() |
| 80 | + |
| 81 | +add_executable(CopasiUI ${COPASI_UI_FLAGS} ${SOURCES} ${HEADERS} ${RESOURCES}) |
73 | 82 | target_link_libraries(CopasiUI libCOPASIUI) |
74 | 83 |
|
| 84 | +# now modify the package location for the resource files |
| 85 | +if (APPLE) |
| 86 | + |
| 87 | +# Wizard files first |
| 88 | +foreach (FILE ${WIZARD_RESOURCES}) |
| 89 | + # Get the relative path from the data-folder to the particular file. |
| 90 | + file(RELATIVE_PATH NEW_FILE "${CMAKE_SOURCE_DIR}/copasi/wizard/help_html" ${FILE}) |
| 91 | + |
| 92 | + # Get the relative path to the file. |
| 93 | + get_filename_component(NEW_FILE_PATH ${NEW_FILE} DIRECTORY) |
| 94 | + |
| 95 | + # Set it's location inside the app package (under Resources). |
| 96 | + set_property(SOURCE ${FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/doc/html/${NEW_FILE_PATH}") |
| 97 | + |
| 98 | + # Optional: Add the file to the 'Resources' folder group in Xcode. |
| 99 | + # This also preserves folder structure. |
| 100 | + source_group("Resources/doc/html/${NEW_FILE_PATH}" FILES "${FILE}") |
| 101 | +endforeach () |
| 102 | + |
| 103 | +# then examples |
| 104 | +foreach (FILE ${EXAMPLES_RESOURCES}) |
| 105 | + # Get the relative path from the data-folder to the particular file. |
| 106 | + file(RELATIVE_PATH NEW_FILE "${CMAKE_SOURCE_DIR}/TestSuite/distribution" ${FILE}) |
| 107 | + |
| 108 | + # Get the relative path to the file. |
| 109 | + get_filename_component(NEW_FILE_PATH ${NEW_FILE} DIRECTORY) |
| 110 | + |
| 111 | + # Set it's location inside the app package (under Resources). |
| 112 | + set_property(SOURCE ${FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/examples/${NEW_FILE_PATH}") |
| 113 | + |
| 114 | + # Optional: Add the file to the 'Resources' folder group in Xcode. |
| 115 | + # This also preserves folder structure. |
| 116 | + source_group("Resources/examples/${NEW_FILE_PATH}" FILES "${FILE}") |
| 117 | +endforeach () |
| 118 | +# and icon |
| 119 | +set_property(SOURCE ${ICNS_FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources") |
| 120 | +source_group("Resources" FILES "${ICNS_FILE}") |
| 121 | +endif() |
| 122 | + |
75 | 123 | if(NOT APPLE) |
76 | 124 | SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/CopasiUI${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "") |
77 | 125 | install(TARGETS CopasiUI DESTINATION bin) |
|
0 commit comments