Changeset - 2931231be6b8
[Not reviewed]
default
0 1 1
Hasan Yavuz ÖZDERYA - 9 years ago 2016-06-16 04:34:03
hy@ozderya.net
added qwt build step as an external project which will download and link qwt as a static library
2 files changed with 54 insertions and 8 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
#
 
# Copyright © 2015 Hasan Yavuz Özderya
 
# Copyright © 2015-2016 Hasan Yavuz Özderya
 
#
 
# This file is part of serialplot.
 
#
 
@@ -36,17 +36,23 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PAT
 
# Find the QtWidgets library
 
find_package(Qt5Widgets)
 

	
 
# Find QWT or use static
 
# If set, cmake will download Qwt over SVN, build and use it as a static library.
 
set(BUILD_QWT true CACHE BOOL "Download and build Qwt automatically.")
 
# Find QWT or use static manually provided by user
 
set(QWT_USE_STATIC false CACHE BOOL "Use a static version of Qwt provided by user.")
 
set(QWT_STATIC_LIBRARY "" CACHE FILEPATH "Path to the static Qwt library, libqwt.a.")
 
set(QWT_STATIC_INCLUDE "" CACHE PATH "Path to the Qwt include directory when building Qwt static.")
 

	
 
if (QWT_USE_STATIC)
 
  set(QWT_LIBRARY ${QWT_STATIC_LIBRARY})
 
  set(QWT_INCLUDE_DIR ${QWT_STATIC_INCLUDE})
 
else (QWT_USE_STATIC)
 
  find_package(Qwt 6.1 REQUIRED)
 
endif (QWT_USE_STATIC)
 
if (BUILD_QWT)
 
  include(BuildQwt)
 
else (BUILD_QWT)
 
  if (QWT_USE_STATIC)
 
	set(QWT_LIBRARY ${QWT_STATIC_LIBRARY})
 
	set(QWT_INCLUDE_DIR ${QWT_STATIC_INCLUDE})
 
  else (QWT_USE_STATIC)
 
	find_package(Qwt 6.1 REQUIRED)
 
  endif (QWT_USE_STATIC)
 
endif (BUILD_QWT)
 

	
 
# includes
 
include_directories("./src" ${QWT_INCLUDE_DIR})
 
@@ -117,6 +123,10 @@ add_executable(${PROGRAM_NAME} WIN32
 
target_link_libraries(${PROGRAM_NAME} ${QWT_LIBRARY})
 
qt5_use_modules(${PROGRAM_NAME} Widgets SerialPort Svg)
 

	
 
if (BUILD_QWT)
 
  add_dependencies(${PROGRAM_NAME} QWT)
 
endif (BUILD_QWT)
 

	
 
# set compiler flags
 
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
 

	
cmake/modules/BuildQwt.cmake
Show inline comments
 
new file 100644
 
#
 
# Copyright © 2016 Hasan Yavuz Özderya
 
#
 
# This file is part of serialplot.
 
#
 
# serialplot is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# serialplot is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with serialplot.  If not, see <http://www.gnu.org/licenses/>.
 
#
 

	
 
include(ExternalProject)
 

	
 
ExternalProject_Add(QWT
 
  PREFIX qwt
 
  SVN_REPOSITORY svn://svn.code.sf.net/p/qwt/code/branches/qwt-6.1
 
  # disable QwtDesigner plugin and enable static build
 
  PATCH_COMMAND sed -i -r -e "s/QWT_CONFIG\\s*\\+=\\s*QwtDesigner/#&/"
 
                          -e "s/QWT_CONFIG\\s*\\+=\\s*QwtDll/#&/"
 
						  -e "s:/usr/local/.*:<INSTALL_DIR>:"
 
							 <SOURCE_DIR>/qwtconfig.pri
 
  CONFIGURE_COMMAND qmake <SOURCE_DIR>/qwt.pro
 
  )
 

	
 
ExternalProject_Get_Property(QWT install_dir)
 
set(QWT_ROOT ${install_dir})
 
set(QWT_LIBRARY ${QWT_ROOT}/lib/libqwt.a)
 
set(QWT_INCLUDE_DIR ${QWT_ROOT}/include)
0 comments (0 inline, 0 general)