Skip to content

Commit d79478b

Browse files
authored
Include docs and resources in macOS packaging; install docs/* and doc… (#721)
* Include docs and resources in macOS packaging; install docs/* and docs subdirs * Fixing
1 parent 36eec8f commit d79478b

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ set(CPACK_PACKAGE_VENDOR "The University of California Marching Band Computer Co
5757
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CalChart, the tool to chart shows for the Cal Band.")
5858
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
5959
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
60+
## Ensure all packaging components are available to CPack on all platforms
61+
## so that docs and resources are included in created packages (e.g. macOS DragNDrop DMG).
6062
if(MSVC)
6163
set(CPACK_COMPONENTS_ALL applications Docs Resources)
6264
else()

src/CMakeLists.txt

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@
33
# CalChart docs
44
file(
55
GLOB CalChartDocs
6-
"${PROJECT_SOURCE_DIR}/docs/source/*"
6+
"${PROJECT_SOURCE_DIR}/docs/*"
77
)
88

9+
# Split CalChartDocs into plain files and directories so we can install them
10+
# appropriately (install FILES cannot be given directories).
11+
set(CalChartDocFiles)
12+
set(CalChartDocDirs)
13+
foreach(_doc ${CalChartDocs})
14+
if(IS_DIRECTORY ${_doc})
15+
list(APPEND CalChartDocDirs ${_doc})
16+
else()
17+
list(APPEND CalChartDocFiles ${_doc})
18+
endif()
19+
endforeach()
20+
921
file(
1022
GLOB CalChartResources
1123
"${PROJECT_SOURCE_DIR}/resources/common/*"
@@ -209,11 +221,25 @@ endif ()
209221

210222
# we add some targets for docs and images so we can pack them for windows
211223
# see http://yanivresearch.info/software/CPackWindowsTutorial/CPackForWindows.html
212-
install(
213-
FILES ${CalChartDocs}
214-
DESTINATION docs
215-
COMPONENT Docs
216-
)
224+
## Install top-level doc files and the docs/source directory (if present)
225+
if(CalChartDocFiles)
226+
install(
227+
FILES
228+
${CalChartDocFiles}
229+
DESTINATION docs
230+
COMPONENT Docs
231+
)
232+
endif()
233+
234+
# Install any subdirectories found under docs/ (e.g. docs/source)
235+
foreach(_docdir ${CalChartDocDirs})
236+
get_filename_component(_basename ${_docdir} NAME)
237+
install(
238+
DIRECTORY "${_docdir}/"
239+
DESTINATION docs/${_basename}
240+
COMPONENT Docs
241+
)
242+
endforeach()
217243

218244
install(
219245
FILES ${CalChartResources}

0 commit comments

Comments
 (0)