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

Author Topic: Cross compile SFML on MXE, Ubuntu  (Read 3337 times)

0 Members and 1 Guest are viewing this topic.

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Cross compile SFML on MXE, Ubuntu
« on: November 18, 2012, 06:54:22 pm »
Hi!

I develop on Ubuntu, for Windows, with Mingw.

I linked the official Mingw 2.0-pre libraries, but then the program crashed when I called the first method.  Some googling led me to believe, this is what happens when the library is compiled with another compiler version than the one I am using.

So, I try to compile SFML with http://mxe.cc, but what is the proper magic spell to give it to compile with Mingw in Linux?

I have tried

cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw32.cmake -D FREETYPE_LIBRARY=freetype  -D FREETYPE_INCLUDE_DIRS=/opt/mxe/usr/i686-pc-mingw32/include/freetype2   -D GLEW_LIBRARY=glew -D GLEW_INCLUDE_PATH=/opt/mxe/usr/i686-pc-mingw32/include   -D JPEG_INCLUDE_DIR=/opt/mxe/usr/i686-pc-mingw32/include  -D JPEG_LIBRARY=jpeg .


and

SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i686-pc-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-pc-mingw32-g++)
SET(CMAKE_RC_COMPILER i686-pc-mingw32-windres)
SET(CMAKE_FIND_ROOT_PATH  /opt/mxe/usr /opt/mxe/usr/ )



Now it asks for openal libraries,

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE):
  Could NOT find OpenAL (missing: OPENAL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindOpenAL.cmake:101 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/SFML/Audio/CMakeLists.txt:42 (find_package)


-- Configuring incomplete, errors occurred!


And by then I started thinking, does SFML even use OPENAL on Windows?  Am I on the right track?  Besides, MXE doesn't even seem to have OPENAL.



Any ideas? :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compile SFML on MXE, Ubuntu
« Reply #1 on: November 18, 2012, 07:14:51 pm »
For the external dependencies, you should rather use the libraries provided by SFML if you build for Windows. They work for every compiler on Windows so they should work with your cross-compiler too.
Laurent Gomila - SFML developer

jakov

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Cross compile SFML on MXE, Ubuntu
« Reply #2 on: November 18, 2012, 09:56:53 pm »
Thanks, I needed a nudge. Tried so many odd things I didn't see the clues in front of me.

dl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Cross compile SFML on MXE, Ubuntu
« Reply #3 on: October 21, 2013, 03:36:14 pm »
Hello,

Two more questions about this topic (I'm also trying to compile a sfml project with mxe) :
- which include files should I use with the dll provided with the sfml ?
- what about GLEW ? the compilation of sfml-graphics seems to need glew functions, which library should i use ?

thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Cross compile SFML on MXE, Ubuntu
« Reply #4 on: October 21, 2013, 03:54:17 pm »
Quote
- which include files should I use with the dll provided with the sfml ?
I don't understand your question, sorry. "Include files" for what? "Use" where?

Quote
- what about GLEW ? the compilation of sfml-graphics seems to need glew functions, which library should i use ?
The only answer that comes to my mind is "GLEW", but this is probably not what you expect, so again, please be more precise, I don't get what you mean.

And as a general advice: don't bother with cross-compilation, just download a VM and compile natively.
Laurent Gomila - SFML developer

dl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Cross compile SFML on MXE, Ubuntu
« Reply #5 on: October 22, 2013, 02:51:18 pm »
Ok, that what I'm going to do.
thanks