initial commit
This commit is contained in:
110
CMakeModules/Findliblbfgs.cmake
Normal file
110
CMakeModules/Findliblbfgs.cmake
Normal file
@ -0,0 +1,110 @@
|
||||
#
|
||||
# Try to find the Liblbfgs library and include path.
|
||||
# Once done this will define
|
||||
#
|
||||
# LIBLBFGS_FOUND
|
||||
# LIBLBFGS_INCLUDE_PATH
|
||||
# LIBLBFGS_LIBRARY
|
||||
|
||||
if(MAKE_RPM)
|
||||
|
||||
FIND_PATH( LIBLBFGS_INCLUDE_PATH lbfgs.h
|
||||
PATHS ${MANUAL_LBFGS}/include
|
||||
DOC "The directory where lbfgs.h resides"
|
||||
|
||||
[NO_DEFAULT_PATH]
|
||||
[NO_CMAKE_ENVIRONMENT_PATH]
|
||||
[NO_CMAKE_PATH]
|
||||
[NO_SYSTEM_ENVIRONMENT_PATH]
|
||||
[NO_CMAKE_SYSTEM_PATH])
|
||||
|
||||
FIND_LIBRARY( LIBLBFGS_LIBRARY
|
||||
NAMES liblbfgs lbfgs
|
||||
PATHS ${MANUAL_LBFGS}/lib/.libs
|
||||
${MANUAL_LBFGS}/lib
|
||||
DOC "The Lbfgs library"
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH)
|
||||
|
||||
else(MAKE_RPM)
|
||||
FIND_PATH( LIBLBFGS_INCLUDE_PATH lbfgs.h
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/include/lbfgs
|
||||
/usr/local/include
|
||||
/usr/local/include/lbfgs
|
||||
/sw/include
|
||||
/sw/include/lbfgs
|
||||
/opt/local/include
|
||||
/opt/local/include/lbfgs
|
||||
DOC "The directory where lbfgs.h resides")
|
||||
|
||||
FIND_LIBRARY( LIBLBFGS_LIBRARY
|
||||
NAMES liblbfgs lbfgs
|
||||
PATHS
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
/usr/local/lib64
|
||||
/usr/local/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
DOC "The Lbfgs library")
|
||||
endif(MAKE_RPM)
|
||||
|
||||
if(WIN32)
|
||||
FIND_LIBRARY( LIBLBFGS_LIBRARY_DLL
|
||||
NAMES liblbfgs-1-10.dll
|
||||
PATHS
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
/usr/local/lib64
|
||||
/usr/local/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
DOC "The Lbfgs library")
|
||||
|
||||
IF (LIBLBFGS_INCLUDE_PATH AND LIBLBFGS_LIBRARY AND LIBLBFGS_LIBRARY_DLL)
|
||||
SET( LIBLBFGS_FOUND TRUE CACHE BOOL "Set to TRUE if liblbfgs is found, FALSE otherwise")
|
||||
ENDIF (LIBLBFGS_INCLUDE_PATH AND LIBLBFGS_LIBRARY AND LIBLBFGS_LIBRARY_DLL)
|
||||
MARK_AS_ADVANCED(
|
||||
LIBLBFGS_FOUND
|
||||
LIBLBFGS_LIBRARY
|
||||
LIBLBFGS_LIBRARY_DLL
|
||||
LIBLBFGS_INCLUDE_PATH)
|
||||
else()
|
||||
|
||||
IF (LIBLBFGS_INCLUDE_PATH AND LIBLBFGS_LIBRARY)
|
||||
SET( LIBLBFGS_FOUND TRUE CACHE BOOL "Set to TRUE if liblbfgs is found, FALSE otherwise")
|
||||
ENDIF (LIBLBFGS_INCLUDE_PATH AND LIBLBFGS_LIBRARY)
|
||||
MARK_AS_ADVANCED(
|
||||
LIBLBFGS_FOUND
|
||||
LIBLBFGS_LIBRARY
|
||||
LIBLBFGS_INCLUDE_PATH)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT LIBLBFGS_FOUND)
|
||||
message(WARNING "LIBLBFGS not found")
|
||||
elseif(UNIX)
|
||||
set ( MY_LIBS
|
||||
${MY_LIBS}
|
||||
${LIBLBFGS_LIBRARY}
|
||||
)
|
||||
|
||||
if (NOT ${LIBLBFGS_INCLUDE_PATH} STREQUAL "/usr/include/lbfgs")
|
||||
include_directories (
|
||||
"${LIBLBFGS_INCLUDE_PATH}/../"
|
||||
"${LIBLBFGS_INCLUDE_PATH}")
|
||||
endif()
|
||||
else()
|
||||
include_directories (
|
||||
"${LIBLBFGS_INCLUDE_PATH}"
|
||||
)
|
||||
set ( MY_LIBS
|
||||
${MY_LIBS}
|
||||
${LIBLBFGS_LIBRARY_DLL}
|
||||
)
|
||||
endif(UNIX AND NOT LIBLBFGS_FOUND)
|
||||
|
18
CMakeModules/Findmisc.cmake
Normal file
18
CMakeModules/Findmisc.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
cmake_minimum_required (VERSION 2.8.1)
|
||||
|
||||
|
||||
|
||||
set (PACKAGE_NAME "misc")
|
||||
|
||||
set (ADD_DIRECTORY "module_${PACKAGE_NAME}")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../CMakeModules/NewIfNotExists.cmake)
|
||||
|
||||
|
||||
include_directories (
|
||||
${CMAKE_CURRENT_LIST_DIR}/../${ADD_DIRECTORY}
|
||||
)
|
||||
|
||||
set ( MY_LIBS
|
||||
${MY_LIBS}
|
||||
${PACKAGE_NAME}
|
||||
)
|
17
CMakeModules/Findversioning.cmake
Normal file
17
CMakeModules/Findversioning.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
cmake_minimum_required (VERSION 2.8.1)
|
||||
|
||||
set (PACKAGE_NAME "versioning")
|
||||
|
||||
set (ADD_DIRECTORY "module_${PACKAGE_NAME}")
|
||||
|
||||
set (QT_USE_QTMAIN TRUE)
|
||||
set (QT_USE_SVG TRUE)
|
||||
set (QT_USE_NETWORK TRUE)
|
||||
set (QT_MORE_COMPONENTS ${QT_MORE_COMPONENTS} QtSvg QtNetwork)
|
||||
include ( ${CMAKE_CURRENT_LIST_DIR}/../CMakeModules/qt5.cmake )
|
||||
find_package(Qt5Network)
|
||||
find_package(Qt5Xml)
|
||||
|
||||
include_directories (
|
||||
${CMAKE_CURRENT_LIST_DIR}/../${ADD_DIRECTORY}
|
||||
)
|
35
CMakeModules/NewIfNotExists.cmake
Normal file
35
CMakeModules/NewIfNotExists.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
# will include modules/thirdparty if needed for out of source building
|
||||
# make sure PROJECTNAME and PACKAGE_NAME are set properly
|
||||
|
||||
set(BUILDFILE "${CMAKE_BINARY_DIR}/built/${PACKAGE_NAME}")
|
||||
|
||||
# has it been built yet ?
|
||||
if(NOT EXISTS "${BUILDFILE}")
|
||||
set(FROMDIR ${CMAKE_CURRENT_LIST_DIR}/../${ADD_DIRECTORY})
|
||||
set(TODIR ${CMAKE_BINARY_DIR}/${SUBDIR_STANDALONE}/${ADD_DIRECTORY})
|
||||
|
||||
# projectname must not equal package name,
|
||||
# this happens if projectname finds itself, for instance
|
||||
if(NOT ${PROJECTNAME} STREQUAL ${PACKAGE_NAME} AND NOT EXISTS "${BUILDFILE}")
|
||||
add_subdirectory (${FROMDIR} ${TODIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# # add as target, if it does not exist already
|
||||
# # this makes it possible to separately
|
||||
# # compile different programs
|
||||
|
||||
# set(DEST_DIR_TMP "${CMAKE_BINARY_DIR}/${ADD_DIRECTORY}")
|
||||
# if (NOT ${PROJECTNAME} STREQUAL ${PACKAGE_NAME})
|
||||
# if (NOT TARGET ${PACKAGE_NAME})
|
||||
# If(NOT IS_DIRECTORY ${DEST_DIR_TMP})
|
||||
# set(TRGTDIR "${CMAKE_BINARY_DIR}/${ADD_DIRECTORY}")
|
||||
# add_subdirectory (
|
||||
# "${CMAKE_CURRENT_LIST_DIR}/../${ADD_DIRECTORY}"
|
||||
# ${TRGTDIR}
|
||||
# )
|
||||
# set (LINK_DIRECTORIES ${TRGTDIR} ${LINK_DIRECTORIES})
|
||||
# endif()
|
||||
# endif()
|
||||
# endif()
|
||||
|
1
CMakeModules/PATCH_NO
Normal file
1
CMakeModules/PATCH_NO
Normal file
@ -0,0 +1 @@
|
||||
601
|
59
CMakeModules/addtranslation.cmake
Normal file
59
CMakeModules/addtranslation.cmake
Normal file
@ -0,0 +1,59 @@
|
||||
#### translation stuff #####
|
||||
# http://www.cmake.org/cmake/help/v2.8.9/cmake.html
|
||||
#######
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
|
||||
SET(${PROJECTNAME}_TRANSPREFIX
|
||||
trans_${PROJECTNAME}_de
|
||||
)
|
||||
|
||||
SET(${PROJECTNAME}_TRANSLATIONS
|
||||
${${PROJECTNAME}_TRANSPREFIX}.ts
|
||||
)
|
||||
|
||||
SET(${PROJECTNAME}_TRANSLATIONS_COMPILED
|
||||
${${PROJECTNAME}_TRANSPREFIX}.qm
|
||||
)
|
||||
|
||||
QT5_CREATE_TRANSLATION (${PROJECTNAME}_TRANSLATION_FILES
|
||||
${${PROJECTNAME}_FORMS}
|
||||
${${PROJECTNAME}_HEADERS}
|
||||
${${PROJECTNAME}_SOURCES}
|
||||
${${PROJECTNAME}_RESSOURCES}
|
||||
${${PROJECTNAME}_TRANSLATIONS}
|
||||
)
|
||||
|
||||
SET(AddQtRessourceFiles
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${${PROJECTNAME}_TRANSLATIONS_COMPILED}"
|
||||
${AddQtRessourceFiles}
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${${PROJECTNAME}_TRANSLATIONS}")
|
||||
# do not install since normally it's included in the exe file
|
||||
# if(UNIX)
|
||||
# install(FILES ${TS_FILES} ${QM_FILES}
|
||||
# DESTINATION "${CMAKE_INSTALL_PREFIX}/${PROJECTNAME}/translations"
|
||||
# COMPONENT main
|
||||
# )
|
||||
# # qm is created by make, so cmake won't find it
|
||||
# # directly install it
|
||||
# install(FILES
|
||||
# "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECTNAME}_TRANSLATIONS_COMPILED}"
|
||||
# DESTINATION "${CMAKE_INSTALL_PREFIX}/${PROJECTNAME}/translations"
|
||||
# COMPONENT main
|
||||
# )
|
||||
# else()
|
||||
# install(FILES ${TS_FILES} ${QM_FILES}
|
||||
# DESTINATION translations
|
||||
# COMPONENT main
|
||||
# )
|
||||
# # qm is created by make, so cmake won't find it
|
||||
# # directly install it
|
||||
# install(FILES
|
||||
# "${CMAKE_CURRENT_BINARY_DIR}/${${PROJECTNAME}_TRANSLATIONS_COMPILED}"
|
||||
# DESTINATION translations
|
||||
# COMPONENT main
|
||||
# )
|
||||
# endif()
|
72
CMakeModules/buildPackage.cmake
Normal file
72
CMakeModules/buildPackage.cmake
Normal file
@ -0,0 +1,72 @@
|
||||
### tell cpack which components ###
|
||||
if ( DEFINED USE_COMPONENTS )
|
||||
message ("For installation only use specified components: ${USE_COMPONENTS}")
|
||||
set(CPACK_COMPONENTS_ALL ${USE_COMPONENTS})
|
||||
else()
|
||||
set(CPACK_COMPONENTS_ALL main header lib data ${CPACK_COMPONENTS_ALL})
|
||||
endif()
|
||||
|
||||
### set display names for single components ###
|
||||
if( DEFINED MAIN_DISPLAY_NAME )
|
||||
set(CPACK_COMPONENT_MAIN_DISPLAY_NAME ${MAIN_DISPLAY_NAME})
|
||||
else()
|
||||
set(CPACK_COMPONENT_MAIN_DISPLAY_NAME "Main Application")
|
||||
endif()
|
||||
|
||||
set(CPACK_COMPONENT_LIB_DISPLAY_NAME "Development Libraries")
|
||||
set(CPACK_COMPONENT_HEADER_DISPLAY_NAME "Development Headers")
|
||||
set(CPACK_COMPONENT_DATA_DISPLAY_NAME "Sample Data / Additional Data")
|
||||
|
||||
## define installation groups for components ###
|
||||
# set(CPACK_COMPONENT_MAIN_GROUP "MainGroup")
|
||||
# set(CPACK_COMPONENT_BINARIES_GROUP "MainGroup")
|
||||
# set(CPACK_COMPONENT_DATA_GROUP "DataGroup")
|
||||
# set(CPACK_COMPONENT_LIB_GROUP "DevelopmentGroup")
|
||||
# set(CPACK_COMPONENT_HEADER_GROUP "DevelopmentGroup")
|
||||
|
||||
## provide installation groups display names ###
|
||||
# set(CPACK_COMPONENT_GROUP_MAINGROUP_DISPLAY_NAME "Application Binaries")
|
||||
# set(CPACK_COMPONENT_GROUP_DATAGROUP_DISPLAY_NAME "Extra Data")
|
||||
# set(CPACK_COMPONENT_GROUP_DEVELOPMENTGROUP_DISPLAY_NAME "Development Files")
|
||||
|
||||
### set executable - symbol pairs ###
|
||||
set(CPACK_PACKAGE_EXECUTABLES
|
||||
"${PROJECTNAME}" "${CPACK_COMPONENT_MAIN_DISPLAY_NAME}")
|
||||
|
||||
#include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_PROJECTNAME "${CPACK_COMPONENT_MAIN_DISPLAY_NAME}")
|
||||
set(CPACK_PACKAGE_NAME "${CPACK_COMPONENT_MAIN_DISPLAY_NAME}")
|
||||
set(CPACK_PACKAGE_VENDOR "Dominik Rue<75>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_COMPONENT_MAIN_DISPLAY_NAME} - Installation Program")
|
||||
if ( NOT DEFINED VERSION_MAJOR )
|
||||
SET(VERSION_MAJOR 0)
|
||||
endif()
|
||||
if ( NOT DEFINED VERSION_MINOR )
|
||||
SET(VERSION_MINOR 1)
|
||||
endif()
|
||||
if ( NOT DEFINED VERSION_PATCH )
|
||||
SET(VERSION_PATCH 1)
|
||||
endif()
|
||||
set(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECTNAME}")
|
||||
|
||||
if (WIN32)
|
||||
IF(CMAKE_CL_64)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "X86")
|
||||
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
|
||||
#SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} (Win64)")
|
||||
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
|
||||
ELSE()
|
||||
SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
||||
#SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
||||
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
|
||||
ENDIF()
|
||||
endif(WIN32)
|
||||
|
||||
# and finally
|
||||
include(CPack)
|
79
CMakeModules/installDesktop.cmake
Normal file
79
CMakeModules/installDesktop.cmake
Normal file
@ -0,0 +1,79 @@
|
||||
## this macro will look for the local applications path
|
||||
## and write a .desktop file
|
||||
|
||||
macro (INSTALL_DESKTOP_LOCAL execflags comment importerpath iconsubpath iconsize additionalText)
|
||||
if (UNIX)
|
||||
set(ICON_INSTALL "/usr/share/icons/hicolor/")
|
||||
|
||||
set(dir "$ENV{HOME}/.local/share/applications/")
|
||||
IF(EXISTS ${dir})
|
||||
set(DESKTOP_FILENAME "${dir}${PROJECTNAME}.desktop")
|
||||
set(DESKTOP_FILENAME_BUILD "${CMAKE_CURRENT_BINARY_DIR}/${PROJECTNAME}.desktop")
|
||||
#NOTE: copying desktop file to ${DESKTOP_FILENAME} . \nThis will ensure"
|
||||
# a nice icon and possibly offer \"${PROJECTNAME}\" to the user"
|
||||
# on certain file or device events\n Even without make install." (GNOME)
|
||||
|
||||
execute_process(
|
||||
COMMAND whoami
|
||||
OUTPUT_VARIABLE user OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (NOT ${user} STREQUAL "root" )
|
||||
file(WRITE ${DESKTOP_FILENAME}
|
||||
"[Desktop Entry]\n"
|
||||
"Version=1.0\n"
|
||||
"Name=${PROJECTNAME}\n"
|
||||
"Comment=${comment}\n"
|
||||
"Exec=${CMAKE_CURRENT_BINARY_DIR}/${PROJECTNAME}${execflags}\n"
|
||||
"Icon=${CMAKE_CURRENT_SOURCE_DIR}/${iconsubpath}/${PROJECTNAME}.png\n"
|
||||
${additionalText})
|
||||
endif()
|
||||
|
||||
file(WRITE ${DESKTOP_FILENAME_BUILD}
|
||||
"[Desktop Entry]\n"
|
||||
"Version=1.0\n"
|
||||
"Name=${PROJECTNAME}\n"
|
||||
"Comment=${comment}\n"
|
||||
"Exec=${PROJECTNAME}\n"
|
||||
"Icon=${ICON_INSTALL}128x128/apps/${PROJECTNAME}.png\n"
|
||||
${additionalText})
|
||||
|
||||
set(DESKTOP_DIR "/usr/share/applications/")
|
||||
if(EXISTS ${DESKTOP_DIR})
|
||||
INSTALL(FILES
|
||||
${DESKTOP_FILENAME_BUILD}
|
||||
DESTINATION ${DESKTOP_DIR}
|
||||
RENAME ${PROJECTNAME}.desktop
|
||||
COMPONENT main
|
||||
)
|
||||
else()
|
||||
message("Warning: not installing desktop file, ${DESKTOP_DIR} not found or changed ?")
|
||||
endif()
|
||||
|
||||
if(EXISTS ${ICON_INSTALL})
|
||||
#GET_FILENAME_COMPONENT(iconSuffix ${CMAKE_CURRENT_SOURCE_DIR}/${iconsubpath} EXT)
|
||||
FOREACH (size ${iconsize})
|
||||
set(ICON_INSTALL "/usr/share/icons/hicolor/${size}/apps/")
|
||||
INSTALL(FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${iconsubpath}/${PROJECTNAME}${size}.png"
|
||||
|
||||
DESTINATION ${ICON_INSTALL}
|
||||
RENAME "${PROJECTNAME}.png"
|
||||
COMPONENT main
|
||||
)
|
||||
ENDFOREACH(size)
|
||||
else()
|
||||
message("Warning: not installing icon for unix, dir ${ICON_INSTALL} not found or changed?")
|
||||
endif()
|
||||
|
||||
set(KDE_ACTIONS "/usr/share/kde4/apps/solid/actions/")
|
||||
if(EXISTS ${KDE_ACTIONS} AND NOT ${importerpath} STREQUAL "")
|
||||
INSTALL(FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${importerpath}
|
||||
DESTINATION ${KDE_ACTIONS}
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message("applications path not found")
|
||||
endif()
|
||||
endif(UNIX)
|
||||
endmacro (INSTALL_DESKTOP_LOCAL)
|
147
CMakeModules/installQt5.cmake
Normal file
147
CMakeModules/installQt5.cmake
Normal file
@ -0,0 +1,147 @@
|
||||
set (QT_VERSION_MAJOR 5)
|
||||
|
||||
IF(WIN32)
|
||||
if(QT_USE_SVG)
|
||||
get_target_property(QtSvg_location Qt5::Svg LOCATION_Release)
|
||||
#find_file(qsvgicon qsvgicon${QT_VERSION_MAJOR}.dll PATHS ${QT_PLUGINS_DIR}/iconengines NO_DEFAULT_PATH)
|
||||
#find_file(qsvg qsvg${QT_VERSION_MAJOR}.dll PATHS ${QT_PLUGINS_DIR}/iconengines NO_DEFAULT_PATH)
|
||||
#install(FILES ${qsvgicon}
|
||||
# DESTINATION bin/iconengines
|
||||
# COMPONENT main
|
||||
# )
|
||||
INSTALL(FILES
|
||||
"${QtSvg_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
get_target_property(_loc Qt5::QWindowsIntegrationPlugin LOCATION)
|
||||
get_filename_component(_loc_iconengine ${_loc} PATH)
|
||||
get_filename_component(_loc_iconengine "${_loc_iconengine}/../iconengines/" ABSOLUTE)
|
||||
|
||||
file(GLOB PLUGINS_ICONENGINE "${_loc_iconengine}/*[^d].dll")
|
||||
INSTALL(FILES
|
||||
${PLUGINS_ICONENGINE}
|
||||
DESTINATION bin/iconengines
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
get_target_property(_loc Qt5::QWindowsIntegrationPlugin LOCATION)
|
||||
get_filename_component(_loc_platform ${_loc} PATH)
|
||||
file(GLOB PLUGINS_PLATFORM "${_loc_platform}/*[^d].dll")
|
||||
INSTALL(FILES
|
||||
${PLUGINS_PLATFORM}
|
||||
DESTINATION bin/platforms
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
get_target_property(_loc_gif Qt5::QGifPlugin LOCATION)
|
||||
#message(${_loc_gif})
|
||||
get_filename_component(_loc_image_plugins ${_loc_gif} PATH)
|
||||
file(GLOB PLUGINS_IMAGE "${_loc_image_plugins}/*[^d].dll")
|
||||
INSTALL(FILES
|
||||
${PLUGINS_IMAGE}
|
||||
DESTINATION bin/imageformats
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
|
||||
if (QT_USE_NETWORK)
|
||||
get_target_property(QtNetwork_location Qt5::Network LOCATION_Release)
|
||||
INSTALL(FILES
|
||||
"${QtNetwork_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
if (QT_USE_XML)
|
||||
get_target_property(QtXml_location Qt5::Xml LOCATION_Release)
|
||||
INSTALL(FILES
|
||||
"${QtXml_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
if (QT_USE_MULTIMEDIA)
|
||||
get_target_property(QtMultimedia_location Qt5::Multimedia LOCATION_Release)
|
||||
INSTALL(FILES
|
||||
"${QtMultimedia_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
if (QT_USE_MULTIMEDIA_WIDGETS)
|
||||
get_target_property(QtMultimediaWidgets_location Qt5::MultimediaWidgets LOCATION_Release)
|
||||
INSTALL(FILES
|
||||
"${QtMultimediaWidgets_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
if (QT_USE_SQL)
|
||||
get_target_property(QtSql_location Qt5::Sql LOCATION_Release)
|
||||
INSTALL(FILES
|
||||
"${QtSql_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
# base files always
|
||||
get_target_property(QtCore_location Qt5::Core LOCATION_Release)
|
||||
get_target_property(QtWidgets_location Qt5::Widgets LOCATION_Release)
|
||||
get_target_property(QtGui_location Qt5::Gui LOCATION_Release)
|
||||
# find_package(Qt5OpenGL REQUIRED)
|
||||
#GET_TARGET_PROPERTY(QtOpenGL_location Qt5::OpenGL LOCATION_Release)
|
||||
INSTALL(FILES
|
||||
"${QtCore_location}"
|
||||
"${QtWidgets_location}"
|
||||
"${QtGui_location}"
|
||||
#"${QtOpenGL_location}"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
# include required DLLs, based on the assumption that these
|
||||
# are within the Qt5 bin dir. This is the case if you download
|
||||
# the precompiled minGW version of Qt5 (tested with 5.2)
|
||||
get_filename_component(QT5LOC ${QtCore_location} PATH)
|
||||
|
||||
file(GLOB DLL_FILES1 "${QT5LOC}/libgcc_s_dw*.dll")
|
||||
INSTALL(FILES ${DLL_FILES1}
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
|
||||
file(GLOB DLL_FILES2 "${QT5LOC}/libstdc++*.dll")
|
||||
INSTALL(FILES ${DLL_FILES2}
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
file(GLOB DLL_FILES3 "${QT5LOC}/libwinpthread*.dll")
|
||||
INSTALL(FILES ${DLL_FILES3}
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
file(GLOB DLL_FILES4 "${QT5LOC}/icu*.dll")
|
||||
INSTALL(FILES ${DLL_FILES4}
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
|
||||
if (${ARCH_DIR} STREQUAL "win32")
|
||||
INSTALL(FILES "${QT5LOC}/libEGL.dll" "${QT5LOC}/libGLESv2.dll"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
ENDIF(WIN32)
|
79
CMakeModules/onTheFlyResourceFile.cmake
Normal file
79
CMakeModules/onTheFlyResourceFile.cmake
Normal file
@ -0,0 +1,79 @@
|
||||
# Copyright (c) 2006-2011 Peter Kümmel, <syntheti...@gmx.net>
|
||||
# 2012, Kornel Benko, <kor...@lyx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# To call this script, one has to proved following parameters
|
||||
# RESOURCE_NAME # full path of the resulting resource-file
|
||||
# MAPPED_DIR # Path-prefix to be removed from the file names
|
||||
|
||||
find_package (Qt5LinguistTools REQUIRED)
|
||||
get_target_property(_qmake Qt5::qmake LOCATION)
|
||||
execute_process( COMMAND ${_qmake} -query QT_INSTALL_TRANSLATIONS OUTPUT_VARIABLE QT_TRANSLATIONS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
set(resource_name ${RESOURCE_NAME})
|
||||
|
||||
message(STATUS "Generating ${resource_name}")
|
||||
|
||||
file(WRITE ${resource_name} "<!DOCTYPE RCC><RCC version=\"1.0\">\n")
|
||||
file(APPEND ${resource_name} "<qresource>\n")
|
||||
|
||||
foreach (_current_FILE ${AddQtRessourceFiles})
|
||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
string(REGEX REPLACE "${MAPPED_DIR}" "" _file_name ${_abs_FILE})
|
||||
file(APPEND ${resource_name} " <file alias=\"${_file_name}\">${_abs_FILE}</file>\n")
|
||||
endforeach (_current_FILE)
|
||||
|
||||
# add QT translation file, if available
|
||||
message("Translations dir: ${QT_TRANSLATIONS_DIR}")
|
||||
find_file(QT_GERMAN qt_de.qm "${QT_TRANSLATIONS_DIR}")
|
||||
if (QT_GERMAN)
|
||||
file(APPEND ${resource_name} " <file alias=\"/qt_de.qm\">${QT_TRANSLATIONS_DIR}/qt_de.qm</file>\n")
|
||||
endif()
|
||||
find_file(QT_BASE qtbase_de.qm "${QT_TRANSLATIONS_DIR}")
|
||||
if (QT_BASE)
|
||||
file(APPEND ${resource_name} " <file alias=\"/qtbase_de.qm\">${QT_TRANSLATIONS_DIR}/qtbase_de.qm</file>\n")
|
||||
endif()
|
||||
find_file(QT_GERMAN_HELP qt_help_de.qm "${QT_TRANSLATIONS_DIR}")
|
||||
if (QT_GERMAN_HELP)
|
||||
file(APPEND ${resource_name} " <file alias=\"/qt_help_de.qm\">${QT_TRANSLATIONS_DIR}/qt_help_de.qm</file>\n")
|
||||
endif()
|
||||
find_file(QT_GERMAN_BASE qtbase_de.qm "${QT_TRANSLATIONS_DIR}")
|
||||
if(QT_GERMAN_BASE)
|
||||
file(APPEND ${resource_name} " <file alias=\"/qtbase_de.qm\">${QT_TRANSLATIONS_DIR}/qtbase_de.qm</file>\n")
|
||||
endif()
|
||||
|
||||
# finish ressource file
|
||||
file(APPEND ${resource_name} "</qresource>\n")
|
||||
file(APPEND ${resource_name} "</RCC>\n")
|
||||
|
||||
add_custom_target(Ressoures.qrc DEPENDS ${resource_name})
|
||||
qt5_add_resources(${PROJECTNAME}_RESOURCES_RCC ${resource_name})
|
||||
|
||||
# add qt translation, as well
|
||||
#/usr/share/qt4/translations/qt_de.qm
|
||||
|
||||
#QT4_ADD_RESOURCES (${PROJECTNAME}_RESOURCES_TRANSLATIONS_RCC "${resource_name}.qrc")
|
9
CMakeModules/qt5.cmake
Normal file
9
CMakeModules/qt5.cmake
Normal file
@ -0,0 +1,9 @@
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
# As moc files are generated in the binary dir, tell CMake
|
||||
# to always look for includes there:
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# Instruct CMake to run moc automatically when needed.
|
||||
set(CMAKE_AUTOMOC ON)
|
166
CMakeModules/settings.cmake
Normal file
166
CMakeModules/settings.cmake
Normal file
@ -0,0 +1,166 @@
|
||||
cmake_minimum_required (VERSION 2.8.8)
|
||||
|
||||
ENABLE_TESTING()
|
||||
#CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/CTestCustom.cmake ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
|
||||
|
||||
# set CMake modules path
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
set(filenameBITTest "${CMAKE_BINARY_DIR}/testBITs.cpp")
|
||||
file(WRITE ${filenameBITTest} "
|
||||
// http://stackoverflow.com/a/1505664
|
||||
#include <iostream>
|
||||
template<int> void DoMyOperationHelper();
|
||||
template<> void DoMyOperationHelper<4>() {
|
||||
std::cout << 32;
|
||||
}
|
||||
template<> void DoMyOperationHelper<8>() {
|
||||
std::cout << 64;
|
||||
}
|
||||
// helper function just to hide clumsy syntax
|
||||
inline void DoMyOperation() { DoMyOperationHelper<sizeof(size_t)>(); }
|
||||
int main(){
|
||||
// appropriate function will be selected at compile time
|
||||
DoMyOperation();
|
||||
return 0;
|
||||
}" )
|
||||
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
||||
${CMAKE_BINARY_DIR} ${filenameBITTest}
|
||||
COMPILE_OUTPUT_VARIABLE comp
|
||||
RUN_OUTPUT_VARIABLE run
|
||||
)
|
||||
if( "64" STREQUAL "${run}")
|
||||
if (WIN32)
|
||||
set(ARCH_DIR "win64")
|
||||
else()
|
||||
set(ARCH_DIR "unix64")
|
||||
endif()
|
||||
else()
|
||||
if (WIN32)
|
||||
set(ARCH_DIR "win32")
|
||||
else()
|
||||
set(ARCH_DIR "unix32")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("Build architecture ${ARCH_DIR}")
|
||||
|
||||
# set default build type to release
|
||||
# (None Debug Release RelWithDebInfo MinSizeRel)
|
||||
#set (CMAKE_BUILD_TYPE "Debug")
|
||||
|
||||
# for debug version
|
||||
#set (CMAKE_DEBUG_POSTFIX "d")
|
||||
|
||||
# detect svn version
|
||||
# if existant
|
||||
|
||||
set(PATCH_NO_FILE "${CMAKE_CURRENT_LIST_DIR}/PATCH_NO")
|
||||
|
||||
|
||||
|
||||
|
||||
file (STRINGS ${PATCH_NO_FILE} CURRENT_PATCH_NUMBER)
|
||||
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/patchnumber.h"
|
||||
"#ifndef DR_PATCH_NUMBER\n#define DR_PATCH_NUMBER ${CURRENT_PATCH_NUMBER}\n#endif\n" )
|
||||
|
||||
|
||||
# save which project is currently being built.
|
||||
# this allows for dynamic insertion of dependencies, if not met
|
||||
# ALso two ways of building can be realized:
|
||||
# - build ALL modules, thirdparty and projects
|
||||
# - build particular module and it's dependencies, only
|
||||
# (e.g. for windows installer)
|
||||
if (DEFINED PROJECTNAME)
|
||||
## FRESH_RUN is set per CMAKE run
|
||||
# if it is not set, the state of included dependency projects
|
||||
# is deleted
|
||||
# this enforces the same route of dependencies being taking
|
||||
# no matter if it is the first run or concecutive runs...
|
||||
#
|
||||
# together with standalone.cmake this ensures correct binding of
|
||||
# dependencies outside from the current source tree. Also this
|
||||
# ensures changes of outside source trees being committed to a
|
||||
# new buildRTYFRESH_RUN)
|
||||
if(NOT DEFINED FRESH_RUN)
|
||||
set(FRESH_RUN 1)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_BINARY_DIR}/built/")
|
||||
endif(NOT DEFINED FRESH_RUN)
|
||||
|
||||
# used for standalone.cmake, here save that this current project
|
||||
# is already being built
|
||||
set(BUILDFILE "${CMAKE_BINARY_DIR}/built/${PROJECTNAME}")
|
||||
IF (NOT EXISTS ${BUILDFILE})
|
||||
FILE (WRITE ${BUILDFILE} "this project has already been included for build\n")
|
||||
ENDIF (NOT EXISTS ${BUILDFILE})
|
||||
endif()
|
||||
|
||||
#enable std 2011 Standard for GNU
|
||||
if(NOT MSVC)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE GCC_VERSION)
|
||||
#if (CMAKE_COMPILER_IS_GNUCC AND (GCC_VERSION VERSION_LESS 4.7 OR GCC_VERSION VERSION_EQUAL 4.7))
|
||||
#message(STATUS "Version <= 4.7")
|
||||
if ( (NOT (${PROJECTNAME} STREQUAL "libjpeg")) )
|
||||
add_definitions("-std=c++11")
|
||||
#endif()
|
||||
else()
|
||||
remove_definitions("-std=c++11")
|
||||
endif()
|
||||
endif()
|
||||
#-static -static-libgcc -static-libstdc++
|
||||
if (MINGW)
|
||||
# for windows, make sure the required STD libs is linked statically into the executable
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++" )
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++" )
|
||||
#SET_TARGET_PROPERTIES(${PROJECTNAME} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
# set warning levels
|
||||
# http://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
|
||||
if(MSVC)
|
||||
# Force to always compile with W4
|
||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
endif()
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
get_filename_component(MINGW_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||
|
||||
if (${ARCH_DIR} STREQUAL "win64")
|
||||
INSTALL(FILES
|
||||
"${MINGW_BIN_DIR}/libgcc_s_seh-1.dll"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
INSTALL(FILES
|
||||
"${MINGW_BIN_DIR}/libstdc++-6.dll"
|
||||
"${MINGW_BIN_DIR}/libwinpthread-1.dll"
|
||||
"${MINGW_BIN_DIR}/libgomp-1.dll"
|
||||
DESTINATION bin
|
||||
COMPONENT main
|
||||
)
|
||||
endif()
|
||||
|
||||
#message ( "${ARCH_DIR}, SVN revision: ${CURRENT_PATCH_NUMBER}")
|
||||
|
||||
# ...
|
||||
#link_directories(${CMAKE_BINARY_DIR}/lib)
|
||||
#link_directories(${CURRENT_LIST_DIR}/../lib)
|
||||
|
||||
include_directories(${CMAKE_BINARY_DIR}/include)
|
||||
include_directories(${CMAKE_BINARY_DIR}/${PROJECT_NAME})
|
||||
include_directories(${CMAKE_BINARY_DIR}/module_${PROJECT_NAME})
|
||||
|
||||
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
|
||||
SET(CPACK_NSIS_CONTACT "info@dominik-ruess.de")
|
Reference in New Issue
Block a user