oracle's CMakeLists.txt: major overhaul
* Remove cockatrice_HEADERS (obsoleted by automoc) * Remove compilation flags definition and Qt4 finding calls * Make use of CMAKE_INSTALL_PREFIX * use INSTALL(TARGETS) in place of INSTALL(PROGRAM) * Osx: create a proper application bundle * Added comments
This commit is contained in:
parent
0dd6567583
commit
0f02c6b0a2
1 changed files with 54 additions and 19 deletions
|
@ -1,38 +1,73 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
# CMakeLists for oracle directory
|
||||
#
|
||||
# provides the oracle binary
|
||||
|
||||
PROJECT(oracle)
|
||||
|
||||
# paths
|
||||
set(DESKTOPDIR share/applications CACHE STRING "path to .desktop files")
|
||||
|
||||
SET(oracle_SOURCES src/main.cpp src/oracleimporter.cpp src/window_main.cpp ../cockatrice/src/carddatabase.cpp ../cockatrice/src/settingscache.cpp)
|
||||
SET(oracle_HEADERS src/oracleimporter.h src/window_main.h ../cockatrice/src/carddatabase.h ../cockatrice/src/settingscache.h)
|
||||
SET(oracle_SOURCES
|
||||
src/main.cpp
|
||||
src/oracleimporter.cpp
|
||||
src/window_main.cpp
|
||||
../cockatrice/src/carddatabase.cpp
|
||||
../cockatrice/src/settingscache.cpp
|
||||
)
|
||||
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTXML TRUE)
|
||||
SET(QT_USE_QTSVG TRUE)
|
||||
FIND_PACKAGE(Qt4 REQUIRED)
|
||||
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
IF (CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-s -O2")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0")
|
||||
ELSE (CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
ENDIF (CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
QT4_WRAP_CPP(oracle_HEADERS_MOC ${oracle_HEADERS})
|
||||
# Include directories
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INCLUDE_DIRECTORIES(../cockatrice/src)
|
||||
|
||||
ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_HEADERS_MOC})
|
||||
# Build oracle binary and link it
|
||||
ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_MOC_SRCS})
|
||||
TARGET_LINK_LIBRARIES(oracle ${QT_LIBRARIES})
|
||||
|
||||
IF (NOT APPLE)
|
||||
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oracle DESTINATION bin)
|
||||
ELSE (APPLE)
|
||||
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oracle.app DESTINATION bin)
|
||||
ENDIF (NOT APPLE)
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
INSTALL(TARGETS oracle BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
else()
|
||||
# Assume linux
|
||||
INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
||||
IF (NOT WIN32 AND NOT APPLE)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR})
|
||||
ENDIF (NOT WIN32 AND NOT APPLE)
|
||||
|
||||
if(APPLE)
|
||||
set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources)
|
||||
|
||||
# note: no codecs in qt5
|
||||
# note: phonon_backend => mediaservice
|
||||
# note: needs platform on osx
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib")
|
||||
else()
|
||||
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
||||
FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib")
|
||||
endif()
|
||||
|
||||
install(CODE "
|
||||
file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
Plugins = Plugins\")
|
||||
" COMPONENT Runtime)
|
||||
|
||||
install(CODE "
|
||||
file(GLOB_RECURSE QTPLUGINS
|
||||
\"${plugin_dest_dir}/*.dylib\")
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\")
|
||||
" COMPONENT Runtime)
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue