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

Author Topic: Problem configuring csfml2 with cmake  (Read 37658 times)

0 Members and 2 Guests are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #15 on: May 07, 2011, 10:16:53 am »
You must have installed SFML 2 before, and if you did it successfully, the FindSFML.cmake file should have been copied to your CMake directory.
Laurent Gomila - SFML developer

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Problem configuring csfml2 with cmake
« Reply #16 on: June 10, 2011, 06:29:17 pm »
Sorry for reviving a thread, buy may I ask exactly what you mean by this:
Quote
the FindSFML.cmake file should have been copied to your CMake directory.

I am having trouble as well with compiling the C binding of sfml. I am receiving the same error as Richy19:
Code: [Select]
CMake Error at src/SFML/CMakeLists.txt:22 (find_package):
Could not find module FindSFML.cmake or a configuration file for package
SFML.

Adjust CMAKE_MODULE_PATH to find FindSFML.cmake or set SFML_DIR to the
directory containing a CMake configuration file for SFML. The file will
have one of the following names:

SFMLConfig.cmake
sfml-config.cmake

The steps I took to compile CSFML was to first compile SFML2 (latest snapshot) with CMake-Gui using "Visual Studio 9 2008".

After that I had two different outputs, sfml-build in the sfml snapshot folder and %APPDATA%/SFML. These two folders
contained solutions to build the projects for Visual Studio 2008. The one in %APPDATA% compiled successfully whilst the one
in the SFML-Build folder only succeeded with two out of 5 projects.

I can't find the SFMLConfig nor sfml-config in neither of these directories, therefore I am wondering where this cmake file i supposed to be located!

Thanks in beforehand!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #17 on: June 10, 2011, 09:02:18 pm »
To install SFML correctly you must execute the "install" target. If you generated a Visual Studio solution, this is a project of the solution. The install target locates your CMake install folder and copies FindSFML.cmake in it.

If, for some reason, you don't want to execute the "install" target, you can manually copy the cmake/Modules/FindSFML.cmake to cmake_install_dir/share/Modules. cmake_install_dir is of course the directory where you installed CMake.
Laurent Gomila - SFML developer

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Problem configuring csfml2 with cmake
« Reply #18 on: June 10, 2011, 10:43:10 pm »
Thanks for you reply!

Now after further researching, I've discovered that I do have a file named "FindSFML.cmake" in the directory/folder from the snapshot in this (relative)
directory sfml/cmake/Modules/. Now the problem is, how do I inform (if this is the correct cmake file) cmake that the file is located in this directory?

I've attempted to change the SFML_DIR name/variable to both the sfml/ directory and the sfml/Modules/ directory but none of them have worked.
Any tips?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #19 on: June 10, 2011, 10:49:59 pm »
Hum... did you actually read my previous answer? :|
Laurent Gomila - SFML developer

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Problem configuring csfml2 with cmake
« Reply #20 on: June 10, 2011, 11:33:29 pm »
Quote from: "Laurent"
Hum... did you actually read my previous answer? :|

After further research, no I did not.

Though now I have an additional problem, this is the output when I attempt to compile the C binding: (long text, scrollbars anyhow?)
Code: [Select]
CMake Error at C:/Program Files (x86)/CMake/share/cmake-2.8/Modules/FindSFML.cmake:52 (math):
  math cannot parse the expression:
  "////////////////////////////////////////////////////////////

  //

  // SFML - Simple and Fast Multimedia Library

  // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)

  //

  // This software is provided 'as-is', without any express or implied
  warranty.

  // In no event will the authors be held liable for any damages arising from
  the use of this software.

  //

  // Permission is granted to anyone to use this software for any purpose,

  // including commercial applications, and to alter it and redistribute it
  freely,

  // subject to the following restrictions:

  //

  // 1.  The origin of this software must not be misrepresented;

  // you must not claim that you wrote the original software.

  // If you use this software in a product, an acknowledgment

  // in the product documentation would be appreciated but is not required.

  //

  // 2.  Altered source versions must be plainly marked as such,

  // and must not be misrepresented as being the original software.

  //

  // 3.  This notice may not be removed or altered from any source
  distribution.

  //

  ////////////////////////////////////////////////////////////

 

  #ifndef SFML_CONFIG_HPP

  #define SFML_CONFIG_HPP

 

  ////////////////////////////////////////////////////////////

  // Identify the operating system

  ////////////////////////////////////////////////////////////

  #if defined(_WIN32) || defined(__WIN32__)

 

      // Windows
      #define SFML_SYSTEM_WINDOWS
      #ifndef WIN32_LEAN_AND_MEAN
          #define WIN32_LEAN_AND_MEAN
      #endif
      #ifndef NOMINMAX
          #define NOMINMAX
      #endif

 

  #elif defined(linux) || defined(__linux)

 

      // Linux
      #define SFML_SYSTEM_LINUX

 

  #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) ||
  defined(Macintosh)

 

      // MacOS
      #define SFML_SYSTEM_MACOS

 

  #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)

 

      // FreeBSD
      #define SFML_SYSTEM_FREEBSD

 

  #else

 

      // Unsupported system
      #error This operating system is not supported by SFML library

 

  #endif

 

 

  ////////////////////////////////////////////////////////////

  // Define a portable debug macro

  ////////////////////////////////////////////////////////////

  #if !defined(NDEBUG)

 

      #define SFML_DEBUG

 

  #endif

 

 

  ////////////////////////////////////////////////////////////

  // Define portable import / export macros

  ////////////////////////////////////////////////////////////

  #if defined(SFML_SYSTEM_WINDOWS)

 

      #ifdef SFML_DYNAMIC

 

          // Windows platforms
          #ifdef SFML_EXPORTS

 

              // From DLL side, we must export
              #define SFML_API __declspec(dllexport)

 

          #else

 

              // From client application side, we must import
              #define SFML_API __declspec(dllimport)

 

          #endif

 

          // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
          // You can read lots ot different things about it, but the point is the code will
          // just work fine, and so the simplest way to get rid of this warning is to disable it
          #ifdef _MSC_VER

 

              #pragma warning(disable : 4251)

 

          #endif

 

      #else

 

          // No specific directive needed for static build
          #define SFML_API

 

      #endif

 

  #else

 

      // Other platforms don't need to define anything
      #define SFML_API

 

  #endif

 

 

  ////////////////////////////////////////////////////////////

  // Define portable fixed-size types

  ////////////////////////////////////////////////////////////

  #include <climits>

 

  namespace sf

  {

      // 8 bits integer types
      #if UCHAR_MAX == 0xFF
          typedef signed   char Int8;
          typedef unsigned char Uint8;
      #else
          #error No 8 bits integer type for this platform
      #endif

 

      // 16 bits integer types
      #if USHRT_MAX == 0xFFFF
          typedef signed   short Int16;
          typedef unsigned short Uint16;
      #elif UINT_MAX == 0xFFFF
          typedef signed   int Int16;
          typedef unsigned int Uint16;
      #elif ULONG_MAX == 0xFFFF
          typedef signed   long Int16;
          typedef unsigned long Uint16;
      #else
          #error No 16 bits integer type for this platform
      #endif

 

      // 32 bits integer types
      #if USHRT_MAX == 0xFFFFFFFF
          typedef signed   short Int32;
          typedef unsigned short Uint32;
      #elif UINT_MAX == 0xFFFFFFFF
          typedef signed   int Int32;
          typedef unsigned int Uint32;
      #elif ULONG_MAX == 0xFFFFFFFF
          typedef signed   long Int32;
          typedef unsigned long Uint32;
      #else
          #error No 32 bits integer type for this platform
      #endif

 

  } // namespace sf

 

 

  #endif // SFML_CONFIG_HPP

   * 10 + ////////////////////////////////////////////////////////////

  //

  // SFML - Simple and Fast Multimedia Library

  // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)

  //

  // This software is provided 'as-is', without any express or implied
  warranty.

  // In no event will the authors be held liable for any damages arising from
  the use of this software.

  //

  // Permission is granted to anyone to use this software for any purpose,

  // including commercial applications, and to alter it and redistribute it
  freely,

  // subject to the following restrictions:

  //

  // 1.  The origin of this software must not be misrepresented;

  // you must not claim that you wrote the original software.

  // If you use this software in a product, an acknowledgment

  // in the product documentation would be appreciated but is not required.

  //

  // 2.  Altered source versions must be plainly marked as such,

  // and must not be misrepresented as being the original software.

  //

  // 3.  This notice may not be removed or altered from any source
  distribution.

  //

  ////////////////////////////////////////////////////////////

 

  #ifndef SFML_CONFIG_HPP

  #define SFML_CONFIG_HPP

 

  ////////////////////////////////////////////////////////////

  // Identify the operating system

  ////////////////////////////////////////////////////////////

  #if defined(_WIN32) || defined(__WIN32__)

 

      // Windows
      #define SFML_SYSTEM_WINDOWS
      #ifndef WIN32_LEAN_AND_MEAN
          #define WIN32_LEAN_AND_MEAN
      #endif
      #ifndef NOMINMAX
          #define NOMINMAX
      #endif

 

  #elif defined(linux) || defined(__linux)

 

      // Linux
      #define SFML_SYSTEM_LINUX

 

  #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) ||
  defined(Macintosh)

 

      // MacOS
      #define SFML_SYSTEM_MACOS

 

  #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)

 

      // FreeBSD
      #define SFML_SYSTEM_FREEBSD

 

  #else

 

      // Unsupported system
      #error This operating system is not supported by SFML library

 

  #endif

 

 

  ////////////////////////////////////////////////////////////

  // Define a portable debug macro

  ////////////////////////////////////////////////////////////

  #if !defined(NDEBUG)

 

      #define SFML_DEBUG

 

  #endif

 

 

  ////////////////////////////////////////////////////////////

  // Define portable import / export macros

  ////////////////////////////////////////////////////////////

  #if defined(SFML_SYSTEM_WINDOWS)

 

      #ifdef SFML_DYNAMIC

 

          // Windows platforms
          #ifdef SFML_EXPORTS

 

              // From DLL side, we must export
              #define SFML_API __declspec(dllexport)

 

          #else

 

              // From client application side, we must import
              #define SFML_API __declspec(dllimport)

 

          #endif

 

          // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
          // You can read lots ot different things about it, but the point is the code will
          // just work fine, and so the simplest way to get rid of this warning is to disable it
          #ifdef _MSC_VER

 

              #pragma warning(disable : 4251)

 

          #endif

 

      #else

 

          // No specific directive needed for static build
          #define SFML_API

 

      #endif

 

  #else

 

      // Other platforms don't need to define anything
      #define SFML_API

 

  #endif

 

 

  ////////////////////////////////////////////////////////////

  // Define portable fixed-size types

  ////////////////////////////////////////////////////////////

  #include <climits>

 

  namespace sf

  {

      // 8 bits integer types
      #if UCHAR_MAX == 0xFF
          typedef signed   char Int8;
          typedef unsigned char Uint8;
      #else
          #error No 8 bits integer type for this platform
      #endif

 

      // 16 bits integer types
      #if USHRT_MAX == 0xFFFF
          typedef signed   short Int16;
          typedef unsigned short Uint16;
      #elif UINT_MAX == 0xFFFF
          typedef signed   int Int16;
          typedef unsigned int Uint16;
      #elif ULONG_MAX == 0xFFFF
          typedef signed   long Int16;
          typedef unsigned long Uint16;
      #else
          #error No 16 bits integer type for this platform
      #endif

 

      // 32 bits integer types
      #if USHRT_MAX == 0xFFFFFFFF
          typedef signed   short Int32;
          typedef unsigned short Uint32;
      #elif UINT_MAX == 0xFFFFFFFF
          typedef signed   int Int32;
          typedef unsigned int Uint32;
      #elif ULONG_MAX == 0xFFFFFFFF
          typedef signed   long Int32;
          typedef unsigned long Uint32;
      #else
          #error No 32 bits integer type for this platform
      #endif

 

  } // namespace sf

 

 

  #endif // SFML_CONFIG_HPP

  ": syntax error, unexpected exp_DIVIDE, expecting exp_OPENPARENT or
  exp_NUMBER (1)
Call Stack (most recent call first):
  src/SFML/CMakeLists.txt:22 (find_package)


Found SFML: C:/Program Files (x86)/Microsoft Visual Studio/VC/include
Configuring incomplete, errors occurred!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #21 on: June 10, 2011, 11:39:11 pm »
This may be a bug in FindSFML.cmake. I'll check this as soon as I can.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #22 on: June 11, 2011, 12:05:23 pm »
Should be fixed now.
Laurent Gomila - SFML developer

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Problem configuring csfml2 with cmake
« Reply #23 on: June 11, 2011, 12:18:11 pm »
Quote from: "Laurent"
Should be fixed now.
Thank you for fixing that!

Though I do still have one problem, when I try to compile the solution now, I receive this error (latest snapshot):
Code: [Select]
CMake Error at %APPDATA%/CMake/share/cmake-2.8/Modules/FindSFML.cmake:153 (message):
  SFML found but version too low (requested: 2.0, found: 1.x)
Call Stack (most recent call first):
  src/SFML/CMakeLists.txt:22 (find_package)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #24 on: June 11, 2011, 06:55:30 pm »
The message says it all: you're tring to link CSFML 2 to SFML 1. You must of course use SFML 2.
Laurent Gomila - SFML developer

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
Problem configuring csfml2 with cmake
« Reply #25 on: June 11, 2011, 07:49:08 pm »
Quote from: "Laurent"
The message says it all: you're tring to link CSFML 2 to SFML 1. You must of course use SFML 2.

Now, excuse me if I sound dumb, but does the latest snapshot even include SFML 1?
The PostFX class/header and source files doesn't even exists, only the shader class.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #26 on: June 11, 2011, 09:00:05 pm »
Quote
Now, excuse me if I sound dumb, but does the latest snapshot even include SFML 1?

No.
But the Config.hpp file that we can see in your error message is clearly not from a recent SFML 2 revision.

How do you specify the SFML root directory? Do you use the SDMLDIR CMake variable? The SFMLDIR environment variable? Something else?
Laurent Gomila - SFML developer

MelancholyMechanic

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem configuring csfml2 with cmake
« Reply #27 on: February 09, 2012, 11:31:28 pm »
I'm also having trouble configuring CSFML. I built and installed SFML2 successfully in "C:/dev/libs/SFML" using MinGW and MSYS and the current files from GitHub. However when trying to build CSFML, I get the following error message:
Code: [Select]
CMake Error at c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindSFML.cmake:165 (message):
  Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
  SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY SFML_AUDIO_LIBRARY)
Call Stack (most recent call first):
  src/SFML/CMakeLists.txt:22 (find_package)


This is my configuration (using cmake-gui):



Did I forget to define a variable?

Btw: mingw32-make install didn't install the Find*.cmake files in the corresponding directory of my CMake installation - I had to copy them myself.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem configuring csfml2 with cmake
« Reply #28 on: February 10, 2012, 07:51:05 am »
Did you compile SFML first?

Quote
Btw: mingw32-make install didn't install the Find*.cmake files in the corresponding directory of my CMake installation - I had to copy them myself.

This is the expected behaviour.
Laurent Gomila - SFML developer

MelancholyMechanic

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem configuring csfml2 with cmake
« Reply #29 on: February 10, 2012, 09:31:20 am »
Quote
Did you compile SFML first?

Yes, I have all the sfml-*-2.dll files in "C:/dev/libs/SFML/bin" and all the libsfml-*.a (without the 2 suffix - is that correct?) files in "C:/dev/libs/SFML/lib".

Quote
This is the expected behaviour.

Ah, I misinterpreted this statement then: "You must have installed SFML 2 before, and if you did it successfully, the FindSFML.cmake file should have been copied to your CMake directory."

 

anything