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)
endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
include(GNUInstallDirs)
if (NOT DEFINED LIBDIR)
set(LIBDIR "lib")
set(LIBDIR "${CMAKE_INSTALL_LIBDIR}")
endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
if (NOT DEFINED MANDIR)
set(MANDIR ${CMAKE_INSTALL_MANDIR})
endif()

View File

@ -165,15 +165,17 @@ if(WIN32)
list(APPEND QT_LIBRARIES qwindows imm32)
endif()
endif()
if(NOT DEFINED DATADIR)
if(APPLE)
set(DATA_DIR Applications/${PROJECT_NAME}.app/Contents/Resources)
set(DATADIR Applications/${PROJECT_NAME}.app/Contents/Resources)
else()
set(DATA_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
set(DATADIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATA_DIR} COMPONENT ${BINARY_NAME}-qt)
install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATA_DIR} COMPONENT ${BINARY_NAME}-qt)
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
if(NOT WIN32 AND NOT APPLE)
list(APPEND QT_DEFINES DATA_DIR="${DATA_DIR}")
list(APPEND QT_DEFINES DATADIR="${DATADIR}")
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})

View File

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