From 783475bf39af6baf5ae512c3b6b3452b670a729f Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Wed, 24 May 2017 04:25:45 -0700 Subject: [PATCH] switch to cmake module GNUInstallDirs #116 See: https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs Use these variables to set all installation paths. Add link and note about module to README.md . --- CMakeLists.txt | 42 +++++++++++------------------------------- README.md | 7 ++++--- src/wx/CMakeLists.txt | 2 +- 3 files changed, 16 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2abc5fe..f4f78204 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,31 +207,11 @@ ELSE( ENABLE_LIRC ) SET( WITHLIRC 0 ) ENDIF( ENABLE_LIRC ) -# Set the default binary dir -IF( NOT BIN_INSTALL_DIR ) - SET( BIN_INSTALL_DIR "bin" ) -ENDIF( NOT BIN_INSTALL_DIR ) - -# Set the default install dir -IF( NOT DATA_INSTALL_DIR ) - SET( DATA_INSTALL_DIR "share/vbam" ) -ENDIF( NOT DATA_INSTALL_DIR ) - -SET( PKGDATADIR ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR} ) - -#Set the default manual dir -IF( NOT MAN_INSTALL_DIR ) - SET( MAN_INSTALL_DIR "share/man" ) -ENDIF( NOT MAN_INSTALL_DIR ) - -# Set the configuration file location -IF( NOT SYSCONF_INSTALL_DIR ) - SET( SYSCONF_INSTALL_DIR "/etc" ) -ENDIF( NOT SYSCONF_INSTALL_DIR ) +INCLUDE(GNUInstallDirs) # C defines -ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR=\\\""${SYSCONF_INSTALL_DIR}"\\\" -DWITH_LIRC=${WITHLIRC}) -ADD_DEFINITIONS (-DVERSION=\\\""${VERSION}"\\\" -DPKGDATADIR=\\\""${PKGDATADIR}"\\\" -DPACKAGE=) +ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR=\\\""${CMAKE_INSTALL_FULL_SYSCONFDIR}"\\\" -DWITH_LIRC=${WITHLIRC}) +ADD_DEFINITIONS (-DVERSION=\\\""${VERSION}"\\\" -DPKGDATADIR=\\\""${CMAKE_INSTALL_FULL_DATADIR}/vbam"\\\" -DPACKAGE=) if( ENABLE_LINK ) # IPC linking code needs sem_timedwait which can be either in librt or pthreads @@ -728,22 +708,22 @@ IF( ENABLE_SDL ) ${WIN32_LIBRARIES} ${LIRC_CLIENT_LIBRARY} ) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION ${BIN_INSTALL_DIR}) + INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) IF( WIN32 ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example - DESTINATION ${CMAKE_INSTALL_PREFIX}/${SYSCONF_INSTALL_DIR} + DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR} RENAME vbam.cfg) ELSE( WIN32 ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example - DESTINATION ${SYSCONF_INSTALL_DIR} + DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR} RENAME vbam.cfg) ENDIF( WIN32 ) ENDIF( ENABLE_SDL ) IF( ENABLE_WX ) add_subdirectory(src/wx) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${BIN_INSTALL_DIR}) + INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) ENDIF( ENABLE_WX ) if( ENABLE_WX ) @@ -752,15 +732,15 @@ if( ENABLE_WX ) add_subdirectory(po) endif( ENABLE_NLS ) endif( ENABLE_WX ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${DATA_INSTALL_DIR}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/vbam) # manual pages IF( UNIX ) IF( ENABLE_SDL ) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/vbam.6 DESTINATION ${MAN_INSTALL_DIR}/man6) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/vbam.6 DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man6) ENDIF( ENABLE_SDL ) IF( ENABLE_WX ) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/visualboyadvance-m.6 DESTINATION ${MAN_INSTALL_DIR}/man6) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/debian/visualboyadvance-m.6 DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man6) ENDIF( ENABLE_WX ) ENDIF( UNIX ) @@ -769,7 +749,7 @@ IF( NOT WIN32 AND NOT APPLE ) IF( ENABLE_WX ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/wxvbam.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/wxvbam.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/appdata) - INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/icons/sizes/ DESTINATION share/icons/hicolor) + INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/wx/icons/sizes/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor) ENDIF( ENABLE_WX ) ENDIF( NOT WIN32 AND NOT APPLE ) diff --git a/README.md b/README.md index 7db99576..ff752a4c 100644 --- a/README.md +++ b/README.md @@ -122,9 +122,10 @@ Here is the complete list: | ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON | | ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON | | ENABLE_OPENAL | Enable OpenAL for the wxWidgets port | ON | -| BIN_INSTALL_DIR | Configure the default binary directory | bin | -| DATA_INSTALL_DIR | Configure the default data directory | share/vbam | -| MAN_INSTALL_DIR | Configure the default manual directory | share/man | + +Note for distro packagers, we use the CMake module +[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs) +to configure installation directories. ## MSys2 Notes diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index efd012ae..e56e5218 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -421,7 +421,7 @@ IF(WIN32) INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/visualboyadvance-m${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${CMAKE_BINARY_DIR}) ENDIF(WIN32) IF(NOT WIN32 AND NOT APPLE) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wxvbam.desktop DESTINATION share/applications) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wxvbam.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) ENDIF(NOT WIN32 AND NOT APPLE) if(APPLE)