Merge lp:~johannr/meshbuilder/cmake into lp:meshbuilder

Proposed by Johannes Ring
Status: Merged
Approved by: Benjamin Kehlet
Approved revision: no longer in the source branch.
Merged at revision: 154
Proposed branch: lp:~johannr/meshbuilder/cmake
Merge into: lp:meshbuilder
Diff against target: 433 lines (+216/-131)
10 files modified
CMakeLists.txt (+30/-0)
doc/CMakeLists.txt (+17/-0)
doc/man/man1/meshbuilder.1 (+19/-0)
meshbuilder.pro (+0/-126)
src/CMakeLists.txt (+145/-0)
src/gui/ApplicationWindow.cpp (+1/-1)
src/gui/ApplicationWindow.h (+1/-1)
src/gui/ColorButton.cpp (+1/-1)
src/gui/Colormap.cpp (+1/-1)
src/gui/FloatSlider.cpp (+1/-1)
To merge this branch: bzr merge lp:~johannr/meshbuilder/cmake
Reviewer Review Type Date Requested Status
Benjamin Kehlet (community) Approve
Review via email: mp+61981@code.launchpad.net

Description of the change

CMake has good support for Qt and OpenSceneGraph applications. This branch moves MeshBuilder to CMake. Other benefits for moving to CMake are:

* Can use find_package(dolfin) instead of pkgconfig
* One less build system to be familiar with
* Out-of-source builds
* CPack for generating binaries

This branch also collects source code under a common subdirectory "src" and adds a man page.

The build steps should be familiar:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/foo/bar ..
make
make install

To post a comment you must log in.
Revision history for this message
Benjamin Kehlet (benjamik) wrote :

Nice!

review: Approve
lp:~johannr/meshbuilder/cmake updated
154. By Benjamin Kehlet

Replace qmake with CMake.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'CMakeLists.txt'
2--- CMakeLists.txt 1970-01-01 00:00:00 +0000
3+++ CMakeLists.txt 2011-05-23 14:26:27 +0000
4@@ -0,0 +1,30 @@
5+# require
6+cmake_minimum_required(VERSION 2.8.0)
7+
8+# project name
9+project(MESHBUILDER)
10+
11+# project version
12+set(MESHBUILDER_VERSION_MAJOR 0)
13+set(MESHBUILDER_VERSION_MINOR 2)
14+set(MESHBUILDER_VERSION_PATCH 0)
15+
16+add_definitions(
17+ -DMB_VERSION_MAJOR="${MESHBUILDER_VERSION_MAJOR}"
18+ -DMB_VERSION_MINOR="${MESHBUILDER_VERSION_MINOR}"
19+ -DMB_VERSION_PATCH="${MESHBUILDER_VERSION_PATCH}"
20+ -DQT_CLEAN_NAMESPACE
21+ )
22+
23+# find required packages
24+find_package(Qt4 REQUIRED)
25+find_package(OpenSceneGraph REQUIRED osgGA osgViewer osgFX osgUtil)
26+find_package(OpenGL REQUIRED)
27+find_package(dolfin REQUIRED
28+ HINTS ${DOLFIN_DIR}/share/dolfin/cmake $ENV{DOLFIN_DIR}/share/dolfin/cmake)
29+
30+# meshbuilder executable
31+add_subdirectory(src)
32+
33+# documentation, manual pages
34+add_subdirectory(doc)
35
36=== added directory 'doc'
37=== added file 'doc/CMakeLists.txt'
38--- doc/CMakeLists.txt 1970-01-01 00:00:00 +0000
39+++ doc/CMakeLists.txt 2011-05-23 14:26:27 +0000
40@@ -0,0 +1,17 @@
41+find_program(GZIP_EXECUTABLE NAMES gzip)
42+
43+set(MESHBUILDER_MANFILE "${CMAKE_CURRENT_SOURCE_DIR}/man/man1/meshbuilder.1")
44+set(MESHBUILDER_GZIP_MANFILE "${CMAKE_CURRENT_BINARY_DIR}/meshbuilder.1.gz")
45+add_custom_command(OUTPUT ${MESHBUILDER_GZIP_MANFILE}
46+ COMMAND ${GZIP_EXECUTABLE} -c -f ${MESHBUILDER_MANFILE} > ${MESHBUILDER_GZIP_MANFILE}
47+ DEPENDS ${MESHBUILDER_MANFILE}
48+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
49+ )
50+
51+add_custom_target(man ALL DEPENDS ${MESHBUILDER_GZIP_MANFILE}
52+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
53+
54+# install meshbuilder executable
55+install(FILES ${MESHBUILDER_GZIP_MANFILE}
56+ DESTINATION share/man/man1
57+ COMPONENT RuntimeExecutables)
58
59=== added directory 'doc/man'
60=== added directory 'doc/man/man1'
61=== added file 'doc/man/man1/meshbuilder.1'
62--- doc/man/man1/meshbuilder.1 1970-01-01 00:00:00 +0000
63+++ doc/man/man1/meshbuilder.1 2011-05-23 14:26:27 +0000
64@@ -0,0 +1,19 @@
65+.TH MESHBUILDER 1
66+.SH NAME
67+meshbuilder \- Mesh builder for DOLFIN
68+.SH SYNOPSIS
69+.B meshbuilder
70+.SH DESCRIPTION
71+MeshBuilder is a tool for building meshes for DOLFIN. With MeshBuilder
72+you can set integer meshfunctions on DOLFIN meshes, on vertices, edges,
73+and faces. These can be saved and loaded. You also use MeshBuilder to
74+create screenshots and one can look at the boundary mesh of a mesh (or a
75+2D mesh directly). MeshBuilder is provided by FEniCS.
76+.SH OPTIONS
77+MeshBuilder does not offer command-line options of its own; at present
78+one cannot open mesh files from the command-line. As a Qt application it
79+supports Qt options; please see:
80+
81+http://doc.trolltech.com/4.2/qapplication.html#QApplication
82+.SH AUTHOR
83+This manual page was written by Johannes Ring <johannr@simula.no>.
84
85=== removed file 'meshbuilder.pro'
86--- meshbuilder.pro 2011-05-16 23:02:33 +0000
87+++ meshbuilder.pro 1970-01-01 00:00:00 +0000
88@@ -1,126 +0,0 @@
89-# -*- makefile -*-
90-
91-TEMPLATE = app
92-TARGET = meshbuilder
93-
94-OBJECTS_DIR = build
95-MOC_DIR = build
96-UI_DIR = build
97-
98-CONFIG += debug
99-
100-# The following look like a contradiction, but warn_on enables
101-# strictwarnings (the -W option) as well, which leads to
102-# a load of warnings from the Dolfin headers.
103-CONFIG += warn_off
104-QMAKE_CXXFLAGS += -Wall
105-
106-QT += opengl xml
107-
108-DEFINES += LINUX
109-DEFINES += QT_CLEAN_NAMESPACE
110-#DEFINES += QT_NO_DEBUG
111-
112-RESOURCES = resources.qrc
113-
114-# Main mode options.
115-
116-VER_MAJ = 0
117-VER_MIN = 2
118-VER_PAT = 0
119-
120-DEFINES += MB_VERSION_MAJOR=$$VER_MAJ
121-DEFINES += MB_VERSION_MINOR=$$VER_MIN
122-DEFINES += MB_VERSION_PATCH=$$VER_PAT
123-
124-FORMS = \
125- gui/ColorButton.ui \
126- gui/FloatSlider.ui \
127- gui/Colormap.ui \
128- gui/ApplicationWindow.ui
129-
130-HEADERS = \
131- base/ObjectState.h \
132- util/QtUtil.h \
133- util/SimResState.h \
134- osgQt/AdapterWidget.h \
135- osgQt/TrackballManipulator.h \
136- osgQt/RenderArea.h \
137- scenegraph/OsgTransformObject.h \
138- scenegraph/OsgDrawableObject.h \
139- scenegraph/OsgDrawableObjectConnector.h \
140- scenegraph/OsgMeshObject.h \
141- scenegraph/OsgDolfinObject.h \
142- gui/ColorButton.h \
143- gui/FloatSlider.h \
144- gui/Colormap.h \
145- gui/Context.h \
146- gui/MaterialSettings.h \
147- gui/TransformSettings.h \
148- gui/SimResSettings.h \
149- gui/DolfinEventHandler.h \
150- gui/Viewer.h \
151- gui/ApplicationWindow.h \
152- gui/Viewer_2D.h \
153- gui/Scene_2D.h \
154- gui/EntityInterface_2D.h \
155- gui/Vertex_2D.h \
156- gui/Edge_2D.h \
157- gui/Axes_2D.h \
158- gui/VisualizationDialog_2D.h \
159- gui/ViewerSettingsDialog.h \
160- gui/ClipPlanesDialog.h \
161- gui/TransformationsDialog.h \
162- gui/VisualizationDialog.h \
163- gui/DrawSettingsDialog.h \
164- gui/MeshFunctionsToolbar.h \
165- gui/ViewerInterface.h \
166- gui/DolfinObject.h
167-
168-SOURCES = \
169- util/QtUtil.cpp \
170- util/SimResState.cpp \
171- osgQt/AdapterWidget.cpp \
172- osgQt/TrackballManipulator.cpp \
173- osgQt/RenderArea.cpp \
174- scenegraph/OsgTransformObject.cpp \
175- scenegraph/OsgDrawableObject.cpp \
176- scenegraph/OsgMeshObject.cpp \
177- scenegraph/OsgDolfinObject.cpp \
178- gui/ColorButton.cpp \
179- gui/FloatSlider.cpp \
180- gui/Colormap.cpp \
181- gui/Context.cpp \
182- gui/MaterialSettings.cpp \
183- gui/TransformSettings.cpp \
184- gui/SimResSettings.cpp \
185- gui/DolfinEventHandler.cpp \
186- gui/Viewer.cpp \
187- gui/ApplicationWindow.cpp \
188- gui/Viewer_2D.cpp \
189- gui/Scene_2D.cpp \
190- gui/Vertex_2D.cpp \
191- gui/Edge_2D.cpp \
192- gui/Axes_2D.cpp \
193- gui/VisualizationDialog_2D.cpp \
194- gui/ViewerSettingsDialog.cpp \
195- gui/ClipPlanesDialog.cpp \
196- gui/TransformationsDialog.cpp \
197- gui/VisualizationDialog.cpp \
198- gui/DrawSettingsDialog.cpp \
199- gui/MeshFunctionsToolbar.cpp \
200- gui/DolfinObject.cpp \
201- main.cpp
202-
203-
204-# Sub directories
205-DEPENDPATH += base gui scenegraph util osgQt
206-
207-# Open scene graph flags
208-QMAKE_CXXFLAGS += $$system(pkg-config --cflags openscenegraph)
209-LIBS += $$system(pkg-config --libs openscenegraph)
210-
211-# DOLFIN flags
212-QMAKE_CXXFLAGS += $$system(pkg-config --cflags dolfin)
213-LIBS += $$system(pkg-config --libs dolfin)
214-
215
216=== added directory 'src'
217=== added file 'src/CMakeLists.txt'
218--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
219+++ src/CMakeLists.txt 2011-05-23 14:26:27 +0000
220@@ -0,0 +1,145 @@
221+# set include directories
222+include_directories(
223+ ${CMAKE_CURRENT_SOURCE_DIR}
224+ ${CMAKE_CURRENT_BINARY_DIR}
225+ ${OPENSCENEGRAPH_INCLUDE_DIRS}
226+ ${OPENGL_INCLUDE_DIR}
227+ ${DOLFIN_INCLUDE_DIRS}
228+ ${DOLFIN_3RD_PARTY_INCLUDE_DIRS}
229+ )
230+
231+add_definitions(${DOLFIN_CXX_DEFINITIONS})
232+
233+# add Qt modules here, the include will setup QT_LIBRARIES
234+set(QT_USE_QTOPENGL TRUE)
235+set(QT_USE_QTXML TRUE)
236+
237+include(${QT_USE_FILE})
238+
239+# .cpp sources
240+set(MESHBUILDER_SRCS_CXX
241+ util/QtUtil.cpp
242+ util/SimResState.cpp
243+
244+ osgQt/AdapterWidget.cpp
245+ osgQt/TrackballManipulator.cpp
246+ osgQt/RenderArea.cpp
247+
248+ scenegraph/OsgTransformObject.cpp
249+ scenegraph/OsgDrawableObject.cpp
250+ scenegraph/OsgMeshObject.cpp
251+ scenegraph/OsgDolfinObject.cpp
252+
253+ gui/ColorButton.cpp
254+ gui/FloatSlider.cpp
255+ gui/Colormap.cpp
256+ gui/Context.cpp
257+ gui/MaterialSettings.cpp
258+ gui/TransformSettings.cpp
259+ gui/SimResSettings.cpp
260+ gui/DolfinEventHandler.cpp
261+ gui/Viewer.cpp
262+ gui/ApplicationWindow.cpp
263+ gui/Viewer_2D.cpp
264+ gui/Scene_2D.cpp
265+ gui/Vertex_2D.cpp
266+ gui/Edge_2D.cpp
267+ gui/Axes_2D.cpp
268+ gui/VisualizationDialog_2D.cpp
269+ gui/ViewerSettingsDialog.cpp
270+ gui/ClipPlanesDialog.cpp
271+ gui/TransformationsDialog.cpp
272+ gui/VisualizationDialog.cpp
273+ gui/DrawSettingsDialog.cpp
274+ gui/MeshFunctionsToolbar.cpp
275+ gui/DolfinObject.cpp
276+
277+ main.cpp
278+ )
279+
280+# files which need to be moc'd by Qt
281+set(MESHBUILDER_MOC_SRCS
282+ #base/ObjectState.h
283+
284+ #util/QtUtil.h
285+ util/SimResState.h
286+
287+ osgQt/AdapterWidget.h
288+ #osgQt/TrackballManipulator.h
289+ osgQt/RenderArea.h
290+
291+ #scenegraph/OsgTransformObject.h
292+ #scenegraph/OsgDrawableObject.h
293+ scenegraph/OsgDrawableObjectConnector.h
294+ #scenegraph/OsgMeshObject.h
295+ #scenegraph/OsgDolfinObject.h
296+
297+ gui/ColorButton.h
298+ gui/FloatSlider.h
299+ gui/Colormap.h
300+ gui/Context.h
301+ gui/MaterialSettings.h
302+ gui/TransformSettings.h
303+ gui/SimResSettings.h
304+ #gui/DolfinEventHandler.h
305+ gui/Viewer.h
306+ gui/ApplicationWindow.h
307+ gui/Viewer_2D.h
308+ gui/Scene_2D.h
309+ gui/EntityInterface_2D.h
310+ #gui/Vertex_2D.h
311+ #gui/Edge_2D.h
312+ gui/Axes_2D.h
313+ gui/VisualizationDialog_2D.h
314+ gui/ViewerSettingsDialog.h
315+ gui/ClipPlanesDialog.h
316+ gui/TransformationsDialog.h
317+ gui/VisualizationDialog.h
318+ gui/DrawSettingsDialog.h
319+ gui/MeshFunctionsToolbar.h
320+ gui/ViewerInterface.h
321+ gui/DolfinObject.h
322+ )
323+
324+# ui files
325+set(MESHBUILDER_UIS
326+ gui/ColorButton.ui
327+ gui/FloatSlider.ui
328+ gui/Colormap.ui
329+ gui/ApplicationWindow.ui
330+ )
331+
332+# resource files
333+set(MESHBUILDER_RCS
334+ resources.qrc
335+ )
336+
337+# build ui_XXX files from the XML-style .ui files
338+qt4_wrap_ui(MESHBUILDER_SRCS_CXX ${MESHBUILDER_UIS})
339+
340+# this moc's the above variable and appends to the cpp sources
341+qt4_wrap_cpp(MESHBUILDER_SRCS_CXX ${MESHBUILDER_MOC_SRCS})
342+
343+# this runs rcc on the resources and appends to the cpp sources
344+qt4_add_resources(MESHBUILDER_SRCS_CXX ${MESHBUILDER_RCS})
345+
346+# create the meshbuilder executable
347+if (UNIX)
348+ add_executable(meshbuilder ${MESHBUILDER_SRCS_CXX})
349+elseif (APPLE)
350+ add_executable(meshbuilder MACOSX_BUNDLE ${MESHBUILDER_SRCS_CXX})
351+elseif (WIN32)
352+ add_executable(meshbuilder WIN32 ${MESHBUILDER_SRCS_CXX})
353+endif()
354+
355+# link against required libraries
356+target_link_libraries(meshbuilder
357+ ${QT_LIBRARIES}
358+ ${OPENSCENEGRAPH_LIBRARIES}
359+ ${OPENGL_LIBRARIES}
360+ ${DOLFIN_LIBRARIES}
361+ ${DOLFIN_3RD_PARTY_LIBRARIES}
362+ )
363+
364+# install meshbuilder executable
365+install(TARGETS meshbuilder DESTINATION bin COMPONENT RuntimeExecutables)
366
367=== renamed directory 'base' => 'src/base'
368=== renamed directory 'gui' => 'src/gui'
369=== modified file 'src/gui/ApplicationWindow.cpp'
370--- gui/ApplicationWindow.cpp 2011-02-11 05:51:14 +0000
371+++ src/gui/ApplicationWindow.cpp 2011-05-23 14:26:27 +0000
372@@ -5,7 +5,7 @@
373 #include <gui/MeshFunctionsToolbar.h>
374 #include <gui/ViewerInterface.h>
375
376-#include <build/ui_ApplicationWindow.h>
377+#include <ui_ApplicationWindow.h>
378
379 #include <QFileDialog>
380 #include <QApplication>
381
382=== modified file 'src/gui/ApplicationWindow.h'
383--- gui/ApplicationWindow.h 2011-02-11 05:51:14 +0000
384+++ src/gui/ApplicationWindow.h 2011-05-23 14:26:27 +0000
385@@ -5,7 +5,7 @@
386 #include <gui/Context.h>
387 #include <gui/Viewer.h>
388 #include <util/SimResState.h>
389-#include <build/ui_ApplicationWindow.h>
390+#include <ui_ApplicationWindow.h>
391
392 #include <QMainWindow>
393
394
395=== modified file 'src/gui/ColorButton.cpp'
396--- gui/ColorButton.cpp 2010-03-27 14:26:04 +0000
397+++ src/gui/ColorButton.cpp 2011-05-23 14:26:27 +0000
398@@ -1,5 +1,5 @@
399 #include <gui/ColorButton.h>
400-#include <build/ui_ColorButton.h>
401+#include <ui_ColorButton.h>
402
403 #include <QColorDialog>
404 #include <QPushButton>
405
406=== modified file 'src/gui/Colormap.cpp'
407--- gui/Colormap.cpp 2010-03-26 15:36:55 +0000
408+++ src/gui/Colormap.cpp 2011-05-23 14:26:27 +0000
409@@ -1,5 +1,5 @@
410 #include <gui/Colormap.h>
411-#include <build/ui_Colormap.h>
412+#include <ui_Colormap.h>
413
414 #include <QColorDialog>
415
416
417=== modified file 'src/gui/FloatSlider.cpp'
418--- gui/FloatSlider.cpp 2010-03-26 15:36:55 +0000
419+++ src/gui/FloatSlider.cpp 2011-05-23 14:26:27 +0000
420@@ -1,5 +1,5 @@
421 #include <gui/FloatSlider.h>
422-#include <build/ui_FloatSlider.h>
423+#include <ui_FloatSlider.h>
424
425 #include <QSlider>
426 #include <QLineEdit>
427
428=== renamed file 'main.cpp' => 'src/main.cpp'
429=== renamed directory 'osgQt' => 'src/osgQt'
430=== renamed directory 'resources' => 'src/resources'
431=== renamed file 'resources.qrc' => 'src/resources.qrc'
432=== renamed directory 'scenegraph' => 'src/scenegraph'
433=== renamed directory 'util' => 'src/util'

Subscribers

People subscribed via source and target branches