Guest User

CMakeLists.txt

a guest
Jan 10th, 2019
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/Window)
  3. set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Window)
  4.  
  5. # all source files
  6. set(SRC
  7.     ${INCROOT}/Clipboard.hpp
  8.     ${SRCROOT}/Clipboard.cpp
  9.     ${SRCROOT}/ClipboardImpl.hpp
  10.     ${SRCROOT}/Context.cpp
  11.     ${INCROOT}/Context.hpp
  12.     ${SRCROOT}/Cursor.cpp
  13.     ${INCROOT}/Cursor.hpp
  14.     ${SRCROOT}/CursorImpl.hpp
  15.     ${INCROOT}/Export.hpp
  16.     ${SRCROOT}/GlContext.cpp
  17.     ${SRCROOT}/GlContext.hpp
  18.     ${SRCROOT}/GlResource.cpp
  19.     ${INCROOT}/GlResource.hpp
  20.     ${INCROOT}/ContextSettings.hpp
  21.     ${INCROOT}/Event.hpp
  22.     ${SRCROOT}/InputImpl.hpp
  23.     ${INCROOT}/Joystick.hpp
  24.     ${SRCROOT}/Joystick.cpp
  25.     ${SRCROOT}/JoystickImpl.hpp
  26.     ${SRCROOT}/JoystickManager.cpp
  27.     ${SRCROOT}/JoystickManager.hpp
  28.     ${INCROOT}/Keyboard.hpp
  29.     ${SRCROOT}/Keyboard.cpp
  30.     ${INCROOT}/Mouse.hpp
  31.     ${SRCROOT}/Mouse.cpp
  32.     ${INCROOT}/Touch.hpp
  33.     ${SRCROOT}/Touch.cpp
  34.     ${INCROOT}/Sensor.hpp
  35.     ${SRCROOT}/Sensor.cpp
  36.     ${SRCROOT}/SensorImpl.hpp
  37.     ${SRCROOT}/SensorManager.cpp
  38.     ${SRCROOT}/SensorManager.hpp
  39.     ${SRCROOT}/VideoMode.cpp
  40.     ${INCROOT}/VideoMode.hpp
  41.     ${SRCROOT}/VideoModeImpl.hpp
  42.     ${SRCROOT}/Window.cpp
  43.     ${INCROOT}/Window.hpp
  44.     ${SRCROOT}/WindowBase.cpp
  45.     ${INCROOT}/WindowBase.hpp
  46.     ${INCROOT}/WindowHandle.hpp
  47.     ${SRCROOT}/WindowImpl.cpp
  48.     ${SRCROOT}/WindowImpl.hpp
  49.     ${INCROOT}/WindowStyle.hpp
  50. )
  51. if(SFML_OPENGL_ES AND NOT SFML_OS_IOS)
  52.     list(APPEND SRC ${SRCROOT}/EGLCheck.cpp)
  53.     list(APPEND SRC ${SRCROOT}/EGLCheck.hpp)
  54.     list(APPEND SRC ${SRCROOT}/EglContext.cpp)
  55.     list(APPEND SRC ${SRCROOT}/EglContext.hpp)
  56. endif()
  57. source_group("" FILES ${SRC})
  58.  
  59. # add platform specific sources
  60. if(SFML_OS_WINDOWS)
  61.     set(PLATFORM_SRC
  62.         ${SRCROOT}/Win32/CursorImpl.hpp
  63.         ${SRCROOT}/Win32/CursorImpl.cpp
  64.         ${SRCROOT}/Win32/ClipboardImpl.hpp
  65.         ${SRCROOT}/Win32/ClipboardImpl.cpp
  66.         ${SRCROOT}/Win32/WglContext.cpp
  67.         ${SRCROOT}/Win32/WglContext.hpp
  68.         ${SRCROOT}/Win32/WglExtensions.cpp
  69.         ${SRCROOT}/Win32/WglExtensions.hpp
  70.         ${SRCROOT}/Win32/InputImpl.cpp
  71.         ${SRCROOT}/Win32/InputImpl.hpp
  72.         ${SRCROOT}/Win32/JoystickImpl.cpp
  73.         ${SRCROOT}/Win32/JoystickImpl.hpp
  74.         ${SRCROOT}/Win32/SensorImpl.hpp
  75.         ${SRCROOT}/Win32/SensorImpl.cpp
  76.         ${SRCROOT}/Win32/VideoModeImpl.cpp
  77.         ${SRCROOT}/Win32/WindowImplWin32.cpp
  78.         ${SRCROOT}/Win32/WindowImplWin32.hpp
  79.     )
  80.     source_group("windows" FILES ${PLATFORM_SRC})
  81.  
  82.     # make sure that we use the Unicode version of the Win API functions
  83.     add_definitions(-DUNICODE -D_UNICODE)
  84. elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
  85.     set(PLATFORM_SRC
  86.         ${SRCROOT}/Unix/CursorImpl.hpp
  87.         ${SRCROOT}/Unix/CursorImpl.cpp
  88.         ${SRCROOT}/Unix/ClipboardImpl.hpp
  89.         ${SRCROOT}/Unix/ClipboardImpl.cpp
  90.         ${SRCROOT}/Unix/Display.cpp
  91.         ${SRCROOT}/Unix/Display.hpp
  92.         ${SRCROOT}/Unix/InputImpl.cpp
  93.         ${SRCROOT}/Unix/InputImpl.hpp
  94.         ${SRCROOT}/Unix/SensorImpl.cpp
  95.         ${SRCROOT}/Unix/SensorImpl.hpp
  96.         ${SRCROOT}/Unix/VideoModeImpl.cpp
  97. #        ${SRCROOT}/Unix/WindowImplX11.cpp
  98. #        ${SRCROOT}/Unix/WindowImplX11.hpp
  99.     )
  100.     if(NOT SFML_OPENGL_ES)
  101.         set(PLATFORM_SRC
  102.             ${PLATFORM_SRC}
  103.             ${SRCROOT}/Unix/GlxContext.cpp
  104.             ${SRCROOT}/Unix/GlxContext.hpp
  105.             ${SRCROOT}/Unix/GlxExtensions.cpp
  106.             ${SRCROOT}/Unix/GlxExtensions.hpp
  107.         )
  108.     endif()
  109.     if(SFML_OS_LINUX)
  110.         set(PLATFORM_SRC
  111.             ${PLATFORM_SRC}
  112.             ${SRCROOT}/Unix/JoystickImpl.cpp
  113.             ${SRCROOT}/Unix/JoystickImpl.hpp
  114.         )
  115.     elseif(SFML_OS_FREEBSD)
  116.         set(PLATFORM_SRC
  117.             ${PLATFORM_SRC}
  118.             ${SRCROOT}/FreeBSD/JoystickImpl.cpp
  119.             ${SRCROOT}/FreeBSD/JoystickImpl.hpp
  120.         )
  121.     elseif(SFML_OS_OPENBSD)
  122.         set(PLATFORM_SRC
  123.             ${PLATFORM_SRC}
  124.             ${SRCROOT}/OpenBSD/JoystickImpl.cpp
  125.             ${SRCROOT}/OpenBSD/JoystickImpl.hpp
  126.         )
  127.     endif()
  128.     source_group("unix" FILES ${PLATFORM_SRC})
  129. elseif(SFML_OS_MACOSX)
  130.     set(PLATFORM_SRC
  131.         ${SRCROOT}/OSX/cpp_objc_conversion.h
  132.         ${SRCROOT}/OSX/cpp_objc_conversion.mm
  133.         ${SRCROOT}/OSX/cg_sf_conversion.hpp
  134.         ${SRCROOT}/OSX/cg_sf_conversion.mm
  135.         ${SRCROOT}/OSX/CursorImpl.hpp
  136.         ${SRCROOT}/OSX/CursorImpl.mm
  137.         ${SRCROOT}/OSX/ClipboardImpl.hpp
  138.         ${SRCROOT}/OSX/ClipboardImpl.mm
  139.         ${SRCROOT}/OSX/InputImpl.mm
  140.         ${SRCROOT}/OSX/InputImpl.hpp
  141.         ${SRCROOT}/OSX/HIDInputManager.hpp
  142.         ${SRCROOT}/OSX/HIDInputManager.mm
  143.         ${SRCROOT}/OSX/HIDJoystickManager.hpp
  144.         ${SRCROOT}/OSX/HIDJoystickManager.cpp
  145.         ${SRCROOT}/OSX/JoystickImpl.cpp
  146.         ${SRCROOT}/OSX/JoystickImpl.hpp
  147.         ${SRCROOT}/OSX/NSImage+raw.h
  148.         ${SRCROOT}/OSX/NSImage+raw.mm
  149.         ${SRCROOT}/OSX/Scaling.h
  150.         ${SRCROOT}/OSX/SensorImpl.cpp
  151.         ${SRCROOT}/OSX/SensorImpl.hpp
  152.         ${SRCROOT}/OSX/SFApplication.h
  153.         ${SRCROOT}/OSX/SFApplication.m
  154.         ${SRCROOT}/OSX/SFApplicationDelegate.h
  155.         ${SRCROOT}/OSX/SFApplicationDelegate.m
  156.         ${SRCROOT}/OSX/SFContext.hpp
  157.         ${SRCROOT}/OSX/SFContext.mm
  158.         ${SRCROOT}/OSX/SFKeyboardModifiersHelper.h
  159.         ${SRCROOT}/OSX/SFKeyboardModifiersHelper.mm
  160.         ${SRCROOT}/OSX/SFOpenGLView.h
  161.         ${SRCROOT}/OSX/SFOpenGLView.mm
  162.         ${SRCROOT}/OSX/SFOpenGLView+keyboard.mm
  163.         ${SRCROOT}/OSX/SFOpenGLView+keyboard_priv.h
  164.         ${SRCROOT}/OSX/SFOpenGLView+mouse.mm
  165.         ${SRCROOT}/OSX/SFOpenGLView+mouse_priv.h
  166.         ${SRCROOT}/OSX/SFSilentResponder.h
  167.         ${SRCROOT}/OSX/SFSilentResponder.m
  168.         ${SRCROOT}/OSX/SFWindow.h
  169.         ${SRCROOT}/OSX/SFWindow.m
  170.         ${SRCROOT}/OSX/SFWindowController.h
  171.         ${SRCROOT}/OSX/SFWindowController.mm
  172.         ${SRCROOT}/OSX/SFViewController.h
  173.         ${SRCROOT}/OSX/SFViewController.mm
  174.         ${SRCROOT}/OSX/VideoModeImpl.cpp
  175.         ${SRCROOT}/OSX/WindowImplCocoa.hpp
  176.         ${SRCROOT}/OSX/WindowImplCocoa.mm
  177.         ${SRCROOT}/OSX/WindowImplDelegateProtocol.h
  178.         ${SRCROOT}/OSX/AutoreleasePoolWrapper.h
  179.         ${SRCROOT}/OSX/AutoreleasePoolWrapper.mm
  180.     )
  181.     source_group("mac" FILES ${PLATFORM_SRC})
  182. elseif(SFML_OS_IOS)
  183.     set(PLATFORM_SRC
  184.         ${SRCROOT}/iOS/CursorImpl.hpp
  185.         ${SRCROOT}/iOS/CursorImpl.cpp
  186.         ${SRCROOT}/iOS/ClipboardImpl.mm
  187.         ${SRCROOT}/iOS/ClipboardImpl.hpp
  188.         ${SRCROOT}/iOS/EaglContext.mm
  189.         ${SRCROOT}/iOS/EaglContext.hpp
  190.         ${SRCROOT}/iOS/InputImpl.mm
  191.         ${SRCROOT}/iOS/InputImpl.hpp
  192.         ${SRCROOT}/iOS/JoystickImpl.mm
  193.         ${SRCROOT}/iOS/JoystickImpl.hpp
  194.         ${SRCROOT}/iOS/SensorImpl.mm
  195.         ${SRCROOT}/iOS/SensorImpl.hpp
  196.         ${SRCROOT}/iOS/VideoModeImpl.mm
  197.         ${SRCROOT}/iOS/WindowImplUIKit.hpp
  198.         ${SRCROOT}/iOS/WindowImplUIKit.mm
  199.         ${SRCROOT}/iOS/ObjCType.hpp
  200.         ${SRCROOT}/iOS/SFAppDelegate.hpp
  201.         ${SRCROOT}/iOS/SFAppDelegate.mm
  202.         ${SRCROOT}/iOS/SFView.hpp
  203.         ${SRCROOT}/iOS/SFView.mm
  204.         ${SRCROOT}/iOS/SFViewController.hpp
  205.         ${SRCROOT}/iOS/SFViewController.mm
  206.         ${SRCROOT}/iOS/SFMain.hpp
  207.         ${SRCROOT}/iOS/SFMain.mm
  208.     )
  209.     source_group("ios" FILES ${PLATFORM_SRC})
  210. elseif(SFML_OS_ANDROID)
  211.     set(PLATFORM_SRC
  212.         ${SRCROOT}/Android/CursorImpl.hpp
  213.         ${SRCROOT}/Android/CursorImpl.cpp
  214.         ${SRCROOT}/Android/ClipboardImpl.hpp
  215.         ${SRCROOT}/Android/ClipboardImpl.cpp
  216.         ${SRCROOT}/Android/WindowImplAndroid.hpp
  217.         ${SRCROOT}/Android/WindowImplAndroid.cpp
  218.         ${SRCROOT}/Android/VideoModeImpl.cpp
  219.         ${SRCROOT}/Android/InputImpl.hpp
  220.         ${SRCROOT}/Android/InputImpl.cpp
  221.         ${SRCROOT}/Android/JoystickImpl.hpp
  222.         ${SRCROOT}/Android/JoystickImpl.cpp
  223.         ${SRCROOT}/Android/SensorImpl.hpp
  224.         ${SRCROOT}/Android/SensorImpl.cpp
  225.     )
  226.     source_group("android" FILES ${PLATFORM_SRC})
  227. endif()
  228.  
  229. # define the sfml-window target
  230. sfml_add_library(sfml-window
  231.                  SOURCES ${SRC} ${PLATFORM_SRC})
  232. target_link_libraries(sfml-window PUBLIC sfml-system)
  233.  
  234. # When static linking on macOS, we need to add this flag for objective C to work
  235. if ((NOT BUILD_SHARED_LIBS) AND SFML_OS_MACOSX)
  236.     target_link_libraries(sfml-window PRIVATE -ObjC)
  237. endif()
  238.  
  239. # find and setup usage for external libraries
  240. if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OPENBSD)
  241.     sfml_find_package(X11 INCLUDE "X11_INCLUDE_DIR" LINK "X11_X11_LIB" "X11_Xrandr_LIB")
  242.     target_link_libraries(sfml-window PRIVATE X11)
  243. endif()
  244.  
  245. # CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL for backward compability
  246. # (unless the OpenGL_GL_PREFERENCE was explicitly set)
  247. # See CMP0072 for more details (cmake --help-policy CMP0072)
  248. if ((NOT ${CMAKE_VERSION} VERSION_LESS 3.11) AND (NOT OpenGL_GL_PREFERENCE))
  249.     set(OpenGL_GL_PREFERENCE "LEGACY")
  250. endif()
  251.  
  252. if(SFML_OPENGL_ES)
  253.     if(SFML_OS_IOS)
  254.         target_link_libraries(sfml-window PRIVATE "-framework OpenGLES")
  255.     elseif(SFML_OS_ANDROID)
  256.         target_link_libraries(sfml-window PRIVATE EGL GLESv1_CM)
  257.     endif()
  258. else()
  259.     sfml_find_package(OpenGL INCLUDE "OPENGL_INCLUDE_DIR" LINK "OPENGL_LIBRARIES")
  260.     target_link_libraries(sfml-window PRIVATE OpenGL)
  261. endif()
  262.  
  263. if(SFML_OS_WINDOWS AND NOT SFML_COMPILER_MSVC)
  264.     include(CheckIncludeFile)
  265.     check_include_file(dinput.h DINPUT_H_FOUND)
  266.     if(NOT DINPUT_H_FOUND)
  267.         target_include_directories(sfml-window PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/mingw")
  268.     endif()
  269. endif()
  270.  
  271. if(SFML_OPENGL_ES AND SFML_OS_LINUX)
  272.     sfml_find_package(EGL INCLUDE "EGL_INCLUDE_DIR" LINK "EGL_LIBRARY")
  273.     sfml_find_package(GLES INCLUDE "GLES_INCLUDE_DIR" LINK "GLES_LIBRARY")
  274.     target_link_libraries(sfml-window PRIVATE EGL GLES)
  275. endif()
  276.  
  277. if(SFML_OS_LINUX)
  278.     sfml_find_package(UDev INCLUDE "UDEV_INCLUDE_DIR" LINK "UDEV_LIBRARIES")
  279.     target_link_libraries(sfml-window PRIVATE UDev)
  280. elseif(SFML_OS_WINDOWS)
  281.     target_link_libraries(sfml-window PRIVATE winmm gdi32)
  282. elseif(SFML_OS_FREEBSD)
  283.     target_link_libraries(sfml-window PRIVATE usbhid)
  284. elseif(SFML_OS_MACOSX)
  285.     target_link_libraries(sfml-window PRIVATE "-framework Foundation" "-framework AppKit" "-framework IOKit" "-framework Carbon")
  286. elseif(SFML_OS_IOS)
  287.     target_link_libraries(sfml-window PRIVATE "-framework Foundation" "-framework UIKit" "-framework CoreGraphics" "-framework QuartzCore" "-framework CoreMotion")
  288. elseif(SFML_OS_ANDROID)
  289.     target_link_libraries(sfml-window PRIVATE android)
  290. endif()
RAW Paste Data