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.


Topics - Maxjen

Pages: [1]
1
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