i have a new project i want to try with urho3D but that do a while i didn’t used linux so i’m a bit lost, i forgot how i was compiling before.
i was able to compile urho3D successfully but i don’t remember how i was doing for a project.
if i’m not wrong i set the URHO3D_HOME environment variable in the .bashrc file and my project is well set.
my main.cpp is an old one just to get started but i think it should compile fine.
before i was using a little script with :
“./cmake_generic.sh /home/noals/Bureau/mf1_build -DCMAKE_BUILD_TYPE=Debug”
but i’m missing a step and i don’t remember which one ^^;
i know the first step is to tell the compiler all files to compile and then the second step is to compile but dunno, i’m a bit confused.
could you remind me how to compile my little project to get started please ?
while i’m at it, i have a few questions :
-is there a ide you would recommend to me ? before i was only compiling through the terminal but this project will be bigger i think so i will need an ide to see things clearly. is it hard to configure kdevelop ? i was interested in this one.
-i saw on the feature that there is knet with urho3D, my first step will be network programming and i know there is a tuto about that but is there a problem with knet if i want to compile my project for android later ?
i want to do a mmorpg but i won’t need realtime information kinda, i mean i will only use the network engine to communicate with my database (postgresql) and calculate algos like damage calculation when a player fight a mob or stuff like that. any advice for that too ?
(i know a bit about network programming, i started with java and socket programming actually using the knockknock protocole tutorial from oracle but java was just a pain at some point so i’m back with urdho3D ^^)
yes, i think i don’t use my little script as i should so the compiler doesn’t find the right directory, i’m using windows while answering right now, i will test tomorrow on linux and to tell how it goes. thx for your support. ^^;
With regards to IDE, there’s lots of choices. I’m using the CodeBlocks IDE on both Linux and Windows. It’s nice to have a single toolchain across platforms, on the rare occasions that I need to switch over.
If you are using a version for casual desktop usage (as opposed to minimal server install) from any Linux distro then most probably you have “rake” already installed. And if so, just do this from the Urho project root to build Urho3D.
$ rake cmake && rake make
This will create a build tree at the default location: /path/to/Urho-project-root/build/native. Set the URHO3D_HOME env-var to point to this build tree path and export it.
Assuming you just getting started with your own new project, create the skeleton project using “scaffolding” task.
$ rake scaffolding dir=/path/to/your-project-root
Now, repeat the steps how you build Urho3D lib earlier, but now substitute the project with your own project. That is, in your own project root, do this.
$ rake cmake && rake make
And that’s it. Your build tree is in /path/to/your-project-root/build/native naturally.
BTW, knet has been replaced with SlikeNet in master branch.
EDIT: the default build tree path between master and 1.7 tag is different, so adjust accordingly.
My preferred IDE is QtCreator with custom wizards, btw.
hi, thx, well i think i didn’t understand how to set my environment variable.
i had to install rake but everything went fine except compilation.
even trying with the varibale set manually like the compiler say, it doesn’t work
:~/Bureau/mf1$ rake cmake URHO3D_HOME=home/noals/Bureau/Urho3D/build/native && rake make
CMake Deprecation Warning at CMakeLists.txt:9 (cmake_policy):
The OLD behavior for policy CMP0026 will be removed from a future version
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Error at CMake/Modules/FindUrho3D.cmake:343 (message):
Could NOT find compatible Urho3D library in Urho3D SDK installation or
build tree or in Android library. Use URHO3D_HOME environment variable or
build option to specify the location of the non-default SDK installation or
Call Stack (most recent call first):
– Configuring incomplete, errors occurred!
See also “/home/noals/Bureau/mf1/build/native/CMakeFiles/CMakeOutput.log”.
and the CMakeOutput.log
i set my variable by adding a line at the end of .bashrc and .profile just in case it override the first one but it doesn’t seem to work.
Setting environment variables
i guess that’s a good idea since i want it to be crossplatform.
Have you actually build Urho3D lib successfully. The Urho3D build tree path should contain two subdirs: include/ and lib/. Only then your URHO3D_HOME pointing to there would be accepted. Your error indicates this is not the case.
There are a few ways to set env-var on *nix system. The method that you mentioned in your last comment are equally valid. Just note that setting in bash profile does not take effect immediately in the current session, unless you explicitly “source” the file in the current session.
These days its ALL about cross platform, and not which platform you develop on.
On linux, the install process is easier than has been described in my opinion, don’t mess around with rake, use cmake-gui to create your build folder - and once you have it, build it using make, and finally, link your app to the static lib
Some people like GUI and some don’t. And for those that don’t, we have bash helper scripts to pull it off using CLI. The rake tasks that I mentioned before simply invoke those bash shell scripts. It is also the one being tested in our CI build. Headless, no GUI, and not for faint hearted.
Choose your own poison. The beauty of our build system is, it does not force anyone to use one method or another. Regardless, URHO3D_HOME needs to be set correctly, or “you shall not pass”.
funny, I didn’t set any environmental variables, yet here I am - but I agree its nice to have options - love your work on the build system.
Our build system also follows the old *nix convention. Configure (CMake), make, make install. If you do that then the lib is installed to the system default location. So, the downstream project can find it without problem. The drawback of this approach is, only one version of the lib can be installed at any single time. Using URHO3D_HOME, one can use the lib without installing it and the variable can be set to any build tree path you may have. Just set it on the fly before invoking CMake.
I built the lib in-situ, and link to it directly, its not “installed” in the conventional sense, but yes I see the beauty
Like I said there are more than one ways. Some are supported officially and some are don’t.
Yes, i built Urho3D lib successfully, it went to 100% following the tuto https://github.com/urho3d/Urho3D/wiki/Getting-started-in-Linux. I have the include/Urho3D/directories and .h and lib/libUrho3D.a
And each time i changed the path to URHO3D_HOME, i restarted the computer so i don’t understand.
edit: and i use linux mint, my installation is pretty clean, i installed it few days ago especially for programming with urho3D
I use linux mint also, and I am pretty ‘new’ at linux, despite my ‘previous history’ - did you upgrade to tara yet? in the update manager thing, look in the Edit menu for upgrade… ok so you dont really need to set up environmental bullshit, if you have built the lib, you just need to link to it in your app - you need to tell your compiler where it is - I use code blocks ide, and for me, this means adjusting the Build Options, going to the Linker settings, and adding the static lib - the pthread thing threw me for a day
to be specific, maybe a screen shot is better
crap, my mouse cursor is in the way, but this is in the right direction
Super happy to work out any issues you have and make it easier for the next guy.
Then it must have found an incompatible Urho3D lib there. Make sure your project build options and build configuration are aligned with the Urho3D lib. I am not sure what exactly went wrong with your setup, but one would for sure get the similar error as yours when, says, pointing URHO3D_HOME to a build tree containing a SHARED lib but expecting a STATIC lib, or pointing to 32-bit lib but expecting 64-bit, etc. Don’t overlook the obvious. Double check everything.
BTW, if you get passed the hurdle then you may try this in your own project root: “rake cmake codeblocks” or “rake cmake codelite” or “rake cmake eclipse”. After that, use the respective IDE to build your own project. There is no need to adjust anything manually in the IDE. Instead always make config setting changes in the CMakeLists.txt and use CMake to reconfigure/regenerate the build tree. Any manual config setting changes in the IDE will be lost. Unless you are happy to “eject” from CMake after your initial build tree is successfully created then you could make further changes using the IDE. But note that I will personally not support such approach. In other words, you will be on your own if you follow this path.