Browse Source

Got rid of absolute build path variables in MSYS2. juCi++ can now safely be installed through a MSYS2 package

merge-requests/365/head
U-olece-PC\olece 10 years ago
parent
commit
93b226c642
  1. 2
      docs/install.md
  2. 4
      src/CMakeLists.txt
  3. 8
      src/config.cc
  4. 4
      src/config.h
  5. 2
      src/files.h
  6. 5
      src/source_clang.cc

2
docs/install.md

@ -86,7 +86,7 @@ make install
```
##Windows with MSYS2 (https://msys2.github.io/)
**MSYS2 does not yet support lldb, but you can still compile juCi++ without debug support. Also for the time being, MSYS2 must be installed in the default MSYS2 folder (C:\msys64 or C:\msys32).**
**MSYS2 does not yet support lldb, but you can still compile juCi++ without debug support.**
Note that juCi++ must be run in a MinGW Shell (for instance MinGW-w64 Win64 Shell).

4
src/CMakeLists.txt

@ -21,10 +21,6 @@ if(UNIX) #Checking if compiling on Ubuntu that has a buggy menu system
endif()
endif()
if(MSYS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMSYS_PROCESS_USE_SH -DJUCI_CMAKE_INSTALL_PREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"")
endif()
INCLUDE(FindPkgConfig)
find_package(LibClang REQUIRED)

8
src/config.cc

@ -5,6 +5,7 @@
#include <iostream>
#include "filesystem.h"
#include "terminal.h"
#include <algorithm>
Config::Config() {
std::vector<std::string> environment_variables = {"JUCI_HOME", "HOME", "AppData"};
@ -25,6 +26,13 @@ Config::Config() {
searched_envs+="]";
throw std::runtime_error("One of these environment variables needs to point to a writable directory to save configuration: " + searched_envs);
}
#ifdef _WIN32
terminal.msys2_mingw_path=boost::filesystem::path(std::getenv("WD")).parent_path().parent_path().parent_path();
std::string msystem=std::getenv("MSYSTEM");
std::transform(msystem.begin(), msystem.end(), msystem.begin(), ::tolower);
terminal.msys2_mingw_path/=msystem;
#endif
}
void Config::load() {

4
src/config.h

@ -26,6 +26,10 @@ public:
public:
std::string clang_format_command;
int history_size;
#ifdef _WIN32
boost::filesystem::path msys2_mingw_path;
#endif
};
class Project {

2
src/files.h

@ -125,7 +125,7 @@ const std::string configjson =
" \"debug_build_path_comment\": \"Use <project_directory_name> to insert the project top level directory name, and <default_build_path> to insert your default_build_path setting.\",\n"
" \"debug_build_path\": \"<default_build_path>/debug\",\n"
#ifdef _WIN32
" \"cmake_command\": \"cmake -G\\\"MSYS Makefiles\\\" -DCMAKE_INSTALL_PREFIX="+JUCI_CMAKE_INSTALL_PREFIX+"\",\n"
" \"cmake_command\": \"cmake -G\\\"MSYS Makefiles\\\"\",\n"
#else
" \"cmake_command\": \"cmake\",\n"
#endif

5
src/source_clang.cc

@ -200,10 +200,7 @@ std::vector<std::string> Source::ClangViewParse::get_compilation_commands() {
arguments.emplace_back("-I/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1"); //Added for OS X 10.11
#endif
#ifdef _WIN32
arguments.emplace_back("-IC:/msys32/mingw32/lib/clang/"+clang_version+"/include");
arguments.emplace_back("-IC:/msys32/mingw64/lib/clang/"+clang_version+"/include");
arguments.emplace_back("-IC:/msys64/mingw32/lib/clang/"+clang_version+"/include");
arguments.emplace_back("-IC:/msys64/mingw64/lib/clang/"+clang_version+"/include");
arguments.emplace_back("-I"+(Config::get().terminal.msys2_mingw_path/"lib/clang"/clang_version/"include").string());
#endif
}
arguments.emplace_back("-fretain-comments-from-system-headers");

Loading…
Cancel
Save