open-builder icon indicating copy to clipboard operation
open-builder copied to clipboard

Clion support

Open FinnT730 opened this issue 4 years ago • 12 comments

I want to build this project with Clion. But whatever I do to get the SMFL working. I have tried every directory in the project by now. Should I be placing it somewhere global? Do you have any advice on this?

Here is the error I get when I try to reload the project (Please note, this is done on Cmake, can that be the problem?)

Have a nice day, and thanks in advance!

FinnT730 avatar Dec 21 '19 16:12 FinnT730

Hi Finn, if you are on Windows, then these guides might be helpful for getting SFML and CMake to work.

https://github.com/SFML/SFML/wiki/Tutorial%3A-Build-your-SFML-project-with-CMake

https://en.sfml-dev.org/forums/index.php?topic=8306.0

Please let me know how it goes :)

Hopson97 avatar Dec 22 '19 00:12 Hopson97

Thanks for coming back yo me. So, SFML works now, but now GLM is bugging out. I might continue later with this, but I have a headache from Clion right now. Thanks for all the help anyway!

Have a nice day!

FinnT730 avatar Dec 22 '19 12:12 FinnT730

glmConfig.zip Drop these two files into your glm directory, and then CMake will be able to find it automatically. For some reason, recent commits of glm have messed up CMake configs, but I saw a pending pull request to add these, and it turns out they appear to work. @FinnT730

Also, I don't know what solution you found to the SFML problem, but what I did in #this commit was to just add the line cmake_policy(VERSION 3.12...3.16) right under the top like of the root CMakeLists.txt, and then set the environment variable SFML_ROOT to point to my SFML directory.

a-day-old-bagel avatar Dec 23 '19 11:12 a-day-old-bagel

Thanks @a-day-old-bagel gonna try that as well. Thanks! for the SFML, I found out that I just needed to use this line: set(SFML_ROOT "{PATH_TO_SFML}") where, {PATH_TO_SFML} is then the path to you're SFML installation folder (the folder you unzip)

Gonna let you know if this is going to work, thanks in advance!

FinnT730 avatar Dec 23 '19 14:12 FinnT730

Maybe it would also be a smarter idea to clone the repo, instead of downloading the zip file.... the errors are gone now btw, thank you so much for helping me with that problem!

(Note, now I have different errors, but it kinda works!)

FinnT730 avatar Dec 23 '19 14:12 FinnT730

Hi all,

If possible, as it would help other people if you want you can create a PR with your fixes and update the readme, that would awesome.

Thanks!

Hopson97 avatar Dec 23 '19 17:12 Hopson97

@FinnT730

set(SFML_ROOT "{PATH_TO_SFML}")

The only possible issue with that is that it will only work on your machine, and so can't be pushed to the repo, right? Like, you don't want to hardcode the path into CMake, or am I misunderstanding? The nice thing about setting an environment variable on your PC to point to the SFML directory is that you don't have to hardcode anything and after that finding SFML will work for any CMake project that needs it automatically (like it should) as long as the CMakeLists.txt sets the policy correctly.

Even better would be to provide a SFMLConfig.cmake and SFMLConfig-version.cmake like I did for glm. That's by far the most portable and easiest solution imo.

@Hopson97 I've made a pull request but be aware it's fairly untested in other configurations, so it will need to be tested first on your machine. An important topic concerning this working more easily (as mentioned in the pull request) is whether or not we can get rid of the \WX flag that CMake passes to MSVC.

a-day-old-bagel avatar Dec 23 '19 20:12 a-day-old-bagel

Hello, if GLM problem still remains, I made a fork of the repository that fixes it (so you don't have to install GLM on your pc)

skejeton avatar Dec 24 '19 10:12 skejeton

I have been having some other issues now as well image

And when I am trying to build: https://pastebin.com/ucwQRxTm Somehow Clion does not like this, and I am out of options really. The files are getting linked the right way. The last thing I will try to do is start of with Visual Studio, and then I will migrate this over to Clion.

Thanks again to everyone that is trying to help! Have a good Holiday!

FinnT730 avatar Dec 24 '19 17:12 FinnT730

That's very strange, hopefully we can find a way to fix this for you all.

Happy holidays to all as well! :smile:

Hopson97 avatar Dec 24 '19 17:12 Hopson97

image

I'm trying to compile this on macOS 10.15.3 by using the scripts/build.sh script and I'm having the same problem:

-- Found SFML .. in /usr/local/include
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/pepe/open-builder/bin/debug
[  1%] Building CXX object src/common/common/CMakeFiles/ob-common.dir/debug.cpp.o
In file included from /Users/pepe/open-builder/src/common/common/debug.cpp:1:
/Users/pepe/open-builder/src/common/common/debug.h:3:10: fatal error: 'SFML/System/Vector3.hpp' file not found
#include <SFML/System/Vector3.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/common/common/CMakeFiles/ob-common.dir/debug.cpp.o] Error 1
make[1]: *** [src/common/common/CMakeFiles/ob-common.dir/all] Error 2
make: *** [all] Error 2
Built target in bin/debug/

pepebecker avatar Feb 08 '20 05:02 pepebecker

So, bit late to this, but I was thinking just now, what if instead of Clion we would use Resharper++ from jetbrains? Since k think this is direct Visual Studio support. I will come back when I am done testing this.

(Sorry for the late late, late comment on this old issue, but maybe someone else wanted an solution, and maybe this would work)

FinnT730 avatar Oct 18 '20 09:10 FinnT730