| 1 |
if (TARGET sentry_crashpad::crashpad_handler) |
| 2 |
message(STATUS "Installing Sentry crashpad handler") |
| 3 |
if (APPLE) |
| 4 |
# install inside the bundle |
| 5 |
install(FILES $<TARGET_FILE:sentry_crashpad::crashpad_handler> DESTINATION FlightGear.app/Contents/MacOS OPTIONAL) |
| 6 |
else() |
| 7 |
# install in the bin-dir, next to the application binary |
| 8 |
install(FILES $<TARGET_FILE:sentry_crashpad::crashpad_handler> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) |
| 9 |
endif() |
| 10 |
endif() |
| 11 |
|
| 12 |
if (HAVE_QT) |
| 13 |
include (QtDeployment) |
| 14 |
endif() |
| 15 |
|
| 16 |
######################################################################################## |
| 17 |
# OSG plugin detection |
| 18 |
|
| 19 |
if (MSVC) |
| 20 |
set(OSG_PLUGIN_SUFFIX "bin") |
| 21 |
else() |
| 22 |
set(OSG_PLUGIN_SUFFIX "lib" "lib64") |
| 23 |
|
| 24 |
# needed for Debian where the plugins might be at /usr/lib/x86_64-linux-gnu |
| 25 |
if (CMAKE_LIBRARY_ARCHITECTURE) |
| 26 |
list(APPEND OSG_PLUGIN_SUFFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}") |
| 27 |
endif() |
| 28 |
endif() |
| 29 |
|
| 30 |
# we can't use NAMES plural because we need to know which name was found |
| 31 |
# so instead do a manual loop |
| 32 |
foreach(osgPluginDirName osgPlugins osgPlugins-${OPENSCENEGRAPH_VERSION}) |
| 33 |
find_path(osgPluginLocation |
| 34 |
NAMES ${osgPluginDirName} |
| 35 |
|
| 36 |
PATHS |
| 37 |
${FINAL_MSVC_3RDPARTY_DIR} |
| 38 |
PATH_SUFFIXES |
| 39 |
${OSG_PLUGIN_SUFFIX} |
| 40 |
) |
| 41 |
|
| 42 |
if (osgPluginLocation) |
| 43 |
set(OSG_PLUGINS_DIR "${osgPluginLocation}/${osgPluginDirName}") |
| 44 |
get_filename_component(OSG_BASE_DIR ${osgPluginLocation} DIRECTORY) |
| 45 |
break() |
| 46 |
endif() |
| 47 |
endforeach() |
| 48 |
|
| 49 |
if (NOT OSG_PLUGINS_DIR) |
| 50 |
message(FATAL_ERROR "Couldn't find osgPlugins directory") |
| 51 |
endif() |
| 52 |
|
| 53 |
message(STATUS "OSG plugins at: ${OSG_PLUGINS_DIR}") |
| 54 |
|
| 55 |
######################################################################################## |
| 56 |
# find OpenThreads and OpenSceneGraph DLL versions |
| 57 |
# would be simpler with CMake 3.29 where file(STRINGS) can do regular expression matching |
| 58 |
# directly, but this is not too bad at least |
| 59 |
|
| 60 |
set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version") |
| 61 |
set(_openthreads_Version_file "${OSG_INCLUDE_DIR}/OpenThreads/Version") |
| 62 |
if( NOT EXISTS "${_osg_Version_file}" OR NOT EXISTS ${_openthreads_Version_file}) |
| 63 |
message(FATAL_ERROR "Couldn't find OpenSceneGraph or OpenThreads Version headers.") |
| 64 |
endif() |
| 65 |
|
| 66 |
file(STRINGS "${_osg_Version_file}" _osg_Version_contents |
| 67 |
REGEX "#define OPENSCENEGRAPH_SOVERSION[ \t]+[0-9]+") |
| 68 |
|
| 69 |
file(STRINGS "${_openthreads_Version_file}" _openthreads_Version_contents |
| 70 |
REGEX "#define OPENTHREADS_SOVERSION[ \t]+[0-9]+") |
| 71 |
|
| 72 |
string(REGEX REPLACE ".*#define OPENSCENEGRAPH_SOVERSION[ \t]+([0-9]+).*" |
| 73 |
"\\1" osg_soversion ${_osg_Version_contents}) |
| 74 |
|
| 75 |
string(REGEX REPLACE ".*#define OPENTHREADS_SOVERSION[ \t]+([0-9]+).*" |
| 76 |
"\\1" openthreads_soversion ${_openthreads_Version_contents}) |
| 77 |
|
| 78 |
message(STATUS "OSG SO version: ${osg_soversion}") |
| 79 |
message(STATUS "OpenThreads SO version: ${openthreads_soversion}") |
| 80 |
|
| 81 |
if (MSVC) |
| 82 |
configure_file(${CMAKE_CURRENT_LIST_DIR}/generateInnoSetupConfig.cmake.in |
| 83 |
${CMAKE_BINARY_DIR}/generateInnoSetupConfig.cmake |
| 84 |
@ONLY) |
| 85 |
|
| 86 |
install(SCRIPT ${CMAKE_BINARY_DIR}/generateInnoSetupConfig.cmake COMPONENT packaging ) |
| 87 |
|
| 88 |
# important we use install() here so that passing a custom prefix to |
| 89 |
# 'cmake --install --prefix FOO' works correctly to put the file somewhere special |
| 90 |
install(FILES ${CMAKE_BINARY_DIR}/InstallConfig.iss DESTINATION . COMPONENT packaging ) |
| 91 |
else() |
| 92 |
configure_file(${CMAKE_CURRENT_LIST_DIR}/exportFGVersion.sh.in |
| 93 |
${CMAKE_BINARY_DIR}/exportFGVersion.sh |
| 94 |
@ONLY) |
| 95 |
endif() |
| 96 |
|
| 97 |
|
| 98 |
######################################################################################## |
| 99 |
|
| 100 |
# OSG libs |
| 101 |
foreach (osglib OSG OpenThreads osgUtil osgText osgGA osgSim osgParticle osgTerrain osgViewer osgDB) |
| 102 |
if (APPLE) |
| 103 |
install(FILES |
| 104 |
$<TARGET_FILE:OSG::${osglib}> |
| 105 |
DESTINATION |
| 106 |
$<TARGET_BUNDLE_CONTENT_DIR:fgfs>/Frameworks |
| 107 |
) |
| 108 |
endif() |
| 109 |
endforeach() |
| 110 |
|
| 111 |
if (APPLE) |
| 112 |
# OSG plugins |
| 113 |
install(DIRECTORY ${OSG_PLUGINS_DIR} DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/PlugIns) |
| 114 |
|
| 115 |
# add extra utilites to the bundle |
| 116 |
install(TARGETS fgcom fgjs fgelev DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/MacOS) |
| 117 |
|
| 118 |
if (TARGET sentry::sentry) |
| 119 |
install(FILES $<TARGET_FILE:sentry::sentry> DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/Frameworks) |
| 120 |
endif() |
| 121 |
|
| 122 |
if (TARGET sentry_crashpad::handler) |
| 123 |
install(FILES $<TARGET_FILE:sentry_crashpad::handler> DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/MacOS) |
| 124 |
endif() |
| 125 |
|
| 126 |
if (TARGET DBus::DBus) |
| 127 |
#get_target_property(dbusLib DBus::DBus IMPORTED_LOCATION) |
| 128 |
#message(STATUS "DBus library at: ${dbusLib}") |
| 129 |
#install(FILES ${dbusLib} DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/MacOS) |
| 130 |
install(FILES $<TARGET_FILE:DBus::DBus> DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/Frameworks) |
| 131 |
endif() |
| 132 |
|
| 133 |
# FIXME: this copies the fully version file name, need to rename to the non-versioned one |
| 134 |
install(FILES |
| 135 |
$<TARGET_FILE:OpenAL::OpenAL> |
| 136 |
DESTINATION |
| 137 |
$<TARGET_BUNDLE_CONTENT_DIR:fgfs>/Frameworks |
| 138 |
) |
| 139 |
|
| 140 |
install(FILES ${CMAKE_SOURCE_DIR}/package/mac/FlightGear.icns DESTINATION $<TARGET_BUNDLE_CONTENT_DIR:fgfs>/Resources) |
| 141 |
endif() |
| 142 |
|
| 143 |
######################################################################################## |
| 144 |
# AppDir creation for Linux AppImage |
| 145 |
|
| 146 |
if (LINUX) |
| 147 |
|
| 148 |
install(DIRECTORY ${OSG_PLUGINS_DIR} |
| 149 |
DESTINATION appdir/usr/lib |
| 150 |
COMPONENT packaging EXCLUDE_FROM_ALL) |
| 151 |
install(TARGETS fgcom fgjs fgelev fgfs |
| 152 |
DESTINATION appdir/usr/bin |
| 153 |
COMPONENT packaging EXCLUDE_FROM_ALL) |
| 154 |
|
| 155 |
install(FILES /etc/ssl/certs/ca-certificates.crt |
| 156 |
DESTINATION appdir/usr/ssl |
| 157 |
RENAME cacert.pem |
| 158 |
OPTIONAL |
| 159 |
COMPONENT packaging EXCLUDE_FROM_ALL) |
| 160 |
install(CODE " |
| 161 |
if(NOT EXISTS /etc/ssl/certs/ca-certificates.crt) |
| 162 |
message(WARNING \"No SSL certificates found, will not be included in AppImage\") |
| 163 |
endif() |
| 164 |
") |
| 165 |
# TODO: things under share/ |
| 166 |
endif() |
| 167 |
|
| 168 |
|
| 169 |
######################################################################################## |
| 170 |
# actual app installation: this needs to happen late, after the various TARGET_BUNDLE_CONTENT_DIR |
| 171 |
# rules are applied |
| 172 |
|
| 173 |
if (APPLE) |
| 174 |
install(TARGETS fgfs BUNDLE DESTINATION .) |
| 175 |
else() |
| 176 |
install(TARGETS fgfs RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 177 |
endif() |
| 178 |
|
| 179 |
|
| 180 |
#----------------------------------------------------------------------------- |
| 181 |
### uninstall target |
| 182 |
#----------------------------------------------------------------------------- |
| 183 |
CONFIGURE_FILE( |
| 184 |
"${PROJECT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in" |
| 185 |
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake" |
| 186 |
IMMEDIATE @ONLY) |
| 187 |
ADD_CUSTOM_TARGET(uninstall |
| 188 |
"${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_uninstall.cmake") |
| 189 |
|