Skip to content

Commit

Permalink
Use Applications/ instead of bin/ for bundles on macOS. (#9155)
Browse files Browse the repository at this point in the history
  - Install macOS BUNDLEs to an `Applications/` directory instead of `bin/`

  - Improves #9145

  - Unrelated: Add quotes to some paths. We need to do many more of these.
  • Loading branch information
mahge committed Jun 28, 2022
1 parent 2978aa7 commit 78ef84d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Expand Up @@ -108,18 +108,23 @@ include(GNUInstallDirs)
# unintentionally. If the user has not specified anything default to an install_cmake dir in the root
# build directory.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/install_cmake CACHE PATH "Default installation directory" FORCE)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install_cmake" CACHE PATH "Default installation directory" FORCE)
# Prevent sub-projects from changing it by checking CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT after this
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
message(WARNING "No installation directory specified. Defaulting to: ${CMAKE_INSTALL_PREFIX}")
endif()
omc_add_to_report(CMAKE_INSTALL_PREFIX)

# We prefer to install libs to "<library architecture>/omc" dir inside lib directory (e.g lib/x86_64-linux-gnu/omc/).
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}/omc/)
set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}/omc/")

# We prefer to install headers to "include/omc" dir inside.
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/omc/)
set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/omc/")

# On macOS we want BUNDLEs (.app) to go to an 'Applications/' directory instead of a 'bin/' directory
if(APPLE)
set(OM_MACOS_INSTALL_BUNDLEDIR "Applications/")
endif()

## Set the adjusted installation lib directory as an rpath for all installed binaries.
## Assumes binaries end up in either 'bin' or 'lib' AND also assumes that 'bin' and 'lib' are sibling directories.
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/CMakeLists.txt
Expand Up @@ -4,7 +4,7 @@ add_executable(OMEdit WIN32 MACOSX_BUNDLE main.cpp rc_omedit.rc)
target_link_libraries(OMEdit PRIVATE OMEditLib)

install(TARGETS OMEdit
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
BUNDLE DESTINATION ${OM_MACOS_INSTALL_BUNDLEDIR})


# Install the runtime dependency dlls if we are on MSYS/MinGW.
Expand Down
2 changes: 1 addition & 1 deletion OMNotebook/OMNotebook/OMNotebookGUI/CMakeLists.txt
Expand Up @@ -102,7 +102,7 @@ target_link_libraries(OMNotebook PUBLIC OpenModelicaCompiler)


install(TARGETS OMNotebook
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
BUNDLE DESTINATION ${OM_MACOS_INSTALL_BUNDLEDIR})

install(FILES stylesheet.xml
commands.xml
Expand Down
2 changes: 1 addition & 1 deletion OMPlot/OMPlot/OMPlotGUI/CMakeLists.txt
Expand Up @@ -44,4 +44,4 @@ target_link_libraries(OMPlot PRIVATE OMPlotLib)

install(TARGETS OMPlotLib)
install(TARGETS OMPlot
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
BUNDLE DESTINATION ${OM_MACOS_INSTALL_BUNDLEDIR})
2 changes: 1 addition & 1 deletion OMShell/OMShell/OMShellGUI/CMakeLists.txt
Expand Up @@ -24,7 +24,7 @@ add_executable(OMShell WIN32 MACOSX_BUNDLE main.cpp rc_omshell.rc)
target_link_libraries(OMShell PRIVATE OMShellLib)

install(TARGETS OMShell
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
BUNDLE DESTINATION ${OM_MACOS_INSTALL_BUNDLEDIR})

install(FILES commands.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/omshell)

0 comments on commit 78ef84d

Please sign in to comment.