Commit da86040e authored by Jan Möbius's avatar Jan Möbius

Merge branch 'Reduce_QT_Dependencies' into 'master'

Removed a lot of unnecessary QT dependencies

See merge request !200
parents 8c4634d5 3f52d242
Pipeline #8101 passed with stages
in 92 minutes and 56 seconds
......@@ -54,46 +54,15 @@ macro (acg_qt5)
find_package (Qt5Gui QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5OpenGL QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Network QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Sql QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Script QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5ScriptTools QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Xml QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5XmlPatterns QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Help QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5UiTools QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Svg QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5PrintSupport QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Concurrent QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
#do noot look for Webkit and qt declarative on qt version 5.6 or newer
if(${QT_VERSION_MINOR} LESS 6)
find_package (Qt5Declarative QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5WebKit QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
endif(${QT_VERSION_MINOR} LESS 6)
if (NOT WIN32 AND NOT APPLE)
find_package (Qt5X11Extras QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
endif ()
if(${QT_VERSION_MINOR} GREATER 5)
if (Qt5Core_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
set (QT5_FOUND TRUE)
endif()
else(${QT_VERSION_MINOR} GREATER 5)
if (Qt5Core_FOUND AND Qt5Declarative_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5WebKit_FOUND AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
if (Qt5Core_FOUND AND Qt5Widgets_FOUND AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND )
set (QT5_FOUND TRUE)
endif()
endif(${QT_VERSION_MINOR} GREATER 5)
endif()
endif(Qt5Core_FOUND)
if (QT5_FOUND)
......@@ -125,36 +94,15 @@ macro (acg_qt5)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include_directories(${Qt5Core_INCLUDE_DIRS})
include_directories(${Qt5Declarative_INCLUDE_DIRS})
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${Qt5Gui_INCLUDE_DIRS})
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
include_directories(${Qt5Network_INCLUDE_DIRS})
include_directories(${Qt5Script_INCLUDE_DIRS})
include_directories(${Qt5ScriptTools_INCLUDE_DIRS})
include_directories(${Qt5Sql_INCLUDE_DIRS})
include_directories(${Qt5Xml_INCLUDE_DIRS})
include_directories(${Qt5XmlPatterns_INCLUDE_DIRS})
include_directories(${Qt5Help_INCLUDE_DIRS})
include_directories(${Qt5WebKit_INCLUDE_DIRS})
include_directories(${Qt5UiTools_INCLUDE_DIRS})
include_directories(${Qt5Concurrent_INCLUDE_DIRS})
include_directories(${Qt5PrintSupport_INCLUDE_DIRS})
add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(${Qt5Widgets_DEFINITIONS})
add_definitions(${Qt5Gui_DEFINITIONS})
add_definitions(${Qt5OpenGL_DEFINITIONS})
add_definitions(${Qt5Network_DEFINITIONS})
add_definitions(${Qt5Script_DEFINITIONS})
add_definitions(${Qt5ScriptTools_DEFINITIONS})
add_definitions(${Qt5Sql_DEFINITIONS})
add_definitions(${Qt5Xml_DEFINITIONS})
add_definitions(${Qt5XmlPatterns_DEFINITIONS})
add_definitions(${Qt5Help_DEFINITIONS})
add_definitions(${Qt5WebKit_DEFINITIONS})
add_definitions(${Qt5UiTools_DEFINITIONS})
add_definitions(${Qt5Concurrent_DEFINITIONS})
add_definitions(${Qt5PrintSupport_DEFINITIONS})
if (Qt5X11Extras_FOUND)
include_directories(${Qt5X11Extras_INCLUDE_DIRS})
......@@ -165,12 +113,8 @@ macro (acg_qt5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
set (QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Declarative_LIBRARIES} ${Qt5Widgets_LIBRARIES}
${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Network_LIBRARIES}
${Qt5Script_LIBRARIES} ${Qt5ScriptTools_LIBRARIES} ${Qt5Sql_LIBRARIES}
${Qt5Xml_LIBRARIES} ${Qt5XmlPatterns_LIBRARIES} ${Qt5Help_LIBRARIES}
${Qt5WebKit_LIBRARIES} ${Qt5UiTools_LIBRARIES} ${Qt5Concurrent_LIBARIES}
${Qt5PrintSupport_LIBRARIES})
set (QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES}
${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Network_LIBRARIES} )
if (Qt5X11Extras_FOUND)
list (APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES})
......@@ -247,150 +191,3 @@ macro (acg_qt5_automoc moc_SRCS)
endif ()
endforeach ()
endmacro ()
# generate uic targets for sources in list
macro (acg_qt5_autouic uic_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
if ( EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_basename ${_current_FILE} NAME_WE)
string (REGEX REPLACE "Ui$" "" _cbasename ${_basename})
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh)
set (_header ${_basename}.hh)
set (_source ${_abs_PATH}/${_cbasename}.cc)
add_custom_command (OUTPUT ${_outfile}
COMMAND ${Qt5Widgets_UIC_EXECUTABLE}
ARGS -o ${_outfile} ${_abs_FILE}
MAIN_DEPENDENCY ${_abs_FILE} VERBATIM)
add_file_dependencies (${_source} ${_outfile})
set (${uic_SRCS} ${${uic_SRCS}} ${_outfile})
endif ()
endforeach ()
endmacro ()
# generate qrc targets for sources in list
macro (acg_qt5_autoqrc qrc_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
if ( EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_basename ${_current_FILE} NAME_WE)
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp)
qt5_add_resources( ${_outfile} ${_abs_FILE} )
add_file_dependencies (${_source} ${_outfile})
set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile})
endif ()
endforeach ()
endmacro ()
#generates qt translations
function (acg_add_translations _target _languages _sources)
string (TOUPPER ${_target} _TARGET)
# generate/use translation files
# run with UPDATE_TRANSLATIONS set to on to build qm files
option (UPDATE_TRANSLATIONS_${_TARGET} "Update source translation *.ts files (WARNING: make clean will delete the source .ts files! Danger!)")
set (_new_ts_files)
set (_ts_files)
foreach (lang ${_languages})
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/translations/${_target}_${lang}.ts" OR UPDATE_TRANSLATIONS_${_TARGET})
list (APPEND _new_ts_files "translations/${_target}_${lang}.ts")
else ()
list (APPEND _ts_files "translations/${_target}_${lang}.ts")
endif ()
endforeach ()
set (_qm_files)
if ( _new_ts_files )
if (QT5_FOUND)
#qt5_create_translation(_qm_files ${_sources} ${_new_ts_files})
endif ()
endif ()
if ( _ts_files )
if (QT5_FOUND)
#qt5_add_translation(_qm_files2 ${_ts_files})
endif()
list (APPEND _qm_files ${_qm_files2})
endif ()
# create a target for the translation files ( and object files )
# Use this target, to update only the translations
add_custom_target (tr_${_target} DEPENDS ${_qm_files})
GROUP_PROJECT( tr_${_target} "Translations")
# Build translations with the application
add_dependencies(${_target} tr_${_target} )
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations )
endif ()
foreach (_qm ${_qm_files})
get_filename_component (_qm_name "${_qm}" NAME)
add_custom_command (TARGET tr_${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${_qm}
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Translations/${_qm_name})
endforeach ()
if (NOT ACG_PROJECT_MACOS_BUNDLE OR NOT APPLE)
install (FILES ${_qm_files} DESTINATION "${ACG_PROJECT_DATADIR}/Translations")
endif ()
endfunction ()
# Function that writes all generated qch files into one Help.qhcp project file
function (generate_qhp_file files_loc plugin_name)
set(qhp_file "${files_loc}/${plugin_name}.qhp")
# Read in template file
file(STRINGS "${CMAKE_SOURCE_DIR}/OpenFlipper/Documentation/QtHelpResources/QtHelpProject.qhp" qhp_template)
# Initialize new project file
file(WRITE ${qhp_file} "")
foreach (_line ${qhp_template})
string(STRIP ${_line} stripped)
if("${stripped}" STREQUAL "files")
acg_get_files_in_dir (_files ${files_loc})
foreach (_file ${_files})
string(REGEX MATCH ".+[.]+((html)|(htm)|(xml))$" fileresult ${_file})
string(LENGTH "${fileresult}" len)
if(${len} GREATER 0)
file(APPEND ${qhp_file} "<file>${_file}</file>\n")
endif()
endforeach()
else()
string(REGEX REPLACE "plugin" ${plugin} newline ${_line})
file(APPEND ${qhp_file} "${newline}\n")
endif()
endforeach()
endfunction()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment