Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Cross compiling SFML 2.2 for openwrt using CMake  (Read 5677 times)

0 Members and 1 Guest are viewing this topic.

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Cross compiling SFML 2.2 for openwrt using CMake
« 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.
@dwarfman78
github.com/dwarfman78

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #1 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?
Laurent Gomila - SFML developer

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #2 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.
@dwarfman78
github.com/dwarfman78

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #3 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".
@dwarfman78
github.com/dwarfman78

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #4 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.
Laurent Gomila - SFML developer

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #5 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 ?
« Last Edit: February 12, 2015, 06:55:45 pm by dwarfman78 »
@dwarfman78
github.com/dwarfman78

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #6 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.
Laurent Gomila - SFML developer

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #7 on: February 12, 2015, 08:14:26 pm »
Is there an easy way i could do it myself ?

Even an ugly way...
« Last Edit: February 12, 2015, 08:17:45 pm by dwarfman78 »
@dwarfman78
github.com/dwarfman78

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #8 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.
« Last Edit: February 12, 2015, 08:33:44 pm by Laurent »
Laurent Gomila - SFML developer

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #9 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.
« Last Edit: February 12, 2015, 08:31:09 pm by dwarfman78 »
@dwarfman78
github.com/dwarfman78

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #10 on: February 12, 2015, 08:31:53 pm »
Should i fill in a request to make it configurable ?
@dwarfman78
github.com/dwarfman78

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #11 on: February 12, 2015, 08:35:41 pm »
Yes :)
Laurent Gomila - SFML developer

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #12 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.
@dwarfman78
github.com/dwarfman78

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compiling SFML 2.2 for openwrt using CMake
« Reply #13 on: February 12, 2015, 10:49:40 pm »
Yes, thanks. That will be very interesting.
Laurent Gomila - SFML developer