Skip to content

Commit d74eb14

Browse files
committed
Merge branch 'working' into 'master'
Added win32 installer See merge request !19
2 parents bc17898 + 0d98fde commit d74eb14

File tree

9 files changed

+217
-10
lines changed

9 files changed

+217
-10
lines changed

CMakeLists.txt

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ find_package(Threads)
2121
# find libclang
2222
find_library(LIBCLANG_LIBRARY NAMES clang libclang HINTS ${LIBCLANG_PREFIX})
2323
find_path(LIBCLANG_HEADER clang-c/Index.h HINTS ${LIBCLANG_PREFIX})
24+
find_file(LIBCLANG_DLL libclang.dll HINTS ${LIBCLANG_PREFIX}/bin)
2425

2526
if (NOT LIBCLANG_LIBRARY OR NOT LIBCLANG_HEADER)
2627
message(FATAL_ERROR "Cannot find libclang!")
@@ -41,8 +42,10 @@ elseif (MSVC)
4142
endif()
4243
include_directories(${Boost_INCLUDE_DIRS} ${LIBCLANG_HEADER})
4344

44-
if (WIN32)
45+
# look like mingw doesn't need this either
46+
if (MSVC)
4547
set(GUI_TYPE WIN32)
48+
set(RC_FILE resources/spaghetti.rc)
4649
endif()
4750

4851
# get build date
@@ -68,8 +71,9 @@ add_library(spag ${LIBCLANGXX_FILES} ${CODEBASE_FILES} ${PROJECT_FILES} ${UTIL_F
6871
target_link_libraries(spag ${LIBCLANG_LIBRARY} ${Boost_LIBRARIES} Qt5::Core)
6972

7073
file(GLOB GUI_FILES gui/*.hh gui/*.cc gui/*/*.cc gui/*/*.hh gui/spaghetti.qrc)
71-
add_executable(spaghetti-gui ${GUI_TYPE} ${GUI_FILES})
74+
add_executable(spaghetti-gui ${GUI_TYPE} ${GUI_FILES} ${RC_FILE})
7275
target_link_libraries(spaghetti-gui spag Qt5::Widgets ${CMAKE_THREAD_LIBS_INIT})
76+
install(TARGETS spaghetti-gui RUNTIME DESTINATION bin)
7377

7478
if (GTEST_FOUND)
7579
include_directories(${GTEST_INCLUDE_DIRS})
@@ -79,3 +83,64 @@ if (GTEST_FOUND)
7983
add_executable(unittest ${TEST_FILES})
8084
target_link_libraries(unittest ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} spag)
8185
endif(GTEST_FOUND)
86+
87+
if (LINUX)
88+
set(CPACK_GENERATOR "RPM")
89+
elseif(WIN32)
90+
91+
# NSIS specific settings
92+
set(CPACK_GENERATOR "NSIS")
93+
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/fork.ico")
94+
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/resources/fork.ico")
95+
96+
# install dependent libraries
97+
install(FILES ${LIBCLANG_DLL} DESTINATION bin)
98+
99+
get_target_property(QtCore_location_Release Qt5::Core LOCATION_Release)
100+
get_filename_component(QT_BINARY_DIR "${QtCore_location_Release}" DIRECTORY)
101+
102+
message(STATUS "qt is at ${QT_BINARY_DIR}")
103+
104+
install(FILES
105+
${QT_BINARY_DIR}/Qt5Core.dll
106+
${QT_BINARY_DIR}/Qt5Widgets.dll
107+
${QT_BINARY_DIR}/Qt5Gui.dll
108+
${QT_BINARY_DIR}/d3dcompiler_47.dll
109+
${QT_BINARY_DIR}/libEGL.dll
110+
${QT_BINARY_DIR}/libGLESV2.dll
111+
${QT_BINARY_DIR}/opengl32sw.dll
112+
113+
DESTINATION bin
114+
)
115+
set(QT_PLUGINS_DIR "${QT_BINARY_DIR}/../plugins")
116+
install(FILES
117+
${QT_PLUGINS_DIR}/iconengines/qsvgicon.dll
118+
DESTINATION bin/iconengines
119+
)
120+
install(FILES
121+
${QT_PLUGINS_DIR}/platforms/qwindows.dll
122+
DESTINATION bin/platforms
123+
)
124+
install(FILES
125+
${QT_PLUGINS_DIR}/imageformats/qdds.dll
126+
${QT_PLUGINS_DIR}/imageformats/qgif.dll
127+
${QT_PLUGINS_DIR}/imageformats/qicns.dll
128+
${QT_PLUGINS_DIR}/imageformats/qico.dll
129+
${QT_PLUGINS_DIR}/imageformats/qjpeg.dll
130+
${QT_PLUGINS_DIR}/imageformats/qsvg.dll
131+
${QT_PLUGINS_DIR}/imageformats/qtga.dll
132+
${QT_PLUGINS_DIR}/imageformats/qtiff.dll
133+
${QT_PLUGINS_DIR}/imageformats/qwbmp.dll
134+
${QT_PLUGINS_DIR}/imageformats/qwebp.dll
135+
DESTINATION bin/imageformats
136+
)
137+
endif()
138+
139+
set(CPACK_PACKAGE_EXECUTABLES "spaghetti-gui" "Spaghetti: source code analyzer")
140+
set(CPACK_PACKAGE_NAME "spaghetti-gui")
141+
set(CPACK_PACKAGE_VENDOR "nestal.net")
142+
set(CPACK_PACKAGE_VERSION_MAJOR "0")
143+
set(CPACK_PACKAGE_VERSION_MINOR "1")
144+
set(CPACK_PACKAGE_VERSION_PATCH "0")
145+
146+
INCLUDE(CPack)

codebase/test/EntityVecTest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class TestEntityVec : public EntityVec
2222
{
2323
public:
2424
using EntityVec::EntityVec;
25-
void RemoveUnused() override {}
2625
std::string Type() const override {return {};}
26+
void CrossReference(EntityMap *) override {}
2727
};
2828

2929
TEST(EntityVecTest, Constructor_Wont_Throw)

codebase/test/MockEntity.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ bool MockEntity::IsUsed() const
3636
return true;
3737
}
3838

39-
void MockEntity::RemoveUnused()
39+
void MockEntity::MarkUsed()
4040
{
4141
}
42-
42+
43+
void MockEntity::CrossReference(EntityMap *map)
44+
{
45+
LeafEntity::CrossReference(map);
46+
}
47+
4348
}} // end of namespace

codebase/test/MockEntity.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public:
2727
std::size_t Index() const;
2828

2929
bool IsUsed() const override;
30-
void RemoveUnused() override;
30+
void MarkUsed() override;
31+
void CrossReference(EntityMap *map) override;
3132

3233
private:
3334
std::size_t m_index{};

gui/AboutBox.ui

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>708</width>
10-
<height>335</height>
9+
<width>900</width>
10+
<height>402</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -37,11 +37,41 @@
3737
<item>
3838
<widget class="QLabel" name="m_about">
3939
<property name="text">
40-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Spaghetti: version%1 (%2)&lt;/p&gt;&lt;p&gt;A tool to quickly understand source code.&lt;/p&gt;&lt;p&gt;(C) 2017 Wan Wai Ho (Nestal), Siu Wan&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://gitlab.com/nestal/spaghetti&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;https://gitlab.com/nestal/spaghetti&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;License: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;GNU General Public License Version 2&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
40+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Spaghetti: version %1 (%2)&lt;/p&gt;&lt;p&gt;A tool to quickly understand spaghetti source code.&lt;/p&gt;&lt;p&gt;(C) 2017 Wan Wai Ho (Nestal), Siu Wan&lt;/p&gt;&lt;p&gt;If you have comments, find a bug or want to request a feature, please visit the project homepage: &lt;a href=&quot;https://gitlab.com/nestal/spaghetti&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;https://gitlab.com/nestal/spaghetti&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Licensed under &lt;a href=&quot;https://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;GNU General Public License Version 2&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
4141
</property>
4242
<property name="textFormat">
4343
<enum>Qt::RichText</enum>
4444
</property>
45+
<property name="wordWrap">
46+
<bool>true</bool>
47+
</property>
48+
</widget>
49+
</item>
50+
</layout>
51+
</widget>
52+
<widget class="QWidget" name="tab_3">
53+
<attribute name="title">
54+
<string>License</string>
55+
</attribute>
56+
<layout class="QHBoxLayout" name="horizontalLayout">
57+
<item>
58+
<widget class="QTextEdit" name="textEdit">
59+
<property name="documentTitle">
60+
<string>License</string>
61+
</property>
62+
<property name="readOnly">
63+
<bool>true</bool>
64+
</property>
65+
<property name="html">
66+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
67+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;title&gt;License&lt;/title&gt;&lt;style type=&quot;text/css&quot;&gt;
68+
p, li { white-space: pre-wrap; }
69+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:16pt; font-weight:400; font-style:normal;&quot;&gt;
70+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;GNU General Public License Version 2&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
71+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; version 2of the License.&lt;/p&gt;
72+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.&lt;/p&gt;
73+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
74+
</property>
4575
</widget>
4676
</item>
4777
</layout>

gui/MainWnd.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797
<addaction name="menu_File"/>
9898
<addaction name="menu_Edit"/>
9999
<addaction name="menu_Project"/>
100-
<addaction name="menu_Help"/>
101100
<addaction name="menu_Windows"/>
101+
<addaction name="menu_Help"/>
102102
</widget>
103103
<widget class="QStatusBar" name="statusbar"/>
104104
<widget class="QDockWidget" name="m_logical_dock">

resources/fork.ico

145 KB
Binary file not shown.

resources/resource.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//{{NO_DEPENDENCIES}}
2+
// Microsoft Visual C++ generated include file.
3+
// Used by spaghetti.rc
4+
//
5+
6+
// Next default values for new objects
7+
//
8+
#ifdef APSTUDIO_INVOKED
9+
#ifndef APSTUDIO_READONLY_SYMBOLS
10+
#define _APS_NEXT_RESOURCE_VALUE 101
11+
#define _APS_NEXT_COMMAND_VALUE 40001
12+
#define _APS_NEXT_CONTROL_VALUE 1000
13+
#define _APS_NEXT_SYMED_VALUE 101
14+
#endif
15+
#endif

resources/spaghetti.rc

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
/////////////////////////////////////////////////////////////////////////////
5+
// English (United States) resources
6+
7+
/////////////////////////////////////////////////////////////////////////////
8+
//
9+
// Icon
10+
//
11+
12+
// Icon with lowest ID value placed first to ensure application icon
13+
// remains consistent on all systems.
14+
IDI_ICON1 ICON "fork.ico"
15+
16+
17+
#ifdef APSTUDIO_INVOKED
18+
/////////////////////////////////////////////////////////////////////////////
19+
//
20+
// TEXTINCLUDE
21+
//
22+
23+
1 TEXTINCLUDE
24+
BEGIN
25+
"resource.h\0"
26+
END
27+
28+
2 TEXTINCLUDE
29+
BEGIN
30+
"\0"
31+
END
32+
33+
3 TEXTINCLUDE
34+
BEGIN
35+
"\r\n"
36+
"\0"
37+
END
38+
39+
#endif // APSTUDIO_INVOKED
40+
41+
42+
/////////////////////////////////////////////////////////////////////////////
43+
//
44+
// Version
45+
//
46+
47+
VS_VERSION_INFO VERSIONINFO
48+
FILEVERSION 1,0,0,1
49+
PRODUCTVERSION 1,0,0,1
50+
FILEFLAGSMASK 0x3fL
51+
#ifdef _DEBUG
52+
FILEFLAGS 0x1L
53+
#else
54+
FILEFLAGS 0x0L
55+
#endif
56+
FILEOS 0x40004L
57+
FILETYPE 0x0L
58+
FILESUBTYPE 0x0L
59+
BEGIN
60+
BLOCK "StringFileInfo"
61+
BEGIN
62+
BLOCK "040904b0"
63+
BEGIN
64+
VALUE "CompanyName", "nestal.net"
65+
VALUE "FileDescription", "Spaghetti: a tool to quickly understand spaghetti code"
66+
VALUE "FileVersion", "0.0.0.1"
67+
VALUE "InternalName", "spaghetti.rc"
68+
VALUE "LegalCopyright", "Copyright (C) 2017"
69+
VALUE "OriginalFilename", "spaghetti.rc"
70+
VALUE "ProductName", "Spaghetti"
71+
VALUE "ProductVersion", "0.0.0.1"
72+
END
73+
END
74+
BLOCK "VarFileInfo"
75+
BEGIN
76+
VALUE "Translation", 0x409, 1200
77+
END
78+
END
79+
80+
81+
82+
#ifndef APSTUDIO_INVOKED
83+
/////////////////////////////////////////////////////////////////////////////
84+
//
85+
// Generated from the TEXTINCLUDE 3 resource.
86+
//
87+
88+
89+
/////////////////////////////////////////////////////////////////////////////
90+
#endif // not APSTUDIO_INVOKED
91+

0 commit comments

Comments
 (0)