@@ -495,7 +495,7 @@ ${_DIRS_ARGS} )
495495 continue()
496496 endif()
497497 execute_process(
498- COMMAND \" ${PATCHELF_EXECUTABLE} \" --set-rpath \\ $ORIGIN \"\$ {_lib}\"
498+ COMMAND \" ${PATCHELF_EXECUTABLE} \" --force-rpath -- set-rpath \\ $ORIGIN \"\$ {_lib}\"
499499 ERROR_QUIET)
500500 endforeach()
501501 " COMPONENT NeTrainSimGUI_COMP)
@@ -532,7 +532,7 @@ ${_DIRS_ARGS} )
532532 continue()
533533 endif()
534534 execute_process(
535- COMMAND \" ${PATCHELF_EXECUTABLE} \" --set-rpath \\ $ORIGIN \"\$ {_lib}\"
535+ COMMAND \" ${PATCHELF_EXECUTABLE} \" --force-rpath -- set-rpath \\ $ORIGIN \"\$ {_lib}\"
536536 ERROR_QUIET)
537537 endforeach()
538538 " COMPONENT NeTrainSimServer_COMP)
@@ -658,15 +658,26 @@ ${_DIRS_ARGS} )
658658 continue()
659659 endif()
660660 execute_process(
661- COMMAND \" ${PATCHELF_EXECUTABLE} \" --set-rpath \\ $ORIGIN \"\$ {_lib}\"
661+ COMMAND \" ${PATCHELF_EXECUTABLE} \" --force-rpath -- set-rpath \\ $ORIGIN \"\$ {_lib}\"
662662 ERROR_QUIET)
663663 endforeach()
664664
665665 # Fix RPATH on Qt plugins in plugins/<type>/
666666 file(GLOB_RECURSE _qt_plugins \"\$ {CMAKE_INSTALL_PREFIX}/plugins/*.so\" )
667667 foreach(_plugin \$ {_qt_plugins})
668668 execute_process(
669- COMMAND \" ${PATCHELF_EXECUTABLE} \" --set-rpath \\ $ORIGIN/../../lib \"\$ {_plugin}\"
669+ COMMAND \" ${PATCHELF_EXECUTABLE} \" --force-rpath --set-rpath \\ $ORIGIN/../../lib \"\$ {_plugin}\"
670+ ERROR_QUIET)
671+ endforeach()
672+
673+ # Fix RPATH on executables in bin/
674+ file(GLOB _all_bins \"\$ {CMAKE_INSTALL_PREFIX}/bin/*\" )
675+ foreach(_bin \$ {_all_bins})
676+ if(IS_SYMLINK \"\$ {_bin}\" OR IS_DIRECTORY \"\$ {_bin}\" )
677+ continue()
678+ endif()
679+ execute_process(
680+ COMMAND \" ${PATCHELF_EXECUTABLE} \" --force-rpath --set-rpath \\ $ORIGIN/../lib:\\ $ORIGIN \"\$ {_bin}\"
670681 ERROR_QUIET)
671682 endforeach()
672683 " COMPONENT NeTrainSimCore_COMP)
@@ -706,6 +717,14 @@ install(
706717 PATTERN "*.nts"
707718)
708719
720+ # Install shared icon for desktop entries and application use
721+ install (
722+ FILES ${CMAKE_SOURCE_DIR } /src/resources/icon.png
723+ DESTINATION data
724+ RENAME NeTrainSim.png
725+ COMPONENT NeTrainSimCore_COMP
726+ )
727+
709728# ========================================
710729# SECTION J: qt.conf Generation
711730# ========================================
@@ -752,6 +771,7 @@ if(WIN32)
752771 set (CPACK_IFW_PACKAGE_NAME "NeTrainSim" )
753772 set (CPACK_IFW_PACKAGE_VERSION "${NeTrainSim_VERSION_MAJOR} .${NeTrainSim_VERSION_MINOR} .${NeTrainSim_VERSION_PATCH} " )
754773 set (CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "NeTrainSimMaintenanceTool" )
774+ set (CPACK_IFW_PACKAGE_ICON "${CMAKE_SOURCE_DIR } /src/resources/icon.ico" )
755775
756776 if (BUILD_GUI)
757777 set (CPACK_IFW_PACKAGE_RUN_PROGRAM "@TargetDir@/bin/NeTrainSimGUI.exe" )
@@ -1133,6 +1153,8 @@ elseif(UNIX AND NOT APPLE)
11331153 set (CPACK_IFW_PACKAGE_NAME "NeTrainSim" )
11341154 set (CPACK_IFW_PACKAGE_VERSION "${NeTrainSim_VERSION_MAJOR} .${NeTrainSim_VERSION_MINOR} .${NeTrainSim_VERSION_PATCH} " )
11351155 set (CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "NeTrainSimMaintenanceTool" )
1156+ set (CPACK_IFW_PACKAGE_ICON "${CMAKE_SOURCE_DIR } /src/resources/icon.png" )
1157+ set (CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_SOURCE_DIR } /src/resources/icon.png" )
11361158 # Linux-specific: default install to home directory
11371159 set (CPACK_IFW_PACKAGE_TARGET_DIR "@HomeDir@/NeTrainSim" )
11381160
@@ -1172,7 +1194,8 @@ Component.prototype.createOperations = function() {
11721194 'NeTrainSim.desktop',
11731195 'Version=1.0\\ nType=Application\\ nTerminal=true\\ n' +
11741196 'Exec=@TargetDir@/bin/NeTrainSim\\ n' +
1175- 'Name=NeTrainSim\\ nCategories=Education;Science;\\ n' +
1197+ 'Name=NeTrainSim\\ nIcon=@TargetDir@/data/NeTrainSim.png\\ n' +
1198+ 'Categories=Education;Science;\\ n' +
11761199 'Comment=Network Train Simulator');
11771200
11781201 // Make executables executable
@@ -1199,7 +1222,8 @@ Component.prototype.createOperations = function() {
11991222 'NeTrainSimConsole.desktop',
12001223 'Version=1.0\\ nType=Application\\ nTerminal=true\\ n' +
12011224 'Exec=@TargetDir@/bin/NeTrainSim\\ n' +
1202- 'Name=NeTrainSim Console\\ nCategories=Education;Science;\\ n' +
1225+ 'Name=NeTrainSim Console\\ nIcon=@TargetDir@/data/NeTrainSim.png\\ n' +
1226+ 'Categories=Education;Science;\\ n' +
12031227 'Comment=NeTrainSim Console Application');
12041228
12051229 component.addOperation('Execute', 'chmod', '+x',
@@ -1226,7 +1250,8 @@ Component.prototype.createOperations = function() {
12261250 'NeTrainSimGUI.desktop',
12271251 'Version=1.0\\ nType=Application\\ nTerminal=false\\ n' +
12281252 'Exec=@TargetDir@/bin/NeTrainSimGUI\\ n' +
1229- 'Name=NeTrainSim GUI\\ nCategories=Education;Science;\\ n' +
1253+ 'Name=NeTrainSim GUI\\ nIcon=@TargetDir@/data/NeTrainSim.png\\ n' +
1254+ 'Categories=Education;Science;\\ n' +
12301255 'Comment=NeTrainSim GUI Application');
12311256
12321257 component.addOperation('Execute', 'chmod', '+x',
@@ -1254,7 +1279,8 @@ Component.prototype.createOperations = function() {
12541279 'NeTrainSimServer.desktop',
12551280 'Version=1.0\\ nType=Application\\ nTerminal=true\\ n' +
12561281 'Exec=@TargetDir@/bin/NeTrainSimServer\\ n' +
1257- 'Name=NeTrainSim Server\\ nCategories=Education;Science;\\ n' +
1282+ 'Name=NeTrainSim Server\\ nIcon=@TargetDir@/data/NeTrainSim.png\\ n' +
1283+ 'Categories=Education;Science;\\ n' +
12581284 'Comment=NeTrainSim Server Application');
12591285
12601286 component.addOperation('Execute', 'chmod', '+x',
0 commit comments