Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit 7e2b6a8

Browse files
committed
Merge branch 'master' of github.com:cppit/jucipp into python-refactor
2 parents 1cb806e + d315fa0 commit 7e2b6a8

16 files changed

Lines changed: 291 additions & 238 deletions

.gitmodules

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
branch = v1.0.3
55
[submodule "libclangmm"]
66
path = libclangmm
7-
url = https://github.com/cppit/libclangmm.git
7+
url = https://github.com/cppit/libclangmm
8+
branch = v0.9.5
89
[submodule "pybind11"]
910
path = pybind11
10-
url = https://github.com/pybind/pybind11.git
11+
url = https://github.com/pybind/pybind11.git

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
cmake_minimum_required (VERSION 2.8.4)
22

33
set(project_name juci)
4-
#set(module juci_to_python_api)
5-
6-
#set(lib_install_path "/usr/local/lib/python2.7/dist-packages/")
7-
84
project (${project_name})
95

106
add_subdirectory("src")

docs/install.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [Debian stable/Linux Mint Debian Edition](#debian-stablelinux-mint-debian-edition)
77
- [Arch Linux](#arch-linux)
88
- [Fedora 23](#fedora-23)
9+
- [Mageia 5](#mageia-5)
910
- OS X
1011
- [Homebrew](#os-x-with-homebrew-httpbrewsh)
1112
- Windows
@@ -89,6 +90,33 @@ make
8990
sudo make install
9091
```
9192

93+
## Mageia 5
94+
95+
**Mageia doesn't support LLDB, but you can compile without debug support.**
96+
97+
Install dependencies:
98+
99+
32-bit:
100+
101+
```sh
102+
sudo urpmi git cmake make gcc-c++ clang libclang-devel libboost-devel libgtkmm3.0-devel libgtksourceviewmm3.0-devel libaspell-devel aspell-en
103+
```
104+
105+
64-bit:
106+
```sh
107+
sudo urpmi git cmake make gcc-c++ clang lib64clang-devel lib64boost-devel lib64gtkmm3.0-devel lib64gtksourceviewmm3.0-devel lib64aspell-devel aspell-en
108+
```
109+
110+
Get juCi++ source, compile and install:
111+
```sh
112+
git clone --recursive https://github.com/cppit/jucipp
113+
mkdir jucipp/build
114+
cd jucipp/build
115+
cmake -DCMAKE_CXX_COMPILER=g++ ..
116+
make
117+
sudo make install
118+
```
119+
92120
## OS X with Homebrew (http://brew.sh/)
93121
**Installing llvm may take some time, and you need to follow the lldb code signing instructions. For an easier dependency install, but without debug support, remove `--with-lldb` below.**
94122

src/CMakeLists.txt

Lines changed: 66 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ if(MSYS)
2525
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMSYS_PROCESS_USE_SH")
2626
endif()
2727

28-
INCLUDE(FindPkgConfig)
29-
3028
find_package(LibClang REQUIRED)
29+
find_package(Boost 1.54 COMPONENTS thread log regex system filesystem REQUIRED)
30+
find_package(ASPELL REQUIRED)
31+
set(LIBCLANGMM_INCLUDE_DIR ../libclangmm/src)
32+
set(TINY_PROCESS_INCLUDE_DIR ../tiny-process-library)
33+
3134
string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}")
3235
if(EXISTS "${LIBLLDB_LIBRARIES}")
3336
set(LIBLLDB_FOUND TRUE)
@@ -41,129 +44,101 @@ else()
4144
set(LIBLLDB_LIBRARIES "")
4245
message("liblldb not found. Building juCi++ without debugging support")
4346
endif()
44-
#find_package(PythonLibs 2.7)
45-
46-
#find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED)
47-
find_package(Boost 1.54 COMPONENTS thread log system filesystem regex REQUIRED)
48-
49-
pkg_check_modules(GTKMM gtkmm-3.0 REQUIRED) # The name GTKMM is set here for the variables abouve
5047

48+
include(FindPkgConfig)
49+
pkg_check_modules(GTKMM gtkmm-3.0 REQUIRED)
5150
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0 REQUIRED)
5251

53-
find_package(ASPELL REQUIRED)
52+
set(global_includes
53+
${Boost_INCLUDE_DIRS}
54+
${GTKMM_INCLUDE_DIRS}
55+
${GTKSVMM_INCLUDE_DIRS}
56+
${LIBCLANG_INCLUDE_DIRS}
57+
${LIBCLANGMM_INCLUDE_DIR}
58+
${ASPELL_INCLUDE_DIR}
59+
${TINY_PROCESS_INCLUDE_DIR}
60+
)
5461

55-
set(source_files juci.h
56-
juci.cc
57-
menu.h
58-
menu.cc
59-
source.h
60-
source.cc
61-
source_clang.h
62-
source_clang.cc
63-
selectiondialog.h
64-
selectiondialog.cc
65-
config.h
62+
set(global_libraries
63+
${LIBCLANG_LIBRARIES}
64+
${GTKMM_LIBRARIES}
65+
${GTKSVMM_LIBRARIES}
66+
${Boost_LIBRARIES}
67+
${ASPELL_LIBRARIES}
68+
${LIBLLDB_LIBRARIES}
69+
)
70+
71+
set(project_files
72+
cmake.cc
73+
cmake.h
6674
config.cc
67-
filesystem.h
68-
filesystem.cc
69-
window.cc
70-
window.h
75+
config.h
76+
dialogs.cc
7177
dialogs.h
72-
# api.h
73-
# api.cc
78+
directories.cc
79+
directories.h
80+
dispatcher.cc
81+
dispatcher.h
82+
entrybox.cc
83+
entrybox.h
84+
files.h
85+
filesystem.cc
86+
filesystem.h
87+
juci.cc
88+
juci.h
89+
logging.h
90+
menu.cc
91+
menu.h
7492
notebook.cc
7593
notebook.h
76-
entrybox.h
77-
entrybox.cc
78-
directories.h
79-
directories.cc
80-
terminal.h
81-
terminal.cc
82-
tooltips.h
83-
tooltips.cc
84-
cmake.h
85-
cmake.cc
86-
dialogs.cc
87-
project.h
8894
project.cc
95+
project.h
8996
project_build.h
9097
project_build.cc
91-
dispatcher.h
92-
dispatcher.cc
93-
98+
selectiondialog.cc
99+
selectiondialog.h
100+
source.cc
101+
source.h
102+
source_clang.cc
103+
source_clang.h
104+
terminal.cc
105+
terminal.h
106+
tooltips.cc
107+
tooltips.h
108+
window.cc
109+
window.h
110+
94111
../libclangmm/src/CodeCompleteResults.cc
95112
../libclangmm/src/CompilationDatabase.cc
96113
../libclangmm/src/CompileCommand.cc
97114
../libclangmm/src/CompileCommands.cc
98115
../libclangmm/src/CompletionString.cc
99116
../libclangmm/src/Cursor.cc
117+
../libclangmm/src/Diagnostic.cc
100118
../libclangmm/src/Index.cc
101119
../libclangmm/src/SourceLocation.cc
102120
../libclangmm/src/SourceRange.cc
103121
../libclangmm/src/Token.cc
104122
../libclangmm/src/Tokens.cc
105123
../libclangmm/src/TranslationUnit.cc
106-
../libclangmm/src/Diagnostic.cc
107124
../libclangmm/src/Utility.cc
108-
125+
109126
../tiny-process-library/process.cpp)
110127

111128
if(LIBLLDB_FOUND)
112-
list(APPEND source_files debug_clang.h debug_clang.cc)
129+
list(APPEND project_files debug_clang.h debug_clang.cc)
113130
endif()
114131

115132
if(MSYS)
116-
list(APPEND source_files dialogs_unix.cc) #dialogs_win.cc does not work any more because of missing SHCreateItemFromParsingName
117-
list(APPEND source_files ../tiny-process-library/process_win.cpp)
133+
list(APPEND project_files dialogs_unix.cc ../tiny-process-library/process_win.cpp)
118134
else()
119-
list(APPEND source_files dialogs_unix.cc)
120-
list(APPEND source_files ../tiny-process-library/process_unix.cpp)
135+
list(APPEND project_files dialogs_unix.cc ../tiny-process-library/process_unix.cpp)
121136
endif()
122137

123-
add_executable(${project_name} ${source_files})
124-
125-
# add_library(${module} SHARED
126-
# api
127-
# api_ext)
128-
129-
include_directories(
130-
${Boost_INCLUDE_DIRS}
131-
# ${PYTHON_INCLUDE_DIRS}
132-
${GTKMM_INCLUDE_DIRS}
133-
${GTKSVMM_INCLUDE_DIRS}
134-
${LIBCLANG_INCLUDE_DIRS}
135-
${ASPELL_INCLUDE_DIR}
136-
../libclangmm/src
137-
../tiny-process-library
138-
)
139-
140-
link_directories(
141-
${GTKMM_LIBRARY_DIRS}
142-
${GTKSVMM_LIBRARY_DIRS}
143-
${Boost_LIBRARY_DIRS}
144-
# ${PYTHON_INCLUDE_DIRS}
145-
${LIBCLANG_LIBRARY_DIRS}
146-
)
147-
148-
# set_target_properties(${module}
149-
# PROPERTIES PREFIX ""
150-
# LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/")
151-
152-
# target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
153-
# target_link_libraries(${module} ${Boost_LIBRARIES})
154-
155-
target_link_libraries(${project_name}
156-
${LIBCLANG_LIBRARIES}
157-
${GTKMM_LIBRARIES}
158-
${GTKSVMM_LIBRARIES}
159-
${Boost_LIBRARIES}
160-
${ASPELL_LIBRARIES}
161-
${LIBLLDB_LIBRARIES}
162-
#${PYTHON_LIBRARIES}
163-
)
138+
include_directories(${global_includes})
139+
add_executable(${project_name} ${project_files})
140+
target_link_libraries(${project_name} ${global_libraries})
164141

165-
# install(TARGETS ${project_name} ${module}
166142
install(TARGETS ${project_name}
167143
RUNTIME DESTINATION bin
168-
# LIBRARY DESTINATION ${lib_install_path}
169144
)

src/config.cc

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,22 @@ void Config::retrieve_config() {
9494
window.version = cfg.get<std::string>("version");
9595
window.default_size = {cfg.get<int>("default_window_size.width"), cfg.get<int>("default_window_size.height")};
9696

97-
project.save_on_compile_or_run=cfg.get<bool>("project.save_on_compile_or_run");
9897
project.default_build_path=cfg.get<std::string>("project.default_build_path");
9998
project.debug_build_path=cfg.get<std::string>("project.debug_build_path");
10099
project.make_command=cfg.get<std::string>("project.make_command");
101100
project.cmake_command=cfg.get<std::string>("project.cmake_command");
101+
project.save_on_compile_or_run=cfg.get<bool>("project.save_on_compile_or_run");
102+
project.clear_terminal_on_compile=cfg.get<bool>("project.clear_terminal_on_compile");
102103

103-
terminal.history_size=cfg.get<int>("terminal_history_size");
104+
terminal.history_size=cfg.get<int>("terminal.history_size");
105+
terminal.font=cfg.get<std::string>("terminal.font");
104106
terminal.clang_format_command="clang-format";
105107
#ifdef __linux
106108
if(terminal.clang_format_command=="clang-format" &&
107109
!boost::filesystem::exists("/usr/bin/clang-format") && !boost::filesystem::exists("/usr/local/bin/clang-format")) {
108-
if(boost::filesystem::exists("/usr/bin/clang-format-3.7"))
110+
if(boost::filesystem::exists("/usr/bin/clang-format-3.8"))
111+
terminal.clang_format_command="/usr/bin/clang-format-3.8";
112+
else if(boost::filesystem::exists("/usr/bin/clang-format-3.7"))
109113
terminal.clang_format_command="/usr/bin/clang-format-3.7";
110114
else if(boost::filesystem::exists("/usr/bin/clang-format-3.6"))
111115
terminal.clang_format_command="/usr/bin/clang-format-3.6";
@@ -115,26 +119,40 @@ void Config::retrieve_config() {
115119
#endif
116120
}
117121

118-
bool Config::check_config_file(const boost::property_tree::ptree &default_cfg, std::string parent_path) {
122+
bool Config::add_missing_nodes(const boost::property_tree::ptree &default_cfg, std::string parent_path) {
119123
if(parent_path.size()>0)
120124
parent_path+=".";
121-
bool exists=true;
125+
bool unchanged=true;
122126
for(auto &node: default_cfg) {
123127
auto path=parent_path+node.first;
124128
try {
125129
cfg.get<std::string>(path);
126130
}
127131
catch(const std::exception &e) {
128132
cfg.add(path, node.second.data());
129-
exists=false;
133+
unchanged=false;
130134
}
135+
unchanged&=add_missing_nodes(node.second, path);
136+
}
137+
return unchanged;
138+
}
139+
140+
bool Config::remove_deprecated_nodes(const boost::property_tree::ptree &default_cfg, boost::property_tree::ptree &config_cfg, std::string parent_path) {
141+
if(parent_path.size()>0)
142+
parent_path+=".";
143+
bool unchanged=true;
144+
for(auto &node: config_cfg) {
145+
auto path=parent_path+node.first;
131146
try {
132-
exists&=check_config_file(node.second, path);
147+
default_cfg.get<std::string>(path);
148+
unchanged&=remove_deprecated_nodes(default_cfg, node.second, path);
133149
}
134150
catch(const std::exception &e) {
151+
config_cfg.erase(node.first);
152+
unchanged=false;
135153
}
136154
}
137-
return exists;
155+
return unchanged;
138156
}
139157

140158
void Config::update_config_file() {
@@ -156,10 +174,10 @@ void Config::update_config_file() {
156174
std::cerr << "Error reading json-file: " << e.what() << std::endl;
157175
cfg_ok=false;
158176
}
159-
cfg_ok&=check_config_file(default_cfg);
160-
if(!cfg_ok) {
177+
cfg_ok&=add_missing_nodes(default_cfg);
178+
cfg_ok&=remove_deprecated_nodes(default_cfg, cfg);
179+
if(!cfg_ok)
161180
boost::property_tree::write_json((home/"config"/"config.json").string(), cfg);
162-
}
163181
}
164182

165183
void Config::get_source() {

src/config.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Config {
2626
public:
2727
std::string clang_format_command;
2828
int history_size;
29+
std::string font;
2930

3031
#ifdef _WIN32
3132
boost::filesystem::path msys2_mingw_path;
@@ -39,6 +40,7 @@ class Config {
3940
std::string cmake_command;
4041
std::string make_command;
4142
bool save_on_compile_or_run;
43+
bool clear_terminal_on_compile;
4244
};
4345

4446
class Source {
@@ -90,7 +92,8 @@ class Config {
9092
private:
9193
void find_or_create_config_files();
9294
void retrieve_config();
93-
bool check_config_file(const boost::property_tree::ptree &default_cfg, std::string parent_path="");
95+
bool add_missing_nodes(const boost::property_tree::ptree &default_cfg, std::string parent_path="");
96+
bool remove_deprecated_nodes(const boost::property_tree::ptree &default_cfg, boost::property_tree::ptree &config_cfg, std::string parent_path="");
9497
void update_config_file();
9598
void get_source();
9699

0 commit comments

Comments
 (0)