dotBunny / CLionSourceCodeAccess

A CLion Plugin for Unreal Engine
138 stars 26 forks source link

4.19 usage on windows #99

Open SkaveRat opened 6 years ago

SkaveRat commented 6 years ago

How should I set up the integration on windows?

I've migrated a project from .18 to .19 and changed the editor in the settings.

There is no CMakeList generation anymore, which causes the current file to reference old .18 paths. Replacing all .18 path with .19 doesn't seem to work, at it can't find the Intermediate/ProjectFiles/ files anymore.

Recompiling inside the editor didn't anything, so I'm not really sure what to do next. Any ideas?

TomCoursow commented 6 years ago

Same here... I can click Generate CMake Project after selecting CLion as Code Editor in the Settings but there is no File generated...

I saw that the UE4 Repo has some Pull Requests to fix these issues but they are not yet accepted right now. https://github.com/EpicGames/UnrealEngine/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+clion

reapazor commented 6 years ago

So there is a bug 'higher up' in UE that was introduced in 4.19 that doesnt allow non native source code accessors to be used properly (so vs on windows, xcode on mac). This has bee resolved in source builds, just gotta hold tight unfortunately till it is released.

SkaveRat commented 6 years ago

Any workarounds until the 4.19.2 release?

SkaveRat commented 6 years ago

I just checked out the current 4.19 head (a599ee9) and the cmake file still isn't updated

reapazor commented 6 years ago

Hmm maybe it hasn’t been brought over yet, I’ll double check master tomorrow. I put a quick hack up a while ago as a quick change to make it work against 4.19 … I’ll dig that up too.

-- Matthew Davey dotBunny From: SkaveRat notifications@github.com Reply-To: dotBunny/CLionSourceCodeAccess reply@reply.github.com Date: Tuesday, April 24, 2018 at 18:35 To: dotBunny/CLionSourceCodeAccess CLionSourceCodeAccess@noreply.github.com Cc: Matthew Davey matthew.davey@dotbunny.com, Comment comment@noreply.github.com Subject: Re: [dotBunny/CLionSourceCodeAccess] 4.19 usage on windows (#99)

I just checked out the current 4.19 head (a599ee9) and the cmake file still isn't updated

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/dotBunny/CLionSourceCodeAccess/issues/99#issuecomment-384101349, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAGD3E3sAWOpj9ajfZzheb81A1PxdMmNks5tr6iRgaJpZM4TZDqY.

SkaveRat commented 6 years ago

And as suspected, 4.19.2 didn't fix the issue

reapazor commented 6 years ago

I know ☹ Im on it.

-- Matthew Davey dotBunny From: SkaveRat notifications@github.com Reply-To: dotBunny/CLionSourceCodeAccess reply@reply.github.com Date: Tuesday, May 1, 2018 at 13:35 To: dotBunny/CLionSourceCodeAccess CLionSourceCodeAccess@noreply.github.com Cc: Matthew Davey matthew.davey@dotbunny.com, Comment comment@noreply.github.com Subject: Re: [dotBunny/CLionSourceCodeAccess] 4.19 usage on windows (#99)

And as suspected, 4.19.2 didn't fix the issue

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/dotBunny/CLionSourceCodeAccess/issues/99#issuecomment-385734149, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAGD3P53ycD_Y4PKkavIntR3T3yn7W9Iks5tuJzCgaJpZM4TZDqY.

Brainshack commented 6 years ago

I tried it with current github master and while it generates the CMakeLists.txt file now, I get an error:

"Cannot load settings from file '....MyProject.idea\misc.xml' Error on line 1: Content is not allowed in prolog. Please correct the file for content.

Here is the content of that file. It looks fine to me.

<project version="4">
    <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
    <component name="CidrRootsConfiguration">
        <excludeRoots>
            <file path="$PROJECT_DIR$/Binaries" />
            <file path="$PROJECT_DIR$/Build" />
            <file path="$PROJECT_DIR$/Content" />
            <file path="$PROJECT_DIR$/DataTables" />
            <file path="$PROJECT_DIR$/DerivedDataCache" />
            <file path="$PROJECT_DIR$/FeaturePacks" />
            <file path="$PROJECT_DIR$/Intermediate" />
            <file path="$PROJECT_DIR$/LocalBuilds" />
            <file path="$PROJECT_DIR$/Samples" />
            <file path="$PROJECT_DIR$/Saved" />
            <file path="$PROJECT_DIR$/Templates" />

            <file path="$PROJECT_DIR$/Engine/Binaries" />
            <file path="$PROJECT_DIR$/Engine/Build" />
            <file path="$PROJECT_DIR$/Engine/Content" />
            <file path="$PROJECT_DIR$/Engine/DerivedDataCache" />
            <file path="$PROJECT_DIR$/Engine/Documentation" />
            <file path="$PROJECT_DIR$/Engine/Extras" />
            <file path="$PROJECT_DIR$/Engine/Intermediate" />
            <file path="$PROJECT_DIR$/Engine/Programs" />
            <file path="$PROJECT_DIR$/Engine/Saved" />
        </excludeRoots>
    </component>
</project>
Sygan commented 6 years ago

I was successful with generating CMakeLists.txt from UnrealBuildTarget.exe. I had to replace all '\' in file names to '/' in order to make it to work.

I also got @Brainshack information but it is a IntelliJ warning not an error so I think it is safe to ignore it for now.

I got this when CMake was loading, any ideas?

image

This is a very long error. I've put it on gist here if anybody cares to look at it: https://gist.github.com/Sygan/a51f31b11ed12450cd91c577b6e717f3

AlexisWeil commented 6 years ago

@Sygan same problem. I haven't tried it for now, but I read that if you build UE 4.19 directly from sources, it could fix this problem.

I may try this today, I'll keep in touch with you if it works.

reapazor commented 6 years ago

I realize how much this sucks :( Epic has promised to resolve a problem internally "higher up" for 4.20.

SkaveRat commented 6 years ago

is there a ticket opened about it somewhere that can be followed?

reapazor commented 6 years ago

That's part of the problem, there isn't a public discussion about it. Effectively non native project types dont generate properly in 4.19, it was a late introduced bug in the build system.

Sygan commented 6 years ago

@Zarkus13 I've also found this information, so I tried to build it from sources - I'm a novice to UE4 so it took me a moment to get it right.

I had some problems with missing files (because I've deleted the retail version) so I did some digging and found two pull requests fixing the issue with generating CMakeLists. I've implemented them (to master branch) and although I was able to generate the file, the g++ error persisted.

I also noticed that the version I've built (with modifications) didn't get the CLion from Code Editor in UE4 Settings. I had to manually tell it in code to use CLion because it has always fallen back to VS.

But as I said I'm no expert in UE4 so I could did something wrong and if you could confirm that GitHub version of the engine doesn't fix this issue then I would be glad.

Sygan commented 6 years ago

All right, I was somewhat successful :)

When I had g++ error at first time I've also tried to change toolchain in CLion to MSVC compiler but it also gave me an error.

After everything from above I thought that maybe the problem is not in Unreal but it lies somewhere in g++ or CLion. So I've downloaded CMake from the web and run it manually. By default it used MSVC and it had finished with success. Then I've changed CLion built-in CMake to the one I've downloaded and although it failed with the g++ error again it had no problems when I've changed the compiler to MSVC.

At this point CLion had indexed all of the files properly and it works fine. You can't use debugging with MSVS in CLion though...

So right now I see two possible issues why g++ failed.

  1. Maybe it's g++ version issue and it might be good to check it with some other versions.
  2. There might be something in g++ command that makes it crash but is accepted just fine by MSVC.

I still need to investigate this further. There is too many things I've did so I need to take few steps back and check what really "fixed" the issue and try to make g++ working (because breakpoints are nice)

Sygan commented 6 years ago

Ok,

The steps needed to run MSVC in CLion are:

A) UnrealEngine Sources preparations.

  1. Get UE4 Sources and prepare the project to open in VS.
  2. Integrate changes from "Fix cmake running error by CMakeLists.txt generated by CMakefileGenerator #4296" pull request.
  3. Build UnrealBuildTool project.

You need to change the code for UnrealBuildTool. Otherwise it will produce that the content of your copyright notice is not valid path and can't be opened.

B) CLion preparations

  1. Open CLion settings
  2. Open Build, Execution, Deployment -> Toolchains
  3. Change Environment to Visual Studio

C) Actual Project preparations (You can do this in retail version of UE4)

  1. Create or open existing Unreal game project.
  2. Set Code Editor in settings to CLion
  3. Open CMD and run the command (of course change paths to correct) Path-To-Your-UE4-Sources-Project\Engine\Binaries\DotNET\UnrealUnrealBuildTool.exe -cmakefile -project="Path-To-Your-Game-Project\ProjectName.uproject" -game -engine -progress
  4. When files are generated you'll see option Open Clion in UE4. You can use it now.
  5. Open Settings -> Build, Execution, Deployment -> CMake and change it's configuration from Debug to Release
  6. Right-click on CMakeLists.txt in CLion and Load CMake project.

When the project will load (it can take a while) it will index all of the files and everything will work okey'ish.

But, I don't know is it my computer, it's pretty slow for a few minutes (like I can't even add new character to file content) after loading CMake project. And you need to regenerate CMakeLists.txt every time you add some new files in the UE4. And adding new files in UE4 also triggers compiling and takes forever. So it's not pleasant. I will still try to get it to work with g++ compiler, maybe it'll be faster.

AlexisWeil commented 6 years ago

@Sygan I can confirm it works with CLion 2018.1.3, but yeah, it's pretty slow ... Also, I don't have autocompletion in my .cpp files, regarding what I declared in the corresponding .h file :\

Any idea on how make things better ?

Sygan commented 6 years ago

You need to regenerate CMakeLists.txt every time you add files in UE4.

I tried to use Cygwin as enviroment with some degree of success. It worked with CLion but Compiling C++ in Unreal was even slower than with MSVC and it failed at the end. But debugging worked :P

Sygan commented 6 years ago

All right It's working now with g++.

I had to install Cygwin with g++, gcc, make, and gdb packages. Add cygwin64/bin to PATH and set everything in CLion Toolchain like this:

image

It throws a warning that "CMake no longer defines WIN32 on Cygwin!" but this warning can be ommited for now (probably changin minimum required version for cmake 2.8.4 in CMakeLists.txt will be enough to fix it).

It's not fast but I think I can't do anything more with it, except getting better PC. I'll try it on my work PC probably during the weekend. Maybe it'll work faster.

I still need to modify some code in UnrealBuildTool.exe and replace original one so Hot Reload will work correctly. Right now I need to refresh CMake manually.

So I think that g++ error was because of the MinGW version of g++.exe. Yay! One more thing done :)

MadMcCrow commented 6 years ago

So If I try to sum up what's happenning, I'd say, the plugin is now integrated in the Engine, but is not working anymore. I can't get the prebuilt UE4 from the launcher to generate CMake files... I will be trying 4.20 preview 3 but I fear this will not work either. Multiple things are possible from here. Building the UE4 from Source might do some good, but I'm not certain. Also maybe Cygwin will work better than MinGW. Btw. I tried using CLang, as I know it is supported in windows through Visual Studio.

reapazor commented 6 years ago

I have confirmed with Epic that the next preview/release will have the issue resolved.

"There was an accidental merge that dropped a case in a switch statement."

SkaveRat commented 6 years ago

Preview4 just released. it has the following fix: UE-60858 Unknown project file type 'CLion error when generating project files for CLion

I assume that's the one?

AlexisWeil commented 6 years ago

Did anyone try the new 4.20 version of UE4 with CLion ?

I just did, the CMakeLists.txt was built successfully, excepted the fact that I needed to replace the \ by \\ in file paths.

BUT when I try to reload the CMake Project inside CLion, I get the following exception : impossible to execute 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\Hostx86\x86\c1xx.dll' : the command line is to long or something like that (it's written in french).

Any news by your side ?

Brainshack commented 6 years ago

I tried. It built everything but I dont see any files in my solution and cant build.

2018-07-19 21:26 GMT+02:00 Zarkus13 notifications@github.com:

Did anyone try the new 4.20 version of UE4 with CLion ?

I just did, the CMakeLists.txt was built successfully, excepted the fact that I needed to replace the \ by \ in file paths.

BUT when I try to reload the CMake Project inside CLion, I get the following exception : `impossible to execute 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\ Tools\MSVC\14.12.25827\bin\Hostx86\x86\c1xx.dll' : the command line is to long" or something like that (it's written in french).

Any news by your side ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dotBunny/CLionSourceCodeAccess/issues/99#issuecomment-406387508, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb2KhWPo06JYqisGVMLtehFdN9JI6XHks5uIN1PgaJpZM4TZDqY .

ceininger commented 6 years ago

@Zarkus13 You need to go in settings -> Build, Execution, Deployment -> CMake and change Build types from Debug to Release.

For those who have an error in misc.xml like @Brainshack => this file is UTF-8 BOM encoded, just convert it to UTF-8 without BOM (into notepad++ for example)

reapazor commented 6 years ago

UE4 4.20 Preview 5, on latest macOS doesnt find Xcode even. On Fri, Jul 20, 2018 at 8:27 AM ceininger notifications@github.com wrote:

@Zarkus13 https://github.com/Zarkus13 You need to go in settings -> Build, Execution, Deployment -> CMake and change Build types from Debug to Release.

For those who have an error in misc.xml like @Brainshack https://github.com/Brainshack => this file is UTF-8 BOM encoded, just convert it to UTF-8 without BOM (into notepad++ for example)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dotBunny/CLionSourceCodeAccess/issues/99#issuecomment-406585894, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGD3Mkr5LrV6UVZagCB9tMrF42aqXm7ks5uIcylgaJpZM4TZDqY .

-- Matthew Davey dotBunny

S-Marais commented 5 years ago

@reapazor could you check my PR https://github.com/EpicGames/UnrealEngine/pull/5006 using the last commit in 4.20.3 I was able to generate project files for CLion for the engine on Mac GenerateProjectFiles.command -clion and then compile the engine with no issues (in other words I did not use xcode at all) I tested also on Linux and Windows with no issues but I need other tests. On windows I did not compile the engine and did set the toolchain to be msvc. In order to get rid of the errors I also had to switch from debug to release.