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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Maxjen

Pages: [1]
1
General / Re: Compiling example with cmake
« on: June 27, 2012, 11:10:46 am »
Ok, thanks. My curiosity is satisfied for now.

2
General / Re: Compiling example with cmake
« on: June 26, 2012, 03:17:52 pm »
Thanks for your replies, they help a lot! I think I'll just leave it to the user then to download the right version of SFML. Just for understanding, say there is a closed-source library which only provides .lib files would this mean that I simply can't use it with gcc? So on windows you depend on library developers to support your compiler if it is not open-source.

And there is one more thing that still confuses me. On this tutorial you say that SFML provides its dependancies on windows. How is that possible if the libraries need to be compiled with the right compiler?

3
General / Re: Compiling example with cmake
« on: June 26, 2012, 01:56:01 pm »
Ok, it works now. I downloaded the SFML package for GCC SJLJ. Before I was using the same as for Visual Studio. But now I have the folders:
SFML-2.0-rc_linux
SFML-2.0-rc_windows_visualStudio
SFML-2.0-rc_windows_codeblocks

It's becoming a little bit cluttered and I have to rename one of them to SFML-2.0-rc_windows if I want to use codeblocks or visual studio. Is it not possible to somehow have only one folder for windows regardless of which compiler you use? Or at least to avoid the renaming?

4
General / Re: Compiling example with cmake
« on: June 26, 2012, 01:29:56 pm »
Unfortunately  I still get the same error:
-------------- Build: all in sfml-test ---------------

Using makefile: Makefile
Scanning dependencies of target sfml-test
[100%] Building CXX object CMakeFiles/sfml-test.dir/main.cpp.obj
Linking CXX executable sfml-test.exe
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x93): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xcd): undefined reference to `_imp___ZN2sf6WindowC1ENS_9VideoModeERKSsjRKNS_15ContextSettingsE'
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xfb): undefined reference to `_imp___ZN2sf6Window17setFramerateLimitEj'
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x108): undefined reference to `_imp___ZN2sf5ClockC1Ev'
...

This is my current CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (sfml-test)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

if (UNIX)
  set (SFMLDIR "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_linux/")
endif (UNIX)
if (WIN32)
  set (SFMLDIR "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_windows/")
endif (WIN32)

find_package (SFML 2 COMPONENTS window system)
find_package (OpenGL)
include_directories (${SFML_INCLUDE_DIR})
include_directories (${OPENGL_INCLUDE_DIR})

add_executable (sfml-test main.cpp)
target_link_libraries (sfml-test ${OPENGL_LIBRARIES} ${SFML_LIBRARIES})

In case it matters: I had to change the make program from "make.exe" to "mingw32-make.exe" so that it even starts compiling, but other than that I didn't change any settings.

5
General / Re: Compiling example with cmake
« on: June 26, 2012, 12:22:50 pm »
Quote
Isn't it redundant?
Ah, forgot to remove that.

My next problem is, that I can't compile it with Codeblocks. I generated the project files with the "CodeBlocks - MinGW Makefiles" generator, but when I try to compile it I get lots of undefined reference errors.

Part of my error message:
-------------- Build: all in sfml-test ---------------

Using makefile: Makefile
Linking CXX executable sfml-test.exe
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x93): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xcd): undefined reference to `_imp___ZN2sf6WindowC1ENS_9VideoModeERKSsjRKNS_15ContextSettingsE'
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xfb): undefined reference to `_imp___ZN2sf6Window17setFramerateLimitEj'
CMakeFiles\sfml-test.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x108): undefined reference to `_imp___ZN2sf5ClockC1Ev'
 

I think my problem might be similiar to this one: http://en.sfml-dev.org/forums/index.php?topic=4010.0
You said there that you have to use the same compiler for sfml and your application. I downloaded the precompiled package. Does this mean I can't use sfml with codeblocks unless I compile sfml myself? If that is the case, isn't that extremly impractical? What if for example I wanted to use a proprietary library where I don't have the source code?

6
General / Re: Compiling example with cmake
« on: June 26, 2012, 01:45:50 am »
Quote
What's important is that you need the .lib file only when you compile, and the .dll file only when you execute (so you don't have to distribute .lib files).
Ok, that's good to know, thanks!

Quote
Why would you copy them everytime? They never change.
Right, but it's still one extra step and it would be nice it could be done automatically by cmake somehow. But ok, it's not really that important.

Quote
And if you don't want DLLs at all, link statically.
I might do that, thanks.

Quote
Wait... why is this post in the C forum??
I thought this was the right forum, because my problems were more related to the programming language and not directly to sfml, but I just noticed that this forum is not C/C++ but only C, sorry. Maybe this can be moved.

Quote
By the way, you should use the FindSFML.cmake script to abstract the way SFML is found and used by CMake.
Good idea, I thought that required SFML to be installed on the sytem, but it seems that is not the case. I updated my CMakeLists.txt and it works, thanks! I'll post later about my other problem.

My CMakeLists.txt now looks like this:
cmake_minimum_required (VERSION 2.6)
project (sfml-test)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include_directories ("${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_linux/include")

if (UNIX)
  set (SFML_DIR "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_linux/")
endif (UNIX)
if (WIN32)
  set (SFML_DIR "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_windows/")
endif (WIN32)

find_package (SFML 2 COMPONENTS system window)
find_package (OpenGL)
include_directories (${SFML_INCLUDE_DIR})
include_directories (${OPENGL_INCLUDE_DIR})

add_executable (sfml-test main.cpp)
target_link_libraries (sfml-test ${OPENGL_LIBRARIES} ${SFML_LIBRARIES})

7
General / Compiling example with cmake
« on: June 25, 2012, 03:05:15 pm »
Hi,

I want to start a project with sfml and it should be as cross-plattform as possible, so I want to use git as version control and cmake as my buildsystem. And I want to bundle sfml with my application so I don't have to install it everytime. Right now I'm just trying to compile the window-example. My folder tree looks like this:

window
   |_ build
   |_ SFML
      |_ SFML-2.0-rc_linux
      |_ SFML-2.0-rc_windows
   |_ CMakeLists.txt
   |_ main.cpp

My CMakeLists.txt looks like this:
cmake_minimum_required (VERSION 2.6)
project (sfml-test)

if(UNIX)
  include_directories ("${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_linux/include")
  set (EXTRA_LIBS ${EXTRA_LIBS} "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_linux/lib/libsfml-system.so")
  set (EXTRA_LIBS ${EXTRA_LIBS} "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_linux/lib/libsfml-window.so")
  set (EXTRA_LIBS ${EXTRA_LIBS} GL GLU)
endif(UNIX)

if(WIN32)
  include_directories ("${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_windows/include")
  set (EXTRA_LIBS ${EXTRA_LIBS} "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_windows/lib/sfml-system.lib")
  set (EXTRA_LIBS ${EXTRA_LIBS} "${PROJECT_SOURCE_DIR}/SFML/SFML-2.0-rc_windows/lib/sfml-window.lib")
  set (EXTRA_LIBS ${EXTRA_LIBS} Opengl32 glu32)
endif(WIN32)

add_executable (sfml-test main.cpp)
target_link_libraries (sfml-test  ${EXTRA_LIBS})

On linux I use KDevelop and everything works perfectly. On windows I first generate project files for Visual Studio 2010 and then I can compile it, but before I run it I have to copy sfml-system-2.dll and sfml-window-2.dll into build/Debug or build/Release. What I don't understand is why I only need the .so files on linux, but need both the .lib and the .dll on windows. And does anyone know how I can avoid having to copy the .dlls everytime? I have another problem with codeblocks on windows, but this one is more important right now.

Pages: [1]
anything