Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenMesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
OpenMesh
Commits
32379e87
Commit
32379e87
authored
Dec 14, 2018
by
Jan Möbius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use QT MOC from cmake instead of own implementation
parent
3f52d242
Pipeline
#8097
failed with stage
in 10 minutes and 55 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
191 additions
and
200 deletions
+191
-200
cmake/ACGQt.cmake
cmake/ACGQt.cmake
+3
-45
src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt
src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt
+47
-54
src/OpenMesh/Apps/ProgViewer/CMakeLists.txt
src/OpenMesh/Apps/ProgViewer/CMakeLists.txt
+2
-9
src/OpenMesh/Apps/QtViewer/CMakeLists.txt
src/OpenMesh/Apps/QtViewer/CMakeLists.txt
+3
-13
src/OpenMesh/Apps/QtViewer/MeshViewerWidget.cc
src/OpenMesh/Apps/QtViewer/MeshViewerWidget.cc
+119
-0
src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh
src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh
+11
-57
src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh
src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh
+2
-4
src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt
src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt
+2
-9
src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt
src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt
+2
-9
No files found.
cmake/ACGQt.cmake
View file @
32379e87
...
...
@@ -144,50 +144,8 @@ macro (acg_qt5)
endif
()
endif
(
MSVC_IDE
)
endif
()
endmacro
()
# generate moc targets for sources in list
macro
(
acg_qt5_automoc moc_SRCS
)
qt5_get_moc_flags
(
_moc_INCS
)
list
(
REMOVE_DUPLICATES _moc_INCS
)
set
(
_matching_FILES
)
foreach
(
_current_FILE
${
ARGN
}
)
get_filename_component
(
_abs_FILE
${
_current_FILE
}
ABSOLUTE
)
# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
# here. this is required to make bouic work correctly:
# we need to add generated .cpp files to the sources (to compile them),
# but we cannot let automoc handle them, as the .cpp files don't exist yet when
# cmake is run for the very first time on them -> however the .cpp files might
# exist at a later run. at that time we need to skip them, so that we don't add two
# different rules for the same moc file
get_source_file_property
(
_skip
${
_abs_FILE
}
SKIP_AUTOMOC
)
if
(
NOT _skip AND EXISTS
${
_abs_FILE
}
)
# Enable automoc
set
(
CMAKE_AUTOMOC ON
)
file
(
READ
${
_abs_FILE
}
_contents
)
get_filename_component
(
_abs_PATH
${
_abs_FILE
}
PATH
)
string
(
REGEX MATCHALL
"Q_OBJECT"
_match
"
${
_contents
}
"
)
if
(
_match
)
get_filename_component
(
_basename
${
_current_FILE
}
NAME_WE
)
set
(
_header
${
_abs_FILE
}
)
set
(
_moc
${
CMAKE_CURRENT_BINARY_DIR
}
/moc_
${
_basename
}
.cpp
)
add_custom_command
(
OUTPUT
${
_moc
}
COMMAND
${
QT_MOC_EXECUTABLE
}
ARGS
${
_moc_INCS
}
${
_header
}
-o
${
_moc
}
DEPENDS
${
_header
}
)
add_file_dependencies
(
${
_abs_FILE
}
${
_moc
}
)
set
(
${
moc_SRCS
}
${${
moc_SRCS
}}
${
_moc
}
)
endif
()
endif
()
endforeach
()
endif
(
QT5_FOUND
)
endmacro
()
src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt
View file @
32379e87
include
(
ACGCommon
)
include_directories
(
../../../..
${
CMAKE_CURRENT_SOURCE_DIR
}
${
GLUT_INCLUDE_DIR
}
${
QT_INCLUDE_DIR
}
)
set
(
targetName DecimaterGui
)
# source code directories
set
(
directories
../../QtViewer
../
)
# collect all header and source files
acg_append_files
(
headers
"*.hh"
${
directories
}
)
set
(
sources
../../QtViewer/QGLViewerWidget.cc
../../QtViewer/MeshViewerWidgetT.cc
../DecimaterViewerWidget.cc
../decimaterviewer.cc
)
# remove template cc files from source file list
acg_drop_templates
(
sources
)
# genereate uic and moc targets
if
(
QT5_FOUND
)
acg_qt5_automoc
(
moc_targets
${
headers
}
)
else
()
acg_qt4_automoc
(
moc_targets
${
headers
}
)
endif
()
if
(
WIN32
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
${
moc_targets
}
)
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries
(
${
targetName
}
${
QT_QTMAIN_LIBRARY
}
)
else
()
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
${
moc_targets
}
)
endif
()
target_link_libraries
(
${
targetName
}
OpenMeshCore
OpenMeshTools
${
QT_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GLUT_LIBRARIES
}
)
include
(
ACGCommon
)
include_directories
(
../../../..
${
CMAKE_CURRENT_SOURCE_DIR
}
${
GLUT_INCLUDE_DIR
}
${
QT_INCLUDE_DIR
}
)
set
(
targetName DecimaterGui
)
# source code directories
set
(
directories
../../QtViewer
../
)
# collect all header and source files
acg_append_files
(
headers
"*.hh"
${
directories
}
)
set
(
sources
../../QtViewer/QGLViewerWidget.cc
../../QtViewer/MeshViewerWidgetT.cc
../DecimaterViewerWidget.cc
../decimaterviewer.cc
)
# remove template cc files from source file list
acg_drop_templates
(
sources
)
if
(
WIN32
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
)
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries
(
${
targetName
}
${
QT_QTMAIN_LIBRARY
}
)
else
()
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
)
endif
()
target_link_libraries
(
${
targetName
}
OpenMeshCore
OpenMeshTools
${
QT_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GLUT_LIBRARIES
}
)
src/OpenMesh/Apps/ProgViewer/CMakeLists.txt
View file @
32379e87
...
...
@@ -39,19 +39,12 @@ list (APPEND headers "../QtViewer/MeshViewerWidgetT.hh")
# remove template cc files from source file list
acg_drop_templates
(
sources
)
# genereate uic and moc targets
if
(
QT5_FOUND
)
acg_qt5_automoc
(
moc_targets
${
headers
}
)
else
()
acg_qt4_automoc
(
moc_targets
${
headers
}
)
endif
()
if
(
WIN32
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
${
moc_targets
}
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
)
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries
(
${
targetName
}
${
QT_QTMAIN_LIBRARY
}
)
else
()
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
${
moc_targets
}
)
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
)
endif
()
target_link_libraries
(
${
targetName
}
...
...
src/OpenMesh/Apps/QtViewer/CMakeLists.txt
View file @
32379e87
...
...
@@ -7,8 +7,6 @@ include_directories (
${
QT_INCLUDE_DIR
}
)
set
(
targetName QtViewer
)
# source code directories
set
(
directories
.
...
...
@@ -21,23 +19,15 @@ acg_append_files (sources "*.cc" ${directories})
# remove template cc files from source file list
acg_drop_templates
(
sources
)
# genereate uic and moc targets
if
(
QT5_FOUND
)
acg_qt5_automoc
(
moc_targets
${
headers
}
)
else
()
acg_qt4_automoc
(
moc_targets
${
headers
}
)
endif
()
if
(
WIN32
)
acg_add_executable
(
${
targetName
}
WIN32
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_target
s
}
)
acg_add_executable
(
QtViewer WIN32
${
sources
}
${
header
s
}
)
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries
(
${
targetName
}
${
QT_QTMAIN_LIBRARY
}
)
else
()
acg_add_executable
(
${
targetName
}
${
uic_targets
}
${
sources
}
${
headers
}
${
moc_target
s
}
)
acg_add_executable
(
QtViewer
${
sources
}
${
header
s
}
)
endif
()
target_link_libraries
(
${
targetName
}
target_link_libraries
(
QtViewer
OpenMeshCore
OpenMeshTools
${
QT_LIBRARIES
}
...
...
src/OpenMesh/Apps/QtViewer/MeshViewerWidget.cc
0 → 100644
View file @
32379e87
/* ========================================================================= *
* *
* OpenMesh *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenMesh. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= */
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* *
\*===========================================================================*/
#define OPENMESHAPPS_MESHVIEWERWIDGET_CC
//== INCLUDES =================================================================
#include <OpenMesh/Apps/QtViewer/MeshViewerWidget.hh>
//== IMPLEMENTATION ==========================================================
/// default constructor
MeshViewerWidget
::
MeshViewerWidget
(
QWidget
*
parent
)
:
MeshViewerWidgetT
<
MyMesh
>
(
parent
)
{}
void
MeshViewerWidget
::
open_mesh_gui
(
QString
fname
)
{
OpenMesh
::
Utils
::
Timer
t
;
t
.
start
();
if
(
fname
.
isEmpty
()
||
!
open_mesh
(
fname
.
toLocal8Bit
(),
_options
)
)
{
QString
msg
=
"Cannot read mesh from file:
\n
'"
;
msg
+=
fname
;
msg
+=
"'"
;
QMessageBox
::
critical
(
NULL
,
windowTitle
(),
msg
);
}
t
.
stop
();
std
::
cout
<<
"Loaded mesh in ~"
<<
t
.
as_string
()
<<
std
::
endl
;
}
void
MeshViewerWidget
::
open_texture_gui
(
QString
fname
)
{
if
(
fname
.
isEmpty
()
||
!
open_texture
(
fname
.
toLocal8Bit
()
)
)
{
QString
msg
=
"Cannot load texture image from file:
\n
'"
;
msg
+=
fname
;
msg
+=
"'
\n\n
Possible reasons:
\n
"
;
msg
+=
"- Mesh file didn't provide texture coordinates
\n
"
;
msg
+=
"- Texture file does not exist
\n
"
;
msg
+=
"- Texture file is not accessible.
\n
"
;
QMessageBox
::
warning
(
NULL
,
windowTitle
(),
msg
);
}
}
void
MeshViewerWidget
::
query_open_mesh_file
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open mesh file"
),
tr
(
""
),
tr
(
"OBJ Files (*.obj);;"
"OFF Files (*.off);;"
"STL Files (*.stl);;"
"All Files (*)"
));
if
(
!
fileName
.
isEmpty
())
open_mesh_gui
(
fileName
);
}
void
MeshViewerWidget
::
query_open_texture_file
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open texture file"
),
tr
(
""
),
tr
(
"PNG Files (*.png);;"
"BMP Files (*.bmp);;"
"GIF Files (*.gif);;"
"JPEG Files (*.jpg);;"
"TIFF Files (*.tif);;"
"All Files (*)"
));
if
(
!
fileName
.
isEmpty
())
open_texture_gui
(
fileName
);
}
//=============================================================================
src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh
View file @
32379e87
...
...
@@ -46,8 +46,7 @@
* *
\*===========================================================================*/
#ifndef OPENMESHAPPS_VIEWERWIDGET_HH
#define OPENMESHAPPS_VIEWERWIDGET_HH
#pragma once
//== INCLUDES =================================================================
...
...
@@ -55,6 +54,7 @@
#include <QString>
#include <QMessageBox>
#include <QFileDialog>
#include <iostream>
#include <OpenMesh/Tools/Utils/getopt.h>
#include <OpenMesh/Tools/Utils/Timer.hh>
#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
...
...
@@ -80,70 +80,24 @@ typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
class
MeshViewerWidget
:
public
MeshViewerWidgetT
<
MyMesh
>
{
Q_OBJECT
public:
/// default constructor
explicit
MeshViewerWidget
(
QWidget
*
parent
=
0
)
:
MeshViewerWidgetT
<
MyMesh
>
(
parent
)
{}
MeshViewerWidget
(
QWidget
*
parent
=
0
);
OpenMesh
::
IO
::
Options
&
options
()
{
return
_options
;
}
const
OpenMesh
::
IO
::
Options
&
options
()
const
{
return
_options
;
}
void
setOptions
(
const
OpenMesh
::
IO
::
Options
&
opts
)
{
_options
=
opts
;
}
void
open_mesh_gui
(
QString
fname
)
{
OpenMesh
::
Utils
::
Timer
t
;
t
.
start
();
if
(
fname
.
isEmpty
()
||
!
open_mesh
(
fname
.
toLocal8Bit
(),
_options
)
)
{
QString
msg
=
"Cannot read mesh from file:
\n
'"
;
msg
+=
fname
;
msg
+=
"'"
;
QMessageBox
::
critical
(
NULL
,
windowTitle
(),
msg
);
}
t
.
stop
();
std
::
cout
<<
"Loaded mesh in ~"
<<
t
.
as_string
()
<<
std
::
endl
;
}
void
open_texture_gui
(
QString
fname
)
{
if
(
fname
.
isEmpty
()
||
!
open_texture
(
fname
.
toLocal8Bit
()
)
)
{
QString
msg
=
"Cannot load texture image from file:
\n
'"
;
msg
+=
fname
;
msg
+=
"'
\n\n
Possible reasons:
\n
"
;
msg
+=
"- Mesh file didn't provide texture coordinates
\n
"
;
msg
+=
"- Texture file does not exist
\n
"
;
msg
+=
"- Texture file is not accessible.
\n
"
;
QMessageBox
::
warning
(
NULL
,
windowTitle
(),
msg
);
}
}
void
open_mesh_gui
(
QString
fname
);
void
open_texture_gui
(
QString
fname
);
public
slots
:
void
query_open_mesh_file
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open mesh file"
),
tr
(
""
),
tr
(
"OBJ Files (*.obj);;"
"OFF Files (*.off);;"
"STL Files (*.stl);;"
"All Files (*)"
));
if
(
!
fileName
.
isEmpty
())
open_mesh_gui
(
fileName
);
}
void
query_open_texture_file
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Open texture file"
),
tr
(
""
),
tr
(
"PNG Files (*.png);;"
"BMP Files (*.bmp);;"
"GIF Files (*.gif);;"
"JPEG Files (*.jpg);;"
"TIFF Files (*.tif);;"
"All Files (*)"
));
if
(
!
fileName
.
isEmpty
())
open_texture_gui
(
fileName
);
}
void
query_open_mesh_file
();
void
query_open_texture_file
();
private:
OpenMesh
::
IO
::
Options
_options
;
};
#endif
src/OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh
View file @
32379e87
...
...
@@ -47,8 +47,7 @@
\*===========================================================================*/
#ifndef OPENMESHAPPS_MESHVIEWERWIDGETT_HH
#define OPENMESHAPPS_MESHVIEWERWIDGETT_HH
#pragma once
//== INCLUDES =================================================================
...
...
@@ -75,6 +74,7 @@ class QImage;
template
<
typename
M
>
class
MeshViewerWidgetT
:
public
QGLViewerWidget
{
public:
typedef
M
Mesh
;
...
...
@@ -200,6 +200,4 @@ protected:
# include "MeshViewerWidgetT.cc"
#endif
//=============================================================================
#endif // OPENMESHAPPS_MESHVIEWERWIDGETT_HH defined
//=============================================================================
src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt
View file @
32379e87
...
...
@@ -28,19 +28,12 @@ set (sources
# remove template cc files from source file list
acg_drop_templates
(
sources
)
# genereate uic and moc targets
if
(
QT5_FOUND
)
acg_qt5_automoc
(
moc_targets
${
headers
}
)
else
()
acg_qt4_automoc
(
moc_targets
${
headers
}
)
endif
()
if
(
WIN32
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
${
moc_targets
}
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
)
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries
(
${
targetName
}
${
QT_QTMAIN_LIBRARY
}
)
else
()
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
${
moc_targets
}
)
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
)
endif
()
target_link_libraries
(
${
targetName
}
...
...
src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt
View file @
32379e87
...
...
@@ -22,19 +22,12 @@ list (APPEND headers "../../QtViewer/MeshViewerWidgetT.hh")
# remove template cc files from source file list
acg_drop_templates
(
sources
)
# genereate uic and moc targets
if
(
QT5_FOUND
)
acg_qt5_automoc
(
moc_targets
${
headers
}
)
else
()
acg_qt4_automoc
(
moc_targets
${
headers
}
)
endif
()
if
(
WIN32
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
${
moc_targets
}
)
acg_add_executable
(
${
targetName
}
WIN32
${
sources
}
${
headers
}
)
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries
(
${
targetName
}
${
QT_QTMAIN_LIBRARY
}
)
else
()
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
${
moc_targets
}
)
acg_add_executable
(
${
targetName
}
${
sources
}
${
headers
}
)
endif
()
target_link_libraries
(
${
targetName
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment