From e7c502d0b128840425476aa67cd103ca86e245a4 Mon Sep 17 00:00:00 2001 From: Antoine Regimbeau <antoine.regimbeau@c-s.fr> Date: Thu, 19 Apr 2018 16:47:01 +0200 Subject: [PATCH] SuperBuild: add font for QT5 --- .../QtWidget/src/otbQtApplication.cxx | 2 +- SuperBuild/CMake/External_qt5.cmake | 10 ++++- SuperBuild/CMake/font_qt.cmake | 38 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 SuperBuild/CMake/font_qt.cmake diff --git a/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx b/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx index 6e4d60d927..40db99f6b6 100644 --- a/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx +++ b/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx @@ -28,7 +28,7 @@ namespace Wrapper QtApplication::QtApplication(int& argcc, char** argvv) : QApplication(argcc, argvv) { - + std::cout<<QApplication::font().defaultFamily().toStdString()<<std::endl; } bool diff --git a/SuperBuild/CMake/External_qt5.cmake b/SuperBuild/CMake/External_qt5.cmake index e7dab50979..934caa492f 100644 --- a/SuperBuild/CMake/External_qt5.cmake +++ b/SuperBuild/CMake/External_qt5.cmake @@ -57,7 +57,7 @@ set(QT5_SB_CONFIG "-prefix ${QT5_INSTALL_PREFIX_NATIVE} -L ${QT5_LIB_PREFIX_NATIVE} \ -I ${QT5_INCLUDE_PREFIX_NATIVE} -I ${QT5_INCLUDE_FREETYPE_NATIVE} \ -opensource -confirm-license -release -shared \ - -nomake examples -nomake tools -no-openssl \ + -nomake examples -make tools -no-openssl \ -skip qtgamepad \ -skip qt3d \ -skip qtactiveqt \ @@ -194,3 +194,11 @@ configure_file( ${QT5_CONFIGURE_COMMAND_IN} ${QT5_CONFIGURE_COMMAND} @ONLY ) SUPERBUILD_PATCH_SOURCE(QT5) set(_SB_QT_QMAKE_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/qmake) + +if(UNIX AND NOT APPLE) + ExternalProject_Add_Step(QT5 adding_font + COMMAND ${CMAKE_COMMAND} + -D BUILD_DIR=${QT5_SB_BUILD_DIR} -D INSTALL_DIR=${SB_INSTALL_PREFIX} -D DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION} -P /home/antoine/dev/off_otbL/otb/SuperBuild/CMake/font_qt.cmake + DEPENDEES install + WORKING_DIRECTORY ${SB_INSTALL_PREFIX} ) +endif() diff --git a/SuperBuild/CMake/font_qt.cmake b/SuperBuild/CMake/font_qt.cmake new file mode 100644 index 0000000000..d88fdbf2e9 --- /dev/null +++ b/SuperBuild/CMake/font_qt.cmake @@ -0,0 +1,38 @@ +# +# Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +get_filename_component(BUILD_DIR ${BUILD_DIR} DIRECTORY) + +if( NOT DOWNLOAD_LOCATION ) + set (DOWNLOAD_LOCATION ${BUILD_DIR}/src/) +endif() + +file(MAKE_DIRECTORY ${INSTALL_DIR}/lib/fonts/) +file(DOWNLOAD + http://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2 + ${DOWNLOAD_LOCATION}/dejavu-fonts-ttf-2.37.tar.bz2 + EXPECTED_MD5 d0efec10b9f110a32e9b8f796e21782c) + +execute_process( +COMMAND ${CMAKE_COMMAND} -E tar -xf ${DOWNLOAD_LOCATION}/dejavu-fonts-ttf-2.37.tar.bz2 +WORKING_DIRECTORY ${BUILD_DIR} ) + +file( COPY ${BUILD_DIR}/dejavu-fonts-ttf-2.37/ttf/. + DESTINATION ${INSTALL_DIR}/lib/fonts/.) -- GitLab