Partage
  • Partager sur Facebook
  • Partager sur Twitter

Problème sfml avec code::blocks

Sujet résolu
    8 octobre 2017 à 11:53:42

    J'ai un problème car je n'arrive pas à installer sfml 2.4 sur code::blocks j'ai suivi se tutoriel https://www.sfml-dev.org/tutorials/2.0/start-cb-fr.phpmais qand je compile se code
    #include <SFML/Graphics.hpp>
    
    int main()
    {
        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);
    
        while (window.isOpen())
        {
            sf::Event event;
            while (window.pollEvent(event))
            {
                if (event.type == sf::Event::Closed)
                    window.close();
            }
    
            window.clear();
            window.draw(shape);
            window.display();
        }
    
        return 0;
    }
    

    Il me retourne des d’erreur

    ||=== Build: Release in testSFML (compiler: GNU GCC Compiler) ===|
    obj\Release\main.o:main.cpp:(.text.startup+0xc5)||undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'|
    obj\Release\main.o:main.cpp:(.text.startup+0xf5)||undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'|
    obj\Release\main.o:main.cpp:(.text.startup+0xed)||undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x12e)||undefined reference to `_imp___ZN2sf11CircleShapeC1Efj'|
    obj\Release\main.o:main.cpp:(.text.startup+0x133)||undefined reference to `_imp___ZN2sf5Color5GreenE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x14f)||undefined reference to `_imp___ZN2sf5Shape12setFillColorERKNS_5ColorE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x172)||undefined reference to `_imp___ZNK2sf6Window6isOpenEv'|
    obj\Release\main.o:main.cpp:(.text.startup+0x1a9)||undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x1db)||undefined reference to `_imp___ZN2sf5ColorC1Ehhhh'|
    obj\Release\main.o:main.cpp:(.text.startup+0x1f3)||undefined reference to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x1f8)||undefined reference to `_imp___ZN2sf12RenderStates7DefaultE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x214)||undefined reference to `_imp___ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x223)||undefined reference to `_imp___ZN2sf6Window7displayEv'|
    obj\Release\main.o:main.cpp:(.text.startup+0x242)||undefined reference to `_imp___ZN2sf6Window5closeEv'|
    obj\Release\main.o:main.cpp:(.text.startup+0x24c)||undefined reference to `_imp___ZTVN2sf11CircleShapeE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x274)||undefined reference to `_imp___ZN2sf5ShapeD2Ev'|
    obj\Release\main.o:main.cpp:(.text.startup+0x28a)||undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'|
    obj\Release\main.o:main.cpp:(.text.startup+0x302)||undefined reference to `_imp___ZTVN2sf11CircleShapeE'|
    obj\Release\main.o:main.cpp:(.text.startup+0x32a)||undefined reference to `_imp___ZN2sf5ShapeD2Ev'|
    obj\Release\main.o:main.cpp:(.text.startup+0x340)||undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'|
    ||error: ld returned 1 exit status|
    ||=== Build failed: 21 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

    De plus qand j'écrie #include <SFML/Graphics.hpp> code::blocks me propose de l'ecrire

    Je ne trouve pas de solution j'ai essayer de le réinstaller sans resultat

    • Partager sur Facebook
    • Partager sur Twitter
    Anonyme
      8 octobre 2017 à 15:16:50

      Essayes toutes les versions MinGW (j'ai fait pareil :p). Ou plutot, donne moi la version de ton systeme, je te repondrais quelle version prendre.

      Tu risques aussi d'avoir besoin de certaines .dll n'etant pas fournie dans SFML pour executer ton code en dehors de C::B. Ce sont les .dll de ton compilo!

      • Partager sur Facebook
      • Partager sur Twitter
        8 octobre 2017 à 16:41:09

        D'accord ma version de MinGW est celle fournise par c::b en suivant le tuto on ma dit que c'etait la version SJLJ qu'il falait j'ai donc pris celle-ci
        • Partager sur Facebook
        • Partager sur Twitter
        Anonyme
          11 octobre 2017 à 16:28:42

          Non j'ai toujours les même problème pour information je suis sur Windows 10

          • Partager sur Facebook
          • Partager sur Twitter
          Anonyme
            14 octobre 2017 à 14:09:40

            C'est donc un probleme de compilation, essaye avec l'autre version de GCC (en fait, si tu n'as pas la version adaptee a ton compilo, ca ne vas pas compiler, et si tu n'as pas la version adaptee a ton system, ca va compiler, mais les .dll ne seront pas les bons donc ca ne va pas se lancer)! Il me semble que j'avais justement ete surpris.
            • Partager sur Facebook
            • Partager sur Twitter
              14 octobre 2017 à 14:37:31

              Ok je vais essayer ca des que j'ai accès a mon ordinateur
              • Partager sur Facebook
              • Partager sur Twitter
                14 octobre 2017 à 18:53:26

                Salut,

                Pourrais tu nous donner le résultat de la commande 

                g++ --version

                C'est le seul moyen de savoir de quelle version tu dispose ;)

                • Partager sur Facebook
                • Partager sur Twitter
                Ce qui se conçoit bien s'énonce clairement. Et les mots pour le dire viennent aisément.Mon nouveau livre : Coder efficacement - Bonnes pratiques et erreurs  à éviter (en C++)Avant de faire ce que tu ne pourras défaire, penses à tout ce que tu ne pourras plus faire une fois que tu l'auras fait
                  22 octobre 2017 à 18:21:33

                  Ou faut t'il taper cette commande

                  • Partager sur Facebook
                  • Partager sur Twitter
                  Anonyme
                    23 octobre 2017 à 11:20:34

                    Eh ben en fait, ca depend:

                    Si tu es sous Linux, c'est Ctrl+Alt+T.

                    Si tu es sous Windows : clique droit sur Démarrer->ouvrir l'invite de commande/Windows PowerShell.

                    Si tu es sous Mac OS, je sais pas...

                    Note que le terminal Windows ne fonctionne pas comme le terminal Linux! Perso, quand j'ai tente de lancer la commande, il m'a dit qu'il n'acceptait pas le --version ni -version ou version...

                    -
                    Edité par Anonyme 25 octobre 2017 à 14:57:27

                    • Partager sur Facebook
                    • Partager sur Twitter
                      23 octobre 2017 à 18:26:49

                      Je pense avoir fait comme il fallait (j'ai des doute) mais voila toute les erreur :

                      PS C:\Program Files\CodeBlocks\MinGW> g++ --version
                      g++ : Le terme «g++» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme
                      exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès est correct
                      et réessayez.
                      Au caractère Ligne:1 : 1
                      + g++ --version
                      + ~~~
                          + CategoryInfo          : ObjectNotFound: (g++:String) [], CommandNotFoundException
                          + FullyQualifiedErrorId : CommandNotFoundException
                      
                      PS C:\Program Files\CodeBlocks\MinGW>



                      • Partager sur Facebook
                      • Partager sur Twitter
                        23 octobre 2017 à 18:39:33

                        Ca, c'est le coup classique de MinGW qui n'a pas modifié durablement la variable PATH.

                        Il y a deux solutions:

                        dans le dossier dans lequel tu as installé MinGW, il se peut que tu trouves un fichier bat nommé (par exemple) open_distro_window.bat.

                        Si tu double clique sur ce fichier, il te lancera une ligne de commande qui sait qu'elle doit aller chercher dans les bons dossiers.  Avec cette ligne de commande g++ --version fonctionnera.

                        Au pire, si tu n'a pas un fichier bat qui définit temporairement la variable PATH pour aider windows à trouver Gcc, tu lance l'invite de commande comme l'a indiqué gbdivers puis:

                        tu cherches le dossier d'installation de MinGW (par exemple, ce sera c:\MinGW)

                        tu lances la commande

                        set PATH= c:\MinGW\bin;%PATH%

                        (à condition bien sur que MinGW soit installé dans c:\MinGW... à adapter en conséquence ;) )

                        Une fois que ce sera fait, tu pourras invoquer la commande que l'on te demande.

                        • Partager sur Facebook
                        • Partager sur Twitter
                        Ce qui se conçoit bien s'énonce clairement. Et les mots pour le dire viennent aisément.Mon nouveau livre : Coder efficacement - Bonnes pratiques et erreurs  à éviter (en C++)Avant de faire ce que tu ne pourras défaire, penses à tout ce que tu ne pourras plus faire une fois que tu l'auras fait
                          26 octobre 2017 à 16:26:09

                          Merci j'ai avancer sur les deux solution mais sur les deux j'ai des erreur

                          J'ai trouver un fichier bat minwgvars.bat mais quand je l’ouvre il se ferme tout de suite

                          Pour compiler sfml cmake me retourne une erreur comme error in configuration process, project file may be invalide

                          • Partager sur Facebook
                          • Partager sur Twitter
                          Anonyme
                            27 octobre 2017 à 18:26:16

                            Ca veut dire que le fichier de ton projet est soit inexistant, soit mal declare, soit corrompu, etc... Bref: inutilisable. As tu pense a l'extension?
                            • Partager sur Facebook
                            • Partager sur Twitter
                              3 décembre 2017 à 12:39:35

                              Bon je m’excuse pour mon absence mais j'ai complétement oublier bref.

                              Je suis débutant est je ne sais pas se qu'est l'extension, powerShell ...

                              A t-il un tuto pour comprendre du début? Comme ça je pourrait y voir un peu plus clair.

                              • Partager sur Facebook
                              • Partager sur Twitter
                              Anonyme
                                3 décembre 2017 à 13:53:08

                                sumnayono a écrit:

                                Bon je m’excuse pour mon absence mais j'ai complétement oublier bref.

                                Tu es pardonne!^^

                                sumnayono a écrit:

                                Je suis débutant est je ne sais pas se qu'est l'extension, powerShell ...

                                L'extension d'un fichier, c'est le .untruc qui va determiner le type de fichier. Et oui, on ne lance pas comme un programme (.exe) du texte (.txt)! Pour y voir plus claire, ouvre l'explorateur de fichiers et clique sur affichage->afficher/masquer->extension du nom des fichiers.

                                Le powerShell, c'est l'invite de commande Windows! Tu peux y acceder en faisant Super(Windows)+R et en tapant cmd ou encore en faisant un clique droit sur le logo Windows en bas a gauche et en cliquant sur "ouvrir l'invite de commandes/PowerShell".

                                sumnayono a écrit:

                                A t-il un tuto pour comprendre du début? Comme ça je pourrait y voir un peu plus clair.

                                Je crois pas... Enfin, on peut dire que j'ai repondu a tes questions!

                                • Partager sur Facebook
                                • Partager sur Twitter
                                  12 décembre 2017 à 15:53:13

                                  Ok merci pour ton aide,

                                  je savais se qu'est l'extension mais comme la question me paraissez byzard je me suis dit que ce n’était pas la même extension, mais maintenant j'ai compris, mais ou faut-il mettre l'extension.

                                  Petite question serait t-il pas plus facile de le faire avec VS

                                  -
                                  Edité par sumnayono 12 décembre 2017 à 16:06:28

                                  • Partager sur Facebook
                                  • Partager sur Twitter
                                  Anonyme
                                    13 décembre 2017 à 16:34:06

                                    Bon, sinon, ce que tu peux tenter de faire, c'est:

                                    Clic droit sur le fichier de projet cmake->Ouvrir avec->bloc notes

                                    et poste le contenu du fichier. De mon côté, je vais voir comment sont édités les fichiers cmake.

                                    sumnayono a écrit:

                                    Mais ou faut-il mettre l'extension?

                                    A la fin du nom de ton fichier (en fait, je me disais (ou du moins, j'espérais) qu'il n'avait peut-être pas l'extension d'un fichier cmake, ce qui serais plus simple à corriger).

                                    sumnayono a écrit:

                                    Petite question serait t-il pas plus facile de le faire avec VS

                                    Aucune idée, en tout cas, on ne perd rien à essayer. D'ailleurs, pour ce fameux g++, essaye ça:

                                    "C:\Program Files (x86)\CodeBlocks\MinGW\bin\g++.exe" //version
                                    • Partager sur Facebook
                                    • Partager sur Twitter
                                      16 décembre 2017 à 16:09:08

                                      J'ai trouver CMakeLists dans SFML-SOURCE :

                                      cmake_minimum_required(VERSION 2.8.3)
                                      
                                      # define a macro that helps defining an option
                                      macro(sfml_set_option var default type docstring)
                                          if(NOT DEFINED ${var})
                                              set(${var} ${default})
                                          endif()
                                          set(${var} ${${var}} CACHE ${type} ${docstring} FORCE)
                                      endmacro()
                                      
                                      # these options have to be set before CMake detects/configures the toolchain
                                      
                                      # determine whether to create a debug or release build
                                      sfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
                                      
                                      # Suppress Cygwin legacy warning
                                      set(CMAKE_LEGACY_CYGWIN_WIN32 0)
                                      
                                      # set Android specific options
                                      
                                      # define the minimum API level to be used
                                      sfml_set_option(ANDROID_API_MIN 9 STRING "Choose the Android API level to be used (minimum 9)")
                                      # mirror the setting for the toolchain file
                                      set(ANDROID_NATIVE_API_LEVEL ${ANDROID_API_MIN})
                                      
                                      # define the path to the Android NDK
                                      sfml_set_option(ANDROID_NDK "$ENV{ANDROID_NDK}" PATH "Path to the Android NDK")
                                      
                                      # define the STL implementation to be used
                                      sfml_set_option(ANDROID_STL c++_shared STRING "Choose the STL implementation to be used (experimental)")
                                      
                                      # default the ABI to ARM v7a for hardware floating point
                                      if(NOT ANDROID_ABI)
                                          set(ANDROID_ABI armeabi-v7a)
                                      endif()
                                      
                                      #end of Android specific options
                                      
                                      # project name
                                      project(SFML)
                                      
                                      # include the configuration file
                                      include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake)
                                      
                                      # setup version numbers
                                      set(VERSION_MAJOR 2)
                                      set(VERSION_MINOR 4)
                                      set(VERSION_PATCH 2)
                                      
                                      # add the SFML header path
                                      include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
                                      
                                      # add an option for choosing the build type (shared or static)
                                      if(NOT (SFML_OS_IOS OR SFML_OS_ANDROID))
                                          sfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries")
                                      else()
                                          if(SFML_OS_IOS)
                                              set(BUILD_SHARED_LIBS FALSE)
                                          elseif(SFML_OS_ANDROID)
                                              set(BUILD_SHARED_LIBS TRUE)
                                          endif()
                                      endif()
                                      
                                      # add an option for building the examples
                                      if(NOT (SFML_OS_IOS OR SFML_OS_ANDROID))
                                          sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples, FALSE to ignore them")
                                      else()
                                          set(SFML_BUILD_EXAMPLES FALSE)
                                      endif()
                                      
                                      # add an option for building the API documentation
                                      sfml_set_option(SFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
                                      
                                      # add an option for choosing the OpenGL implementation
                                      sfml_set_option(SFML_OPENGL_ES ${OPENGL_ES} BOOL "TRUE to use an OpenGL ES implementation, FALSE to use a desktop OpenGL implementation")
                                      
                                      # Mac OS X specific options
                                      if(SFML_OS_MACOSX)
                                          # add an option to build frameworks instead of dylibs (release only)
                                          sfml_set_option(SFML_BUILD_FRAMEWORKS FALSE BOOL "TRUE to build SFML as frameworks libraries (release only), FALSE to build according to BUILD_SHARED_LIBS")
                                      
                                          # add an option to let the user specify a custom directory for frameworks installation (SFML, FLAC, ...)
                                          sfml_set_option(CMAKE_INSTALL_FRAMEWORK_PREFIX "/Library/Frameworks" STRING "Frameworks installation directory")
                                      
                                          # add an option to automatically install Xcode templates
                                          sfml_set_option(SFML_INSTALL_XCODE_TEMPLATES FALSE BOOL "TRUE to automatically install the Xcode templates, FALSE to do nothing about it. The templates are compatible with Xcode 4 and 5.")
                                      endif()
                                      
                                      # Android options
                                      if(SFML_OS_ANDROID)
                                          # make sure there's the android library available
                                          if (${ANDROID_API_MIN} LESS 9)
                                              message(FATAL_ERROR "Android API level must be equal or greater than 9. Please adjust the CMake variable 'ANDROID_API_MIN'.")
                                          endif()
                                      
                                          if(NOT ANDROID_NDK)
                                              message(FATAL_ERROR "The Android NDK couldn't be found. Please adjust the CMake variable 'ANDROID_NDK' to point to the NDK directory.")
                                          endif()
                                      
                                          # CMake doesn't support defining the STL to be used with Nsight Tegra, so warn the user
                                          if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
                                              message(WARNING "CMake might not properly support setting the STL. Make sure to adjust all generated library projects!")
                                          endif()
                                      
                                          # install everything in $NDK/sources/ because this path is appended by the NDK (convenient)
                                          set(CMAKE_INSTALL_PREFIX ${ANDROID_NDK}/sources/sfml)
                                      
                                          # we install libs in a subdirectory named after the ABI (lib/mips/*.so)
                                          set(LIB_SUFFIX "/${ANDROID_ABI}")
                                      
                                          # pass shared STL configuration (if any)
                                          if (ANDROID_STL MATCHES "_shared")
                                              add_definitions("-DSTL_LIBRARY=${ANDROID_STL}")
                                          endif()
                                      
                                          # this is a workaround to compile sfml-activity without the stl library as a dependency
                                          # we save the original compilation command line to restore it later in Macro.cmake
                                          set(CMAKE_CXX_CREATE_SHARED_LIBRARY_WITH_STL ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
                                          set(CMAKE_CXX_CREATE_SHARED_LIBRARY_WITHOUT_STL "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
                                      else()
                                          unset(ANDROID_ABI CACHE)
                                          unset(ANDROID_API_MIN CACHE)
                                          unset(ANDROID_STL CACHE)
                                          unset(ANDROID_NATIVE_API_LEVEL CACHE)
                                          unset(ANDROID_NDK CACHE)
                                      endif()
                                      
                                      # define SFML_STATIC if the build type is not set to 'shared'
                                      if(NOT BUILD_SHARED_LIBS)
                                          add_definitions(-DSFML_STATIC)
                                      endif()
                                      
                                      # Visual C++: remove warnings regarding SL security and algorithms on pointers
                                      if(SFML_COMPILER_MSVC)
                                          # add an option to choose whether PDB debug symbols should be generated (defaults to true when possible)
                                          if(CMAKE_VERSION VERSION_LESS 3.1)
                                              sfml_set_option(SFML_GENERATE_PDB FALSE BOOL "True to generate PDB debug symbols, FALSE otherwise. Requires CMake 3.1.")
                                              if(SFML_GENERATE_PDB)
                                                  message(FATAL_ERROR "Generation of PDB files (SFML_GENERATE_PDB) requires at least CMake 3.1.0")
                                              endif()
                                          else()
                                              sfml_set_option(SFML_GENERATE_PDB TRUE BOOL "True to generate PDB debug symbols, FALSE otherwise. Requires CMake 3.1.")
                                          endif()
                                      
                                          add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
                                      endif()
                                      
                                      # define SFML_OPENGL_ES if needed
                                      if(SFML_OPENGL_ES)
                                          add_definitions(-DSFML_OPENGL_ES)
                                          add_definitions(-DGL_GLEXT_PROTOTYPES)
                                      endif()
                                      
                                      # define an option for choosing between static and dynamic C runtime (Windows only)
                                      if(SFML_OS_WINDOWS)
                                          sfml_set_option(SFML_USE_STATIC_STD_LIBS FALSE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
                                      
                                          # the following combination of flags is not valid
                                          if (BUILD_SHARED_LIBS AND SFML_USE_STATIC_STD_LIBS)
                                              message(FATAL_ERROR "BUILD_SHARED_LIBS and SFML_USE_STATIC_STD_LIBS cannot be used together")
                                          endif()
                                      
                                          # for VC++, we can apply it globally by modifying the compiler flags
                                          if(SFML_COMPILER_MSVC AND SFML_USE_STATIC_STD_LIBS)
                                              foreach(flag
                                                      CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
                                                      CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
                                                  if(${flag} MATCHES "/MD")
                                                      string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
                                                  endif()
                                              endforeach()
                                          endif()
                                      endif()
                                      
                                      # setup Mac OS X stuff
                                      if(SFML_OS_MACOSX)
                                          # SFML_BUILD_FRAMEWORKS needs two things:
                                          # first, it's available only for release
                                          #    (because cmake currently doesn't allow specifying a custom framework name so XXX-d is not possible)
                                          # secondly, it works only with BUILD_SHARED_LIBS enabled
                                          if(SFML_BUILD_FRAMEWORKS)
                                              # requirement #1
                                              if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
                                                  message(FATAL_ERROR "CMAKE_BUILD_TYPE should be \"Release\" when SFML_BUILD_FRAMEWORKS is TRUE")
                                                  return()
                                              endif()
                                      
                                              # requirement #2
                                              if(NOT BUILD_SHARED_LIBS)
                                                  message(FATAL_ERROR "BUILD_SHARED_LIBS should be TRUE when SFML_BUILD_FRAMEWORKS is TRUE")
                                                  return()
                                              endif()
                                          endif()
                                      
                                          # only the default architecture (i.e. 64-bit) is supported
                                          if(CMAKE_OSX_ARCHITECTURES AND NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
                                              message(FATAL_ERROR "Only 64-bit architecture is supported")
                                              return()
                                          endif()
                                              
                                          # configure Xcode templates
                                          set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)")
                                      endif()
                                      
                                      if(SFML_OS_LINUX OR SFML_OS_FREEBSD)
                                          set(PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
                                          if(SFML_OS_FREEBSD)
                                              set(PKGCONFIG_DIR libdata/pkgconfig)
                                          endif()
                                          if(BUILD_SHARED_LIBS)
                                              sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES FALSE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
                                              if(SFML_INSTALL_PKGCONFIG_FILES)
                                                  foreach(sfml_module IN ITEMS all system window graphics audio network)
                                                      CONFIGURE_FILE(
                                                          "tools/pkg-config/sfml-${sfml_module}.pc.in"
                                                          "tools/pkg-config/sfml-${sfml_module}.pc"
                                                          @ONLY)
                                                      INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
                                                          DESTINATION "${CMAKE_INSTALL_PREFIX}/${PKGCONFIG_DIR}")
                                                  endforeach()
                                              endif()
                                          else()
                                              if(SFML_INSTALL_PKGCONFIG_FILES)
                                                  message(WARNING "No pkg-config files are provided for the static SFML libraries (SFML_INSTALL_PKGCONFIG_FILES will be ignored).")
                                              endif()
                                          endif()
                                      endif()
                                      
                                      # enable project folders
                                      set_property(GLOBAL PROPERTY USE_FOLDERS ON)
                                      set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
                                      
                                      # add the subdirectories
                                      add_subdirectory(src/SFML)
                                      if(SFML_BUILD_EXAMPLES)
                                          add_subdirectory(examples)
                                      endif()
                                      if(SFML_BUILD_DOC)
                                          add_subdirectory(doc)
                                      endif()
                                      
                                      # setup the install rules
                                      if(NOT SFML_BUILD_FRAMEWORKS)
                                          install(DIRECTORY include
                                                  DESTINATION .
                                                  COMPONENT devel
                                                  FILES_MATCHING PATTERN "*.hpp" PATTERN "*.inl")
                                      
                                          if(SFML_GENERATE_PDB)
                                              install(DIRECTORY ${PROJECT_BINARY_DIR}/lib
                                                      DESTINATION .
                                                      COMPONENT devel
                                                      FILES_MATCHING PATTERN "*.pdb")
                                          endif()
                                      else()
                                          # find only "root" headers
                                          file(GLOB SFML_HEADERS RELATIVE ${PROJECT_SOURCE_DIR} "include/SFML/*")
                                      
                                          # in fact we have to fool cmake to copy all the headers in subdirectories
                                          # to do that we have to add the "root" headers to the PUBLIC_HEADER
                                          # then we can run a post script to copy the remaining headers
                                      
                                          # we need a dummy file in order to compile the framework
                                          add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
                                                             COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
                                      
                                          set(SFML_SOURCES ${SFML_HEADERS})
                                          list(APPEND SFML_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
                                      
                                          # create SFML.framework
                                          add_library(SFML ${SFML_SOURCES})
                                      
                                          # edit target properties
                                          set_target_properties(SFML PROPERTIES
                                                                FRAMEWORK TRUE
                                                                FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
                                                                MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.SFML
                                                                MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
                                                                MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
                                                                PUBLIC_HEADER "${SFML_HEADERS}")
                                      
                                          # add the remaining headers
                                          add_custom_command(TARGET SFML
                                                             POST_BUILD
                                                             COMMAND cp -r ${PROJECT_SOURCE_DIR}/include/SFML/* $<TARGET_FILE_DIR:SFML>/Headers)
                                      
                                          # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
                                          # NOTE: it's not required to link against SFML.framework
                                          set_target_properties(SFML PROPERTIES
                                                                BUILD_WITH_INSTALL_RPATH 1
                                                                INSTALL_NAME_DIR "@rpath")
                                      
                                          # install rule
                                          install(TARGETS SFML
                                                  FRAMEWORK DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX}
                                                  COMPONENT devel)
                                      endif()
                                      
                                      install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
                                      install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR})
                                      if(NOT SFML_OS_ANDROID)
                                          install(FILES cmake/Modules/FindSFML.cmake DESTINATION ${INSTALL_MISC_DIR}/cmake/Modules)
                                      endif()
                                      
                                      # install 3rd-party libraries and tools
                                      if(SFML_OS_WINDOWS)
                                      
                                          # install the binaries of SFML dependencies
                                          if(ARCH_32BITS)
                                              install(DIRECTORY extlibs/bin/x86/ DESTINATION bin)
                                              if(SFML_COMPILER_MSVC AND SFML_MSVC_VERSION LESS 14)
                                                  install(DIRECTORY extlibs/libs-msvc/x86/ DESTINATION lib)
                                              elseif(SFML_COMPILER_MSVC)
                                                  install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION lib)
                                              else()
                                                  install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION lib)
                                              endif()
                                          elseif(ARCH_64BITS)
                                              install(DIRECTORY extlibs/bin/x64/ DESTINATION bin)
                                              if(SFML_COMPILER_MSVC AND SFML_MSVC_VERSION LESS 14)
                                                  install(DIRECTORY extlibs/libs-msvc/x64/ DESTINATION lib)
                                              elseif(SFML_COMPILER_MSVC)
                                                  install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION lib)
                                              else()
                                                  install(DIRECTORY extlibs/libs-mingw/x64/ DESTINATION lib)
                                              endif()
                                          endif()
                                      
                                      elseif(SFML_OS_MACOSX)
                                      
                                          # install extlibs dependencies only when used
                                          if("${FLAC_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/FLAC.framework")
                                              install(DIRECTORY extlibs/libs-osx/Frameworks/FLAC.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          if("${FREETYPE_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/freetype.framework")
                                              install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          if("${OGG_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/ogg.framework")
                                              install(DIRECTORY extlibs/libs-osx/Frameworks/ogg.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          if("${VORBIS_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/vorbis.framework")
                                              install(DIRECTORY extlibs/libs-osx/Frameworks/vorbis.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          if("${VORBISENC_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/vorbisenc.framework")
                                              install(DIRECTORY extlibs/libs-osx/Frameworks/vorbisenc.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          if("${VORBISFILE_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/vorbisfile.framework")
                                              install(DIRECTORY extlibs/libs-osx/Frameworks/vorbisfile.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          if("${OPENAL_LIBRARY}" STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/OpenAL.framework")
                                              install(DIRECTORY "${OPENAL_LIBRARY}" DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
                                          endif()
                                      
                                          # install the Xcode templates if requested
                                          if(SFML_INSTALL_XCODE_TEMPLATES)
                                              # configure the templates plist files
                                              foreach(TEMPLATE "SFML Compiler" "SFML App")
                                                  configure_file(
                                                              "tools/xcode/templates/SFML/${TEMPLATE}.xctemplate/TemplateInfo.plist.in"
                                                              "${CMAKE_CURRENT_BINARY_DIR}/tools/xcode/templates/SFML/${TEMPLATE}.xctemplate/TemplateInfo.plist"
                                                              @ONLY)
                                              endforeach()
                                              install(DIRECTORY "tools/xcode/templates/SFML" "${CMAKE_CURRENT_BINARY_DIR}/tools/xcode/templates/SFML"
                                                      DESTINATION /Library/Developer/Xcode/Templates
                                                      PATTERN "*.in" EXCLUDE
                                                      PATTERN ".DS_Store" EXCLUDE)
                                          endif()
                                      
                                      elseif(SFML_OS_IOS)
                                      
                                          # fix CMake install rules broken for iOS (see http://public.kitware.com/Bug/view.php?id=12506)
                                          if(SFML_OS_IOS)
                                              install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/\$ENV{CONFIGURATION}/" DESTINATION lib${LIB_SUFFIX})
                                          endif()
                                      
                                          # since the iOS libraries are built as static, we must install the SFML dependencies
                                          # too so that the end user can easily link them to its final application
                                          install(FILES extlibs/libs-ios/libfreetype.a extlibs/libs-ios/libjpeg.a DESTINATION lib)
                                      
                                      elseif(SFML_OS_ANDROID)
                                      
                                          # install extlibs
                                          install(DIRECTORY extlibs/libs-android/${ANDROID_ABI} DESTINATION extlibs/lib)
                                          install(FILES extlibs/Android.mk DESTINATION extlibs)
                                      
                                          # install Android.mk so the NDK knows how to set up SFML
                                          install(FILES src/SFML/Android.mk DESTINATION .)
                                      
                                      endif()
                                      

                                      Puis il y avait un dossier cmake qui contenait :

                                      Config.cmake :

                                      # detect the OS
                                      if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
                                          set(SFML_OS_WINDOWS 1)
                                      
                                          # don't use the OpenGL ES implementation on Windows
                                          set(OPENGL_ES 0)
                                      
                                          # detect the architecture (note: this test won't work for cross-compilation)
                                          include(CheckTypeSize)
                                          check_type_size(void* SIZEOF_VOID_PTR)
                                          if(${SIZEOF_VOID_PTR} STREQUAL "4")
                                              set(ARCH_32BITS 1)
                                          elseif(${SIZEOF_VOID_PTR} STREQUAL "8")
                                              set(ARCH_64BITS 1)
                                          else()
                                              message(FATAL_ERROR "Unsupported architecture")
                                              return()
                                          endif()
                                      elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
                                          set(SFML_OS_UNIX 1)
                                          if(ANDROID)
                                              set(SFML_OS_ANDROID 1)
                                              # use the OpenGL ES implementation on Android
                                              set(OPENGL_ES 1)
                                          else()
                                              set(SFML_OS_LINUX 1)
                                              # don't use the OpenGL ES implementation on Linux
                                              set(OPENGL_ES 0)
                                          endif()
                                      elseif(CMAKE_SYSTEM_NAME MATCHES "^k?FreeBSD$")
                                          set(SFML_OS_FREEBSD 1)
                                          # don't use the OpenGL ES implementation on FreeBSD
                                          set(OPENGL_ES 0)
                                      elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
                                          if(IOS)
                                              set(SFML_OS_IOS 1)
                                      
                                              # set the target framework and platforms
                                              set(CMAKE_OSX_SYSROOT "iphoneos")
                                              set(CMAKE_OSX_ARCHITECTURES "armv6;armv7;i386")
                                              set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
                                      
                                              # help the compiler detection script below
                                              set(CMAKE_COMPILER_IS_GNUCXX 1)
                                      
                                              # use the OpenGL ES implementation on iOS
                                              set(OPENGL_ES 1)
                                          else()
                                              set(SFML_OS_MACOSX 1)
                                      
                                              # don't use the OpenGL ES implementation on Mac OS X
                                              set(OPENGL_ES 0)
                                      
                                              # detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
                                              EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
                                              STRING(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
                                              if(${MACOSX_VERSION} LESS 7)
                                                  message(FATAL_ERROR "Unsupported version of OS X: ${MACOSX_VERSION_RAW}")
                                                  return()
                                              endif()
                                          endif()
                                      elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
                                          set(SFML_OS_ANDROID 1)
                                      
                                          # use the OpenGL ES implementation on Android
                                          set(OPENGL_ES 1)
                                      # comparing CMAKE_SYSTEM_NAME with "CYGWIN" generates a false warning depending on the CMake version
                                      # let's avoid it so the actual error is more visible
                                      elseif(${CYGWIN})
                                          message(FATAL_ERROR "Unfortunately SFML doesn't support Cygwin's 'hybrid' status between both Windows and Linux derivatives.\nIf you insist on using the GCC, please use a standalone build of MinGW without the Cygwin environment instead.")
                                      else()
                                          message(FATAL_ERROR "Unsupported operating system or environment")
                                          return()
                                      endif()
                                      
                                      # detect the compiler and its version
                                      # Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true
                                      # even when CLANG is used, therefore the Clang test is done first
                                      if(CMAKE_CXX_COMPILER MATCHES ".*clang[+][+]" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
                                         # CMAKE_CXX_COMPILER_ID is an internal CMake variable subject to change,
                                         # but there is no other way to detect CLang at the moment
                                         set(SFML_COMPILER_CLANG 1)
                                         execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
                                         string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" SFML_CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
                                      elseif(CMAKE_COMPILER_IS_GNUCXX)
                                          set(SFML_COMPILER_GCC 1)
                                          execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
                                          string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" SFML_GCC_VERSION "${GCC_VERSION_OUTPUT}")
                                          execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION)
                                          string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}")
                                          execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE)
                                          string(STRIP "${GCC_MACHINE}" GCC_MACHINE)
                                          if(GCC_MACHINE MATCHES ".*w64.*")
                                              set(SFML_COMPILER_GCC_W64 1)
                                          endif()
                                      elseif(MSVC)
                                          set(SFML_COMPILER_MSVC 1)
                                          if(MSVC_VERSION EQUAL 1400)
                                              set(SFML_MSVC_VERSION 8)
                                          elseif(MSVC_VERSION EQUAL 1500)
                                              set(SFML_MSVC_VERSION 9)
                                          elseif(MSVC_VERSION EQUAL 1600)
                                              set(SFML_MSVC_VERSION 10)
                                          elseif(MSVC_VERSION EQUAL 1700)
                                              set(SFML_MSVC_VERSION 11)
                                          elseif(MSVC_VERSION EQUAL 1800)
                                              set(SFML_MSVC_VERSION 12)
                                          elseif(MSVC_VERSION EQUAL 1900)
                                              set(SFML_MSVC_VERSION 14)
                                          endif()
                                      else()
                                          message(FATAL_ERROR "Unsupported compiler")
                                          return()
                                      endif()
                                      
                                      # define the install directory for miscellaneous files
                                      if(SFML_OS_WINDOWS OR SFML_OS_IOS)
                                          set(INSTALL_MISC_DIR .)
                                      elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX)
                                          set(INSTALL_MISC_DIR share/SFML)
                                      elseif(SFML_OS_ANDROID)
                                          set(INSTALL_MISC_DIR ${ANDROID_NDK}/sources/sfml)
                                      endif()
                                      

                                      Et un autre Macros.cmake :

                                      include(CMakeParseArguments)
                                      
                                      # add a new target which is a SFML library
                                      # ex: sfml_add_library(sfml-graphics
                                      #                      SOURCES sprite.cpp image.cpp ...
                                      #                      DEPENDS sfml-window sfml-system
                                      #                      EXTERNAL_LIBS opengl freetype ...)
                                      macro(sfml_add_library target)
                                      
                                          # parse the arguments
                                          cmake_parse_arguments(THIS "" "" "SOURCES;DEPENDS;EXTERNAL_LIBS" ${ARGN})
                                      
                                          # create the target
                                          add_library(${target} ${THIS_SOURCES})
                                      
                                          # define the export symbol of the module
                                          string(REPLACE "-" "_" NAME_UPPER "${target}")
                                          string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
                                          set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
                                      
                                          # adjust the output file prefix/suffix to match our conventions
                                          if(BUILD_SHARED_LIBS)
                                              if(SFML_OS_WINDOWS)
                                                  # include the major version number in Windows shared library names (but not import library names)
                                                  set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
                                                  set_target_properties(${target} PROPERTIES SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
                                              else()
                                                  set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
                                              endif()
                                              if (SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
                                                  # on Windows/gcc get rid of "lib" prefix for shared libraries,
                                                  # and transform the ".dll.a" suffix into ".a" for import libraries
                                                  set_target_properties(${target} PROPERTIES PREFIX "")
                                                  set_target_properties(${target} PROPERTIES IMPORT_SUFFIX ".a")
                                              endif()
                                          else()
                                              set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -s-d)
                                              set_target_properties(${target} PROPERTIES RELEASE_POSTFIX -s)
                                              set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
                                              set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
                                          endif()
                                      
                                          # set the version and soversion of the target (for compatible systems -- mostly Linuxes)
                                          # except for Android which strips soversion suffixes
                                          if(NOT SFML_OS_ANDROID)
                                              set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR})
                                              set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
                                          endif()
                                      
                                          # set the target's folder (for IDEs that support it, e.g. Visual Studio)
                                          set_target_properties(${target} PROPERTIES FOLDER "SFML")
                                      
                                          # for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
                                          if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
                                              if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
                                                  set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
                                              elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
                                                  set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
                                              endif()
                                          endif()
                                      
                                          # For Visual Studio on Windows, export debug symbols (PDB files) to lib directory
                                          if(SFML_GENERATE_PDB)
                                              # PDB files are only generated in Debug and RelWithDebInfo configurations, find out which one
                                              if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
                                                  set(SFML_PDB_POSTFIX "-d")
                                              else()
                                                  set(SFML_PDB_POSTFIX "")
                                              endif()
                                      
                                              if(BUILD_SHARED_LIBS)
                                                  # DLLs export debug symbols in the linker PDB (the compiler PDB is an intermediate file)
                                                  set_target_properties(${target} PROPERTIES
                                                                        PDB_NAME "${target}${SFML_PDB_POSTFIX}"
                                                                        PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
                                              else()
                                                  # Static libraries have no linker PDBs, thus the compiler PDBs are relevant
                                                  set_target_properties(${target} PROPERTIES
                                                                        COMPILE_PDB_NAME "${target}-s${SFML_PDB_POSTFIX}"
                                                                        COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
                                              endif()
                                          endif()
                                      
                                          # if using gcc >= 4.0 or clang >= 3.0 on a non-Windows platform, we must hide public symbols by default
                                          # (exported ones are explicitly marked)
                                          if(NOT SFML_OS_WINDOWS AND ((SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4") OR (SFML_COMPILER_CLANG AND NOT SFML_CLANG_VERSION VERSION_LESS "3")))
                                              set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
                                          endif()
                                      
                                          # link the target to its SFML dependencies
                                          if(THIS_DEPENDS)
                                              target_link_libraries(${target} ${THIS_DEPENDS})
                                          endif()
                                      
                                          # build frameworks or dylibs
                                          if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS)
                                              if(SFML_BUILD_FRAMEWORKS)
                                                  # adapt target to build frameworks instead of dylibs
                                                  set_target_properties(${target} PROPERTIES
                                                                        FRAMEWORK TRUE
                                                                        FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
                                                                        MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.${target}
                                                                        MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
                                                                        MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
                                              endif()
                                      
                                              # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
                                              set_target_properties(${target} PROPERTIES
                                                                    BUILD_WITH_INSTALL_RPATH 1
                                                                    INSTALL_NAME_DIR "@rpath")
                                          endif()
                                      
                                          # enable automatic reference counting on iOS
                                          if (SFML_OS_IOS)
                                              set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
                                          endif()
                                      
                                          # sfml-activity library is our bootstrap activity and must not depend on stlport_shared
                                          # (otherwise Android will fail to load it)
                                          if (SFML_OS_ANDROID)
                                              if (${target} MATCHES "sfml-activity")
                                                  set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fpermissive)
                                                  set_target_properties(${target} PROPERTIES LINK_FLAGS "-landroid -llog")
                                                  set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY_WITHOUT_STL})
                                              else()
                                                  set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY_WITH_STL})
                                              endif()
                                          endif()
                                      
                                          # link the target to its external dependencies
                                          if(THIS_EXTERNAL_LIBS)
                                              target_link_libraries(${target} ${THIS_EXTERNAL_LIBS})
                                          endif()
                                      
                                          # add the install rule
                                          install(TARGETS ${target}
                                                  RUNTIME DESTINATION bin COMPONENT bin
                                                  LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
                                                  ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel
                                                  FRAMEWORK DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX} COMPONENT bin)
                                      endmacro()
                                      
                                      # add a new target which is a SFML example
                                      # ex: sfml_add_example(ftp
                                      #                      SOURCES ftp.cpp ...
                                      #                      DEPENDS sfml-network sfml-system)
                                      macro(sfml_add_example target)
                                      
                                          # parse the arguments
                                          cmake_parse_arguments(THIS "GUI_APP" "" "SOURCES;DEPENDS" ${ARGN})
                                      
                                          # set a source group for the source files
                                          source_group("" FILES ${THIS_SOURCES})
                                      
                                          # create the target
                                          if(THIS_GUI_APP AND SFML_OS_WINDOWS AND NOT DEFINED CMAKE_CONFIGURATION_TYPES AND ${CMAKE_BUILD_TYPE} STREQUAL "Release")
                                              add_executable(${target} WIN32 ${THIS_SOURCES})
                                              target_link_libraries(${target} sfml-main)
                                          else()
                                              add_executable(${target} ${THIS_SOURCES})
                                          endif()
                                      
                                          # set the debug suffix
                                          set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
                                      
                                          # set the target's folder (for IDEs that support it, e.g. Visual Studio)
                                          set_target_properties(${target} PROPERTIES FOLDER "Examples")
                                      
                                          # for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
                                          if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
                                              if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
                                                  set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
                                              elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
                                                  set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
                                              endif()
                                          endif()
                                      
                                          # link the target to its SFML dependencies
                                          if(THIS_DEPENDS)
                                              target_link_libraries(${target} ${THIS_DEPENDS})
                                          endif()
                                      
                                          # add the install rule
                                          install(TARGETS ${target}
                                                  RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples
                                                  BUNDLE DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples)
                                      
                                          # install the example's source code
                                          install(FILES ${THIS_SOURCES}
                                                  DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
                                                  COMPONENT examples)
                                      
                                          # install the example's resources as well
                                          set(EXAMPLE_RESOURCES "${CMAKE_SOURCE_DIR}/examples/${target}/resources")
                                          if(EXISTS ${EXAMPLE_RESOURCES})
                                              install(DIRECTORY ${EXAMPLE_RESOURCES}
                                                      DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
                                                      COMPONENT examples)
                                          endif()
                                      
                                      endmacro()
                                      
                                      # macro to find packages on the host OS
                                      # this is the same as in the toolchain file, which is here for Nsight Tegra VS
                                      # since it won't use the Android toolchain file
                                      if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
                                          macro(find_host_package)
                                              set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
                                              set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
                                              set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
                                              if(CMAKE_HOST_WIN32)
                                                  set(WIN32 1)
                                                  set(UNIX)
                                              elseif(CMAKE_HOST_APPLE)
                                                  set(APPLE 1)
                                                  set(UNIX)
                                              endif()
                                              find_package(${ARGN})
                                              set(WIN32)
                                              set(APPLE)
                                              set(UNIX 1)
                                              set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
                                              set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
                                              set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
                                          endmacro()
                                      endif()
                                      

                                      Bon c'est très long mais j'ai essayer de tout mettre ce qui pouvez être utile.



                                      -
                                      Edité par sumnayono 16 décembre 2017 à 16:14:17

                                      • Partager sur Facebook
                                      • Partager sur Twitter
                                        16 décembre 2017 à 16:51:47

                                        Oui, mais ca, ce sont des fichiers qui permettent de configurer la compilation de SFML.  Tu n'as pas vraiment besoin d'y toucher, tu dois juste les utiliser :

                                        dans un dossier séparé, nommé build_sfml, tu lancera les commandes

                                        cmake-gui <chemin_vers_sources_SFML>
                                        # cliquer sur "configure"
                                        # modifier les options qui t'intéressent (entre autre : le 
                                        # dossier d'installation: mettre le résultat dans le
                                        # meme dossier racine que ton compilateur peut être une bonne
                                        # idee )
                                        # cliquer sur "generate"
                                        # fermer CMake-gui
                                        make
                                        make install
                                        #sudo make install sous linuxoides basés sur debian (comme ubuntu)

                                        Il se peut que CMake ne reconnaisse pourtant pas l'instruction

                                        find_package(SFML ... )

                                        il faut alors copier le fichier FindSFML.cmake que tu devrait trouver dans un sous dossier "Modules" du dossier d'installation que tu as choisi vers le sous dossier "Modules" connu de CMake (typiquement  : <chemin de base>/share/cmake-<version>.<sous version>/Modules)

                                        Une fois que ce sera fait, tu pourras créer tes propres CMakeFiles.txt et y inclure des commandes proches de

                                        # demande à CMake de trouver ce dont on a besoin de la SFML
                                         find_package(SFML 2 COMPONENTS network system graphics window)
                                        # indiquer le chemin vers les fichiers d'en-tête de SFML
                                        # comme chemin à visiter au compilateur
                                        include_directories(${SFML_INCLUDE_DIR})
                                        # pour que l'éditeur de lien sache qu'il doit utiliser 
                                        # SFML
                                        # (ou TonTarget est la bibliothèque ou l'exécutable que 
                                        # tu crée à l'aide de add_executable / add_library )
                                        target_link_libraries(TonTarget ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})

                                        Avec ce CMakeLists.txt, tu pourras générer tout le projet pour code::blocks en suivant sensiblement les mêmes étapes que pour compiler SFML (à adapter, bien sur:D)

                                        • Partager sur Facebook
                                        • Partager sur Twitter
                                        Ce qui se conçoit bien s'énonce clairement. Et les mots pour le dire viennent aisément.Mon nouveau livre : Coder efficacement - Bonnes pratiques et erreurs  à éviter (en C++)Avant de faire ce que tu ne pourras défaire, penses à tout ce que tu ne pourras plus faire une fois que tu l'auras fait
                                        Anonyme
                                          17 décembre 2017 à 16:46:42

                                          Eh ben, heureusement que tu passais par là, je n'aurais jamais réussi à résoudre ça (faut dire que j'utilise pas cmake)...
                                          • Partager sur Facebook
                                          • Partager sur Twitter
                                            17 décembre 2017 à 19:45:51

                                            BorisD a écrit:

                                            Eh ben, heureusement que tu passais par là, je n'aurais jamais réussi à résoudre ça (faut dire que j'utilise pas cmake)...

                                            Tu devrais...  Car Code::blocks n'est jamais qu'un outil, et, comme tous les outils, tu peux décider d'en changer.

                                            CMake est tout à fait en mesure de générer les fichiers utilisées par Code::blocks, ce qui te permet de l'utiliser.

                                            Mais, si ton projet est intégralement tourné vers Code::Blocks, tu te poses tout un tas de restrictions, dont les deux principales sont:

                                            • si tu veux diffuser ton projet, tu obliges de facto celui qui serait intéressé par ton projet à utiliser Code::blocks, et il n'en a peut-être pas envie
                                            • si tu décide de changer d'outil, tu va perdre "des heures" à repérer toutes les options que tu as pu changer d'un coté pour les reproduire de l'autre.

                                            Or, CMake se place "au dessus" des différents outils que tu pourrais décider d'utiliser, et il est en mesure de générer les fichiers qui sont propres à un nombre toujours grandissant d'outils.

                                            Du coup, si tu décide de diffuser ton projet, tu files les fichiers requis par CMake en même temps que tes sources, et "tout le monde est content": si quelqu'un souhaite utiliser VisualStudio, Eclipse Code::Blocks ou... n'importe quel système d'automatisation de tâches supporté par CMake, il pourra le faire sans aucun problème.

                                            Et, de la même manière, si tu décides de changer d'outil -- ou que tu veux simplement voir ce que cela peut donner avec un autre -- tu peux relancer la configuration au travers de CMake, qui fera au passage un tas de vérifications, et tu pourras recommencer à travailler avec ton nouvel outil en quelques minutes à peine ;)

                                            En outre, CMake est particulièrement utile pour tout ce qui a trait à la gestion des dépendances: Tu veux utiliser SFML, Qt, boost ou une autre bibliothèque? Il y a de tres fortes chances pour qu'il arrive à la retrouver, et à dire non seulement qu'elle est présente, mais aussi à définir les dossier où il faut tout aller chercher et toutes les options de compilations qui peuvent en découler.

                                            Tout ce que tu devais faire "à la main" (sans jamais vraiment savoir où il fallait le faire) en termes d'option de compilation, CMake le fait pour toi en quelques lignes.

                                            Mieux encore: le plus souvent, le projet que tu développes est fort dépendant du système sur lequel tu travailles: une bibliothèque peut être à "gauche" chez toi, mais à droite chez ton voisin (voire, carrément, être absente sur le système de ton voisin).  CMake peut sans aucun problème "gommer" ces différences, et permettre à ton projet d'être compilé "n'importe où".

                                            Enfin, last but not least, CMake peut générer des installateurs et des scripts de tests pour la plupart (tous?) des systèmes ;)

                                            • Partager sur Facebook
                                            • Partager sur Twitter
                                            Ce qui se conçoit bien s'énonce clairement. Et les mots pour le dire viennent aisément.Mon nouveau livre : Coder efficacement - Bonnes pratiques et erreurs  à éviter (en C++)Avant de faire ce que tu ne pourras défaire, penses à tout ce que tu ne pourras plus faire une fois que tu l'auras fait
                                              17 décembre 2017 à 20:22:10

                                              Ok, merci pour votre aide car j’étais perdue.

                                              • Partager sur Facebook
                                              • Partager sur Twitter
                                              Anonyme
                                                19 décembre 2017 à 17:08:22

                                                @koala01 Oui, depuis quelques temps (c'est à dire 2 jours) je commence à utiliser CMake (c'est quand même assez galère). Le menu de la commande:

                                                cmake --help

                                                m'a fait découvrir un nouvel IDE: CodeLite! Il a l'avantage d'être moins bugué que CodeBlocks qui, sous Linux, avait une fâcheuse tendance à planter quand on ouvrait une fenêtre... C'est ballot.

                                                -
                                                Edité par Anonyme 19 décembre 2017 à 17:08:47

                                                • Partager sur Facebook
                                                • Partager sur Twitter
                                                  19 décembre 2017 à 18:40:13

                                                  Normalement, tu as toute la documentation --entre autre, au format HTML du coté de share/doc (faut peut être ajouter un paquet supplémentaire pour l'avoir :P)

                                                  Elle est -- à mon sens -- plus facile à utiliser  que le menu help, entre autre grace à sa fonction de recherche ;)

                                                  Et, oui, comme tout nouvel outil, il y a un certain temps de prise en main, mais ca en vaut la peine :D

                                                  • Partager sur Facebook
                                                  • Partager sur Twitter
                                                  Ce qui se conçoit bien s'énonce clairement. Et les mots pour le dire viennent aisément.Mon nouveau livre : Coder efficacement - Bonnes pratiques et erreurs  à éviter (en C++)Avant de faire ce que tu ne pourras défaire, penses à tout ce que tu ne pourras plus faire une fois que tu l'auras fait

                                                  Problème sfml avec code::blocks

                                                  × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
                                                  × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
                                                  • Editeur
                                                  • Markdown