All: Fix CMake install path handling some

This commit is contained in:
Jeffrey Pfau 2016-07-17 19:05:32 -07:00
parent 64b6805469
commit 613a41ce85
3 changed files with 14 additions and 12 deletions

View File

@ -56,14 +56,14 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release or Debug)" FORCE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release or Debug)" FORCE)
endif() endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
include(GNUInstallDirs) include(GNUInstallDirs)
if (NOT DEFINED LIBDIR) if (NOT DEFINED LIBDIR)
set(LIBDIR "lib") set(LIBDIR "${CMAKE_INSTALL_LIBDIR}")
endif() endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
if (NOT DEFINED MANDIR) if (NOT DEFINED MANDIR)
set(MANDIR ${CMAKE_INSTALL_MANDIR}) set(MANDIR ${CMAKE_INSTALL_MANDIR})
endif() endif()

View File

@ -165,15 +165,17 @@ if(WIN32)
list(APPEND QT_LIBRARIES qwindows imm32) list(APPEND QT_LIBRARIES qwindows imm32)
endif() endif()
endif() endif()
if(APPLE) if(NOT DEFINED DATADIR)
set(DATA_DIR Applications/${PROJECT_NAME}.app/Contents/Resources) if(APPLE)
else() set(DATADIR Applications/${PROJECT_NAME}.app/Contents/Resources)
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) else()
set(DATADIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
endif()
endif() endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATA_DIR} COMPONENT ${BINARY_NAME}-qt) install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATA_DIR} COMPONENT ${BINARY_NAME}-qt) install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
if(NOT WIN32 AND NOT APPLE) if(NOT WIN32 AND NOT APPLE)
list(APPEND QT_DEFINES DATA_DIR="${DATA_DIR}") list(APPEND QT_DEFINES DATADIR="${DATADIR}")
endif() endif()
add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_FILES} ${AUDIO_SRC} ${RESOURCES}) add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_FILES} ${AUDIO_SRC} ${RESOURCES})

View File

@ -186,8 +186,8 @@ QFileDialog* GBAApp::getSaveFileDialog(QWidget* owner, const QString& title, con
} }
QString GBAApp::dataDir() { QString GBAApp::dataDir() {
#ifdef DATA_DIR #ifdef DATADIR
QString path = QString::fromUtf8(DATA_DIR); QString path = QString::fromUtf8(DATADIR);
#else #else
QString path = QCoreApplication::applicationDirPath(); QString path = QCoreApplication::applicationDirPath();
#ifdef Q_OS_MAC #ifdef Q_OS_MAC