Hopson97 / open-builder

Open "Minecraft-like" game with multiplayer support and Lua scripting support for the both client and server
https://github.com/Hopson97/open-builder/projects/3
GNU General Public License v3.0
703 stars 80 forks source link

Clion support #30

Open FinnT730 opened 4 years ago

FinnT730 commented 4 years ago

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!

Hopson97 commented 4 years ago

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 :)

FinnT730 commented 4 years ago

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!

a-day-old-bagel commented 4 years ago

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.

FinnT730 commented 4 years ago

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 commented 4 years ago

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!)

Hopson97 commented 4 years ago

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!

a-day-old-bagel commented 4 years ago

@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.

skejeton commented 4 years ago

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)

FinnT730 commented 4 years ago

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!

Hopson97 commented 4 years ago

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

Happy holidays to all as well! :smile:

pepebecker commented 4 years ago

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/
FinnT730 commented 4 years ago

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)