Skip to content

Commit e1d48ee

Browse files
committed
Initial public commit
0 parents  commit e1d48ee

File tree

710 files changed

+281980
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

710 files changed

+281980
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build*/
2+
*.cide

CMakeLists.txt

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
3+
cmake_policy(SET CMP0048 NEW)
4+
cmake_policy(SET CMP0054 NEW)
5+
cmake_policy(SET CMP0071 NEW)
6+
cmake_policy(SET CMP0074 NEW)
7+
8+
project(CIDE)
9+
10+
# Make CMake find the Find<Package>.cmake files in the cmake subdirectory.
11+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
12+
13+
set(CMAKE_CXX_STANDARD 11)
14+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
15+
16+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
17+
18+
19+
# --- Dependencies ---
20+
21+
# Cross-platform threading. See:
22+
# https://cmake.org/cmake/help/latest/module/FindThreads.html
23+
find_package(Threads REQUIRED)
24+
25+
# External dependency: libclang
26+
find_package(Clang REQUIRED)
27+
28+
# External dependency: Qt 5
29+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
30+
# Instruct CMake to run moc automatically when needed.
31+
set(CMAKE_AUTOMOC ON)
32+
# Instruct CMake to run rcc (resource compiler) automatically when needed.
33+
set(CMAKE_AUTORCC ON)
34+
find_package(Qt5 REQUIRED COMPONENTS Widgets Help Svg)
35+
36+
# External dependency: libgit2
37+
find_package(Libgit2 REQUIRED)
38+
39+
# Packaged dependency: YAML-CPP
40+
add_subdirectory(third_party/yaml-cpp-0.6.3)
41+
42+
# Packaged dependency: googletest
43+
add_subdirectory(third_party/googletest)
44+
set_target_properties(gtest gtest_main PROPERTIES FOLDER "third_party")
45+
46+
47+
# --- Git version tool ---
48+
49+
add_executable(GitVersionTool
50+
src/git_version_tool/main.cc
51+
)
52+
target_include_directories(GitVersionTool PUBLIC
53+
src
54+
${LIBGIT2_INCLUDE_DIR}
55+
)
56+
target_link_libraries(GitVersionTool
57+
${LIBGIT2_LIBRARIES}
58+
)
59+
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
60+
target_compile_options(GitVersionTool PUBLIC
61+
"$<$<COMPILE_LANGUAGE:CXX>:-Wall>"
62+
";$<$<COMPILE_LANGUAGE:CXX>:-Wextra>"
63+
";$<$<COMPILE_LANGUAGE:CXX>:-O2>"
64+
";$<$<COMPILE_LANGUAGE:CXX>:-msse2>"
65+
";$<$<COMPILE_LANGUAGE:CXX>:-msse3>"
66+
";$<$<COMPILE_LANGUAGE:CXX>:-Wno-sign-compare>"
67+
";$<$<COMPILE_LANGUAGE:CXX>:-Wno-strict-overflow>"
68+
)
69+
endif()
70+
target_compile_options(GitVersionTool PUBLIC
71+
${LIBGIT2_DEFINITIONS}
72+
)
73+
74+
75+
# --- CIDE base library, used by both the executable and the test ---
76+
77+
# NOTE:
78+
# Windows echo example: COMMAND ${CMAKE_COMMAND} -E echo "\#include <gtk/gtk.h>" > images.c
79+
# Linux echo example: COMMAND echo "\"""#include""<gtk/gtk.h>" "\"" > images.c
80+
81+
# Ugly workaround to force running this custom command on every build:
82+
# The idea is that the ${CMAKE_BINARY_DIR}/always_rebuild file should always be
83+
# missing, which is listed as a dependency here. However, for make (but not
84+
# ninja) it seems that we must generate this file here, otherwise the other file
85+
# listed as output, CIDE_git_version.h, will get deleted. So, this does not work
86+
# with make.
87+
add_custom_command(
88+
OUTPUT ${CMAKE_BINARY_DIR}/CIDE_git_version.h ${CMAKE_BINARY_DIR}/always_rebuild
89+
COMMAND ${CMAKE_BINARY_DIR}/GitVersionTool ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CIDE_git_version.h
90+
DEPENDS GitVersionTool
91+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
92+
)
93+
94+
add_library(CIDEBaseLib SHARED
95+
${CMAKE_BINARY_DIR}/CIDE_git_version.h
96+
97+
src/cide/about_dialog.cc
98+
src/cide/argument_hint_widget.cc
99+
src/cide/clang_highlighting.cc
100+
src/cide/clang_index.cc
101+
src/cide/clang_tu_pool.cc
102+
src/cide/clang_utils.cc
103+
src/cide/code_completion_widget.cc
104+
src/cide/code_info.cc
105+
src/cide/code_info_code_completion.cc
106+
src/cide/code_info_get_info.cc
107+
src/cide/code_info_get_right_click_info.cc
108+
src/cide/code_info_goto_referenced_cursor.cc
109+
src/cide/cpp_utils.cc
110+
src/cide/crash_backup.cc
111+
src/cide/create_class.cc
112+
src/cide/document.cc
113+
src/cide/document_range.cc
114+
src/cide/document_widget.cc
115+
src/cide/document_widget_container.cc
116+
src/cide/find_and_replace_in_files.cc
117+
src/cide/git_diff.cc
118+
src/cide/main_window.cc
119+
src/cide/new_project_dialog.cc
120+
src/cide/parse_thread_pool.cc
121+
src/cide/clang_parser.cc
122+
src/cide/problem.cc
123+
src/cide/project.cc
124+
src/cide/project_settings.cc
125+
src/cide/project_tree_view.cc
126+
src/cide/qt_help.cc
127+
src/cide/qt_thread.cc
128+
src/cide/rename_dialog.cc
129+
src/cide/run_gdb.cc
130+
src/cide/scroll_bar_minimap.cc
131+
src/cide/search_bar.cc
132+
src/cide/search_list_widget.cc
133+
src/cide/settings.cc
134+
src/cide/startup_dialog.cc
135+
src/cide/tab_bar.cc
136+
src/cide/text_block.cc
137+
src/cide/text_utils.cc
138+
src/cide/util.cc
139+
)
140+
target_include_directories(CIDEBaseLib PUBLIC
141+
src
142+
third_party/yaml-cpp-0.6.3/include
143+
${gtest_SOURCE_DIR}/include
144+
${CLANG_INCLUDE_DIRS}
145+
${LIBGIT2_INCLUDE_DIR}
146+
)
147+
target_link_libraries(CIDEBaseLib
148+
Qt5::Widgets
149+
Qt5::Help
150+
Qt5::Svg
151+
yaml-cpp
152+
${CLANG_CLANG_LIB}
153+
${LIBGIT2_LIBRARIES}
154+
Threads::Threads
155+
)
156+
if (NOT WIN32) # TODO: Is this dependent on windows, or on using clang?
157+
target_compile_options(CIDEBaseLib PUBLIC
158+
"$<$<COMPILE_LANGUAGE:CXX>:-Wall>"
159+
";$<$<COMPILE_LANGUAGE:CXX>:-Wextra>"
160+
)
161+
endif()
162+
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
163+
target_compile_options(CIDEBaseLib PUBLIC
164+
";$<$<COMPILE_LANGUAGE:CXX>:-O2>"
165+
";$<$<COMPILE_LANGUAGE:CXX>:-msse2>"
166+
";$<$<COMPILE_LANGUAGE:CXX>:-msse3>"
167+
";$<$<COMPILE_LANGUAGE:CXX>:-Wno-sign-compare>"
168+
";$<$<COMPILE_LANGUAGE:CXX>:-Wno-strict-overflow>"
169+
)
170+
endif()
171+
target_compile_options(CIDEBaseLib PUBLIC
172+
${LIBGIT2_DEFINITIONS}
173+
)
174+
175+
176+
# --- CIDE executable ---
177+
178+
add_executable(CIDE WIN32
179+
src/cide/main.cc
180+
resources_packed/resources.qrc
181+
)
182+
target_link_libraries(CIDE
183+
CIDEBaseLib
184+
)
185+
186+
file(
187+
COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources
188+
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
189+
)
190+
191+
192+
# --- CIDE Test executable ---
193+
194+
add_executable(CIDETest
195+
src/cide/test.cc
196+
)
197+
target_link_libraries(CIDETest
198+
CIDEBaseLib
199+
gtest
200+
)
201+
add_test(CIDETest
202+
CIDETest
203+
)

COPYING

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2020 Thomas Schöps
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice,
7+
this list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software
15+
without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)