1
# bindings/qt_gui/CMakeLists.txt
2
### Process this file with cmake to produce Makefile
4
# Copyright (C) 2006 Alan W. Irwin
6
# This file is part of PLplot.
8
# PLplot is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU Library General Public License as published
10
# by the Free Software Foundation; version 2 of the License.
12
# PLplot is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Library General Public License for more details.
17
# You should have received a copy of the GNU Library General Public License
18
# along with PLplot; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
# Set up Qt4-based build environment.
23
include(${QT_USE_FILE})
25
message(FATAL_ERROR "include(${QT_USE_FILE}) failed in bindings/qt_gui subdirectory.")
26
endif(NOT QT_LIBRARIES)
27
set(qt_SOURCE plqt.cpp)
29
${CMAKE_SOURCE_DIR}/include
30
${CMAKE_SOURCE_DIR}/lib/qsastime
31
${CMAKE_SOURCE_DIR}/lib/nistcd
32
${CMAKE_SOURCE_DIR}/drivers
34
${CMAKE_BINARY_DIR}/include
37
set_source_files_properties(
39
PROPERTIES COMPILE_FLAGS "${qt_COMPILE_FLAGS} -DUSINGDLL"
41
#message("qt_COMPILE_FLAGS = ${qt_COMPILE_FLAGS}")
42
else(qt_COMPILE_FLAGS)
43
set_source_files_properties(
45
PROPERTIES COMPILE_FLAGS "-DUSINGDLL"
47
endif(qt_COMPILE_FLAGS)
49
add_library(plplotqt${LIB_TAG} ${qt_SOURCE})
50
add_dependencies(plplotqt${LIB_TAG} moc_outfile_generated)
52
message(FATAL_ERROR "Internal build system inconsistency between ENABLE_qt true and ANY_QT_DEVICE false.")
54
target_link_libraries(
60
# qt_RPATH set in cmake/modules/qt.cmake. This is only used for the
61
# install-tree rpath since cmake handles the build-tree rpath
62
# automatically (so long as full pathnames to libraries are used).
63
#message("qt_RPATH = ${qt_RPATH}")
65
# Order is important here because of /usr/lib concerns.
69
${libplplot${LIB_TAG}_RPATH}
71
#message("LIB_INSTALL_RPATH = ${LIB_INSTALL_RPATH}")
72
set_target_properties(plplotqt${LIB_TAG}
74
SOVERSION ${plplotqt_SOVERSION}
75
VERSION ${plplotqt_VERSION}
76
INSTALL_RPATH "${LIB_INSTALL_RPATH}"
77
INSTALL_NAME_DIR "${LIB_DIR}"
80
set_target_properties(plplotqt${LIB_TAG}
82
SOVERSION ${plplotqt_SOVERSION}
83
VERSION ${plplotqt_VERSION}
84
INSTALL_NAME_DIR "${LIB_DIR}"
87
install(TARGETS plplotqt${LIB_TAG}
89
ARCHIVE DESTINATION ${LIB_DIR}
90
LIBRARY DESTINATION ${LIB_DIR}
91
RUNTIME DESTINATION ${BIN_DIR}
94
# Transform "${QT_LIBRARIES}" to the standard pkg-config form.
95
pkg_config_link_flags(
96
libplplotqt${LIB_TAG}_LINK_FLAGS
100
# Configure pkg-config *.pc file corresponding to the compile and link
101
# flags needed by a Qt GUI executable using extqt to gain access to PLplot.
102
if(PKG_CONFIG_EXECUTABLE)
104
set(PC_PRECISION "double")
106
set(PC_PRECISION "single")
108
# Each list element must consist of a colon-separated string with the
109
# following fields which are parsed out in the foreach loop below and
110
# used to configure the corresponding pkg-config *.pc file.
111
# BINDING - ENABLE_${BINDING} keeps track of whether a
112
# binding has been enabled (ON) or not (OFF).
113
# Also, ${BINDING} used to determine PC_FILE_SUFFIX
114
# which helps to determine name of configured
116
# PC_SHORT_NAME - Used in *.pc NAME: field
117
# PC_LONG_NAME - Used in *.pc Description: field
118
# PC_LIBRARY_NAME - Used in *.pc Libs: field
119
# Also used to determine PC_LINK_FLAGS and
120
# PC_COMPILE_FLAGS used in *.pc Libs: and Cflags:
122
set(PC_DATA "qt:Qt:Qt4 bindings, :plplotqt${LIB_TAG}")
124
string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA})
125
set(PC_FILE_SUFFIX "-${BINDING}")
126
set(PC_REQUIRES "plplot${LIB_TAG}")
127
string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA})
128
string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA})
129
string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA})
130
set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
131
set(PC_COMPILE_FLAGS "${qt_COMPILE_FLAGS}")
132
set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
133
set(PC_CONFIGURED_FILE
134
${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc
137
${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake
138
${PC_CONFIGURED_FILE}
141
install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
142
endif(PKG_CONFIG_EXECUTABLE)
144
add_subdirectory(pyqt4)