SFML community forums

Help => General => Topic started by: dwarfman78 on February 12, 2015, 08:23:14 am

Title: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 08:23:14 am
Hi guys,

i'd like to use SFML Network module with my router which runs under openwrt.

I have a very limited knowledge of cross compiling, anyone would care to help me to cross compile the network module for this operating system ? (maybe on irc)

So far i've an error with CMake : "mips-openwrt-linux-uclibc-gcc is not able to compile a simple test program".

thanks.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: Laurent on February 12, 2015, 08:41:18 am
You should first make sure that your toolchain works fine instead of trying to compile SFML directly:

1. compile a hello world with a direct call to gcc
2. compile a hello world with CMake
3. compile sfml-network

Other than this very general advice, I don't know if someone will be able to help you, since this is very specific and not related to SFML at all. Maybe you should search an OpenWRT forum instead?
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 09:36:16 am
Thanks for the answer, i'll do that and come back later if i have more SFML specific errors coming out.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 06:12:27 pm
Hi again,

i've sucessfully compiled an helloWorld example with CMake and made it run on my router.

Now i'm back with SFML.

CMake Error at CMakeLists.txt:54 (sfml_add_library):
  Unknown CMake command "sfml_add_library".
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: Laurent on February 12, 2015, 06:19:29 pm
Are you trying to compile a sub-directory of the SFML tree? You can't, you must run CMake on the root directory.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 06:27:39 pm
EDIT :

Ok i had some cache problems, here is the message when i try to configure from SFML root directory :

CMake Error at /usr/share/cmake-2.8/Modules/FindX11.cmake:427 (message):
  Could not find X11

which makes sense ... but i do not need X11 for the Network module right ?
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: Laurent on February 12, 2015, 08:10:58 pm
Right, but unfortunately you cannot choose which SFML modules to configure, it's everything or nothing. I guess we could add an option for that.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 08:14:26 pm
Is there an easy way i could do it myself ?

Even an ugly way...
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: Laurent on February 12, 2015, 08:27:44 pm
The easy ugly way: in src/SFML/CMakeLists.txt, remove all the calls to add_subdirectory (on the bottom) except the ones for Network and System.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 08:29:37 pm
Ok ... i modified CMakeLists.txt in src/SFML

# add the modules subdirectories
add_subdirectory(System)
if(SFML_OS_WINDOWS OR SFML_OS_ANDROID OR SFML_OS_IOS)
    add_subdirectory(Main)
endif()
#add_subdirectory(Window)
add_subdirectory(Network)
#add_subdirectory(Graphics)
if(NOT SFML_OS_IOS)
#    add_subdirectory(Audio)
endif()

Looks like you posted the answer while i was typing  ;)

then make sfml-network.

It seems to be working.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 08:31:53 pm
Should i fill in a request to make it configurable ?
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: Laurent on February 12, 2015, 08:35:41 pm
Yes :)
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: dwarfman78 on February 12, 2015, 10:35:23 pm
done.

http://en.sfml-dev.org/forums/index.php?topic=17492

Thank you again Laurent, my program is working like a charm, although it is not a classic "multimedia" project i'll probably make a topic in the project section to show how versatile sfml can be.
Title: Re: Cross compiling SFML 2.2 for openwrt using CMake
Post by: Laurent on February 12, 2015, 10:49:40 pm
Yes, thanks. That will be very interesting.