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
=== added file 'CMakeLists.txt'
--- CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ CMakeLists.txt 2011-05-23 14:26:27 +0000
@@ -0,0 +1,30 @@
1# require
2cmake_minimum_required(VERSION 2.8.0)
3
4# project name
5project(MESHBUILDER)
6
7# project version
8set(MESHBUILDER_VERSION_MAJOR 0)
9set(MESHBUILDER_VERSION_MINOR 2)
10set(MESHBUILDER_VERSION_PATCH 0)
11
12add_definitions(
13 -DMB_VERSION_MAJOR="${MESHBUILDER_VERSION_MAJOR}"
14 -DMB_VERSION_MINOR="${MESHBUILDER_VERSION_MINOR}"
15 -DMB_VERSION_PATCH="${MESHBUILDER_VERSION_PATCH}"
16 -DQT_CLEAN_NAMESPACE
17 )
18
19# find required packages
20find_package(Qt4 REQUIRED)
21find_package(OpenSceneGraph REQUIRED osgGA osgViewer osgFX osgUtil)
22find_package(OpenGL REQUIRED)
23find_package(dolfin REQUIRED
24 HINTS ${DOLFIN_DIR}/share/dolfin/cmake $ENV{DOLFIN_DIR}/share/dolfin/cmake)
25
26# meshbuilder executable
27add_subdirectory(src)
28
29# documentation, manual pages
30add_subdirectory(doc)
031
=== added directory 'doc'
=== added file 'doc/CMakeLists.txt'
--- doc/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ doc/CMakeLists.txt 2011-05-23 14:26:27 +0000
@@ -0,0 +1,17 @@
1find_program(GZIP_EXECUTABLE NAMES gzip)
2
3set(MESHBUILDER_MANFILE "${CMAKE_CURRENT_SOURCE_DIR}/man/man1/meshbuilder.1")
4set(MESHBUILDER_GZIP_MANFILE "${CMAKE_CURRENT_BINARY_DIR}/meshbuilder.1.gz")
5add_custom_command(OUTPUT ${MESHBUILDER_GZIP_MANFILE}
6 COMMAND ${GZIP_EXECUTABLE} -c -f ${MESHBUILDER_MANFILE} > ${MESHBUILDER_GZIP_MANFILE}
7 DEPENDS ${MESHBUILDER_MANFILE}
8 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
9 )
10
11add_custom_target(man ALL DEPENDS ${MESHBUILDER_GZIP_MANFILE}
12 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
13
14# install meshbuilder executable
15install(FILES ${MESHBUILDER_GZIP_MANFILE}
16 DESTINATION share/man/man1
17 COMPONENT RuntimeExecutables)
018
=== added directory 'doc/man'
=== added directory 'doc/man/man1'
=== added file 'doc/man/man1/meshbuilder.1'
--- doc/man/man1/meshbuilder.1 1970-01-01 00:00:00 +0000
+++ doc/man/man1/meshbuilder.1 2011-05-23 14:26:27 +0000
@@ -0,0 +1,19 @@
1.TH MESHBUILDER 1
2.SH NAME
3meshbuilder \- Mesh builder for DOLFIN
4.SH SYNOPSIS
5.B meshbuilder
6.SH DESCRIPTION
7MeshBuilder is a tool for building meshes for DOLFIN. With MeshBuilder
8you can set integer meshfunctions on DOLFIN meshes, on vertices, edges,
9and faces. These can be saved and loaded. You also use MeshBuilder to
10create screenshots and one can look at the boundary mesh of a mesh (or a
112D mesh directly). MeshBuilder is provided by FEniCS.
12.SH OPTIONS
13MeshBuilder does not offer command-line options of its own; at present
14one cannot open mesh files from the command-line. As a Qt application it
15supports Qt options; please see:
16
17http://doc.trolltech.com/4.2/qapplication.html#QApplication
18.SH AUTHOR
19This manual page was written by Johannes Ring <johannr@simula.no>.
020
=== removed file 'meshbuilder.pro'
--- meshbuilder.pro 2011-05-16 23:02:33 +0000
+++ meshbuilder.pro 1970-01-01 00:00:00 +0000
@@ -1,126 +0,0 @@
1# -*- makefile -*-
2
3TEMPLATE = app
4TARGET = meshbuilder
5
6OBJECTS_DIR = build
7MOC_DIR = build
8UI_DIR = build
9
10CONFIG += debug
11
12# The following look like a contradiction, but warn_on enables
13# strictwarnings (the -W option) as well, which leads to
14# a load of warnings from the Dolfin headers.
15CONFIG += warn_off
16QMAKE_CXXFLAGS += -Wall
17
18QT += opengl xml
19
20DEFINES += LINUX
21DEFINES += QT_CLEAN_NAMESPACE
22#DEFINES += QT_NO_DEBUG
23
24RESOURCES = resources.qrc
25
26# Main mode options.
27
28VER_MAJ = 0
29VER_MIN = 2
30VER_PAT = 0
31
32DEFINES += MB_VERSION_MAJOR=$$VER_MAJ
33DEFINES += MB_VERSION_MINOR=$$VER_MIN
34DEFINES += MB_VERSION_PATCH=$$VER_PAT
35
36FORMS = \
37 gui/ColorButton.ui \
38 gui/FloatSlider.ui \
39 gui/Colormap.ui \
40 gui/ApplicationWindow.ui
41
42HEADERS = \
43 base/ObjectState.h \
44 util/QtUtil.h \
45 util/SimResState.h \
46 osgQt/AdapterWidget.h \
47 osgQt/TrackballManipulator.h \
48 osgQt/RenderArea.h \
49 scenegraph/OsgTransformObject.h \
50 scenegraph/OsgDrawableObject.h \
51 scenegraph/OsgDrawableObjectConnector.h \
52 scenegraph/OsgMeshObject.h \
53 scenegraph/OsgDolfinObject.h \
54 gui/ColorButton.h \
55 gui/FloatSlider.h \
56 gui/Colormap.h \
57 gui/Context.h \
58 gui/MaterialSettings.h \
59 gui/TransformSettings.h \
60 gui/SimResSettings.h \
61 gui/DolfinEventHandler.h \
62 gui/Viewer.h \
63 gui/ApplicationWindow.h \
64 gui/Viewer_2D.h \
65 gui/Scene_2D.h \
66 gui/EntityInterface_2D.h \
67 gui/Vertex_2D.h \
68 gui/Edge_2D.h \
69 gui/Axes_2D.h \
70 gui/VisualizationDialog_2D.h \
71 gui/ViewerSettingsDialog.h \
72 gui/ClipPlanesDialog.h \
73 gui/TransformationsDialog.h \
74 gui/VisualizationDialog.h \
75 gui/DrawSettingsDialog.h \
76 gui/MeshFunctionsToolbar.h \
77 gui/ViewerInterface.h \
78 gui/DolfinObject.h
79
80SOURCES = \
81 util/QtUtil.cpp \
82 util/SimResState.cpp \
83 osgQt/AdapterWidget.cpp \
84 osgQt/TrackballManipulator.cpp \
85 osgQt/RenderArea.cpp \
86 scenegraph/OsgTransformObject.cpp \
87 scenegraph/OsgDrawableObject.cpp \
88 scenegraph/OsgMeshObject.cpp \
89 scenegraph/OsgDolfinObject.cpp \
90 gui/ColorButton.cpp \
91 gui/FloatSlider.cpp \
92 gui/Colormap.cpp \
93 gui/Context.cpp \
94 gui/MaterialSettings.cpp \
95 gui/TransformSettings.cpp \
96 gui/SimResSettings.cpp \
97 gui/DolfinEventHandler.cpp \
98 gui/Viewer.cpp \
99 gui/ApplicationWindow.cpp \
100 gui/Viewer_2D.cpp \
101 gui/Scene_2D.cpp \
102 gui/Vertex_2D.cpp \
103 gui/Edge_2D.cpp \
104 gui/Axes_2D.cpp \
105 gui/VisualizationDialog_2D.cpp \
106 gui/ViewerSettingsDialog.cpp \
107 gui/ClipPlanesDialog.cpp \
108 gui/TransformationsDialog.cpp \
109 gui/VisualizationDialog.cpp \
110 gui/DrawSettingsDialog.cpp \
111 gui/MeshFunctionsToolbar.cpp \
112 gui/DolfinObject.cpp \
113 main.cpp
114
115
116# Sub directories
117DEPENDPATH += base gui scenegraph util osgQt
118
119# Open scene graph flags
120QMAKE_CXXFLAGS += $$system(pkg-config --cflags openscenegraph)
121LIBS += $$system(pkg-config --libs openscenegraph)
122
123# DOLFIN flags
124QMAKE_CXXFLAGS += $$system(pkg-config --cflags dolfin)
125LIBS += $$system(pkg-config --libs dolfin)
126
1270
=== added directory 'src'
=== added file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/CMakeLists.txt 2011-05-23 14:26:27 +0000
@@ -0,0 +1,145 @@
1# set include directories
2include_directories(
3 ${CMAKE_CURRENT_SOURCE_DIR}
4 ${CMAKE_CURRENT_BINARY_DIR}
5 ${OPENSCENEGRAPH_INCLUDE_DIRS}
6 ${OPENGL_INCLUDE_DIR}
7 ${DOLFIN_INCLUDE_DIRS}
8 ${DOLFIN_3RD_PARTY_INCLUDE_DIRS}
9 )
10
11add_definitions(${DOLFIN_CXX_DEFINITIONS})
12
13# add Qt modules here, the include will setup QT_LIBRARIES
14set(QT_USE_QTOPENGL TRUE)
15set(QT_USE_QTXML TRUE)
16
17include(${QT_USE_FILE})
18
19# .cpp sources
20set(MESHBUILDER_SRCS_CXX
21 util/QtUtil.cpp
22 util/SimResState.cpp
23
24 osgQt/AdapterWidget.cpp
25 osgQt/TrackballManipulator.cpp
26 osgQt/RenderArea.cpp
27
28 scenegraph/OsgTransformObject.cpp
29 scenegraph/OsgDrawableObject.cpp
30 scenegraph/OsgMeshObject.cpp
31 scenegraph/OsgDolfinObject.cpp
32
33 gui/ColorButton.cpp
34 gui/FloatSlider.cpp
35 gui/Colormap.cpp
36 gui/Context.cpp
37 gui/MaterialSettings.cpp
38 gui/TransformSettings.cpp
39 gui/SimResSettings.cpp
40 gui/DolfinEventHandler.cpp
41 gui/Viewer.cpp
42 gui/ApplicationWindow.cpp
43 gui/Viewer_2D.cpp
44 gui/Scene_2D.cpp
45 gui/Vertex_2D.cpp
46 gui/Edge_2D.cpp
47 gui/Axes_2D.cpp
48 gui/VisualizationDialog_2D.cpp
49 gui/ViewerSettingsDialog.cpp
50 gui/ClipPlanesDialog.cpp
51 gui/TransformationsDialog.cpp
52 gui/VisualizationDialog.cpp
53 gui/DrawSettingsDialog.cpp
54 gui/MeshFunctionsToolbar.cpp
55 gui/DolfinObject.cpp
56
57 main.cpp
58 )
59
60# files which need to be moc'd by Qt
61set(MESHBUILDER_MOC_SRCS
62 #base/ObjectState.h
63
64 #util/QtUtil.h
65 util/SimResState.h
66
67 osgQt/AdapterWidget.h
68 #osgQt/TrackballManipulator.h
69 osgQt/RenderArea.h
70
71 #scenegraph/OsgTransformObject.h
72 #scenegraph/OsgDrawableObject.h
73 scenegraph/OsgDrawableObjectConnector.h
74 #scenegraph/OsgMeshObject.h
75 #scenegraph/OsgDolfinObject.h
76
77 gui/ColorButton.h
78 gui/FloatSlider.h
79 gui/Colormap.h
80 gui/Context.h
81 gui/MaterialSettings.h
82 gui/TransformSettings.h
83 gui/SimResSettings.h
84 #gui/DolfinEventHandler.h
85 gui/Viewer.h
86 gui/ApplicationWindow.h
87 gui/Viewer_2D.h
88 gui/Scene_2D.h
89 gui/EntityInterface_2D.h
90 #gui/Vertex_2D.h
91 #gui/Edge_2D.h
92 gui/Axes_2D.h
93 gui/VisualizationDialog_2D.h
94 gui/ViewerSettingsDialog.h
95 gui/ClipPlanesDialog.h
96 gui/TransformationsDialog.h
97 gui/VisualizationDialog.h
98 gui/DrawSettingsDialog.h
99 gui/MeshFunctionsToolbar.h
100 gui/ViewerInterface.h
101 gui/DolfinObject.h
102 )
103
104# ui files
105set(MESHBUILDER_UIS
106 gui/ColorButton.ui
107 gui/FloatSlider.ui
108 gui/Colormap.ui
109 gui/ApplicationWindow.ui
110 )
111
112# resource files
113set(MESHBUILDER_RCS
114 resources.qrc
115 )
116
117# build ui_XXX files from the XML-style .ui files
118qt4_wrap_ui(MESHBUILDER_SRCS_CXX ${MESHBUILDER_UIS})
119
120# this moc's the above variable and appends to the cpp sources
121qt4_wrap_cpp(MESHBUILDER_SRCS_CXX ${MESHBUILDER_MOC_SRCS})
122
123# this runs rcc on the resources and appends to the cpp sources
124qt4_add_resources(MESHBUILDER_SRCS_CXX ${MESHBUILDER_RCS})
125
126# create the meshbuilder executable
127if (UNIX)
128 add_executable(meshbuilder ${MESHBUILDER_SRCS_CXX})
129elseif (APPLE)
130 add_executable(meshbuilder MACOSX_BUNDLE ${MESHBUILDER_SRCS_CXX})
131elseif (WIN32)
132 add_executable(meshbuilder WIN32 ${MESHBUILDER_SRCS_CXX})
133endif()
134
135# link against required libraries
136target_link_libraries(meshbuilder
137 ${QT_LIBRARIES}
138 ${OPENSCENEGRAPH_LIBRARIES}
139 ${OPENGL_LIBRARIES}
140 ${DOLFIN_LIBRARIES}
141 ${DOLFIN_3RD_PARTY_LIBRARIES}
142 )
143
144# install meshbuilder executable
145install(TARGETS meshbuilder DESTINATION bin COMPONENT RuntimeExecutables)
0146
=== renamed directory 'base' => 'src/base'
=== renamed directory 'gui' => 'src/gui'
=== modified file 'src/gui/ApplicationWindow.cpp'
--- gui/ApplicationWindow.cpp 2011-02-11 05:51:14 +0000
+++ src/gui/ApplicationWindow.cpp 2011-05-23 14:26:27 +0000
@@ -5,7 +5,7 @@
5#include <gui/MeshFunctionsToolbar.h>5#include <gui/MeshFunctionsToolbar.h>
6#include <gui/ViewerInterface.h>6#include <gui/ViewerInterface.h>
77
8#include <build/ui_ApplicationWindow.h>8#include <ui_ApplicationWindow.h>
99
10#include <QFileDialog>10#include <QFileDialog>
11#include <QApplication>11#include <QApplication>
1212
=== modified file 'src/gui/ApplicationWindow.h'
--- gui/ApplicationWindow.h 2011-02-11 05:51:14 +0000
+++ src/gui/ApplicationWindow.h 2011-05-23 14:26:27 +0000
@@ -5,7 +5,7 @@
5#include <gui/Context.h>5#include <gui/Context.h>
6#include <gui/Viewer.h>6#include <gui/Viewer.h>
7#include <util/SimResState.h>7#include <util/SimResState.h>
8#include <build/ui_ApplicationWindow.h>8#include <ui_ApplicationWindow.h>
99
10#include <QMainWindow>10#include <QMainWindow>
1111
1212
=== modified file 'src/gui/ColorButton.cpp'
--- gui/ColorButton.cpp 2010-03-27 14:26:04 +0000
+++ src/gui/ColorButton.cpp 2011-05-23 14:26:27 +0000
@@ -1,5 +1,5 @@
1#include <gui/ColorButton.h>1#include <gui/ColorButton.h>
2#include <build/ui_ColorButton.h>2#include <ui_ColorButton.h>
33
4#include <QColorDialog>4#include <QColorDialog>
5#include <QPushButton>5#include <QPushButton>
66
=== modified file 'src/gui/Colormap.cpp'
--- gui/Colormap.cpp 2010-03-26 15:36:55 +0000
+++ src/gui/Colormap.cpp 2011-05-23 14:26:27 +0000
@@ -1,5 +1,5 @@
1#include <gui/Colormap.h>1#include <gui/Colormap.h>
2#include <build/ui_Colormap.h>2#include <ui_Colormap.h>
33
4#include <QColorDialog>4#include <QColorDialog>
55
66
=== modified file 'src/gui/FloatSlider.cpp'
--- gui/FloatSlider.cpp 2010-03-26 15:36:55 +0000
+++ src/gui/FloatSlider.cpp 2011-05-23 14:26:27 +0000
@@ -1,5 +1,5 @@
1#include <gui/FloatSlider.h>1#include <gui/FloatSlider.h>
2#include <build/ui_FloatSlider.h>2#include <ui_FloatSlider.h>
33
4#include <QSlider>4#include <QSlider>
5#include <QLineEdit>5#include <QLineEdit>
66
=== renamed file 'main.cpp' => 'src/main.cpp'
=== renamed directory 'osgQt' => 'src/osgQt'
=== renamed directory 'resources' => 'src/resources'
=== renamed file 'resources.qrc' => 'src/resources.qrc'
=== renamed directory 'scenegraph' => 'src/scenegraph'
=== renamed directory 'util' => 'src/util'

Subscribers

People subscribed via source and target branches