1
0

CMakeLists.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. if(WIN32)
  2. set(libobs_opengl_platform_src
  3. gl-windows.c)
  4. elseif(APPLE AND UNIX)
  5. set(libobs_opengl_platform_objc_src gl-cocoa.m)
  6. set_source_files_properties(${libobs_opengl_platform_objc_src}
  7. PROPERTIES LANGUAGE C)
  8. set(libobs_opengl_platform_src ${libobs_opengl_platform_objc_src})
  9. find_library(COCOA Cocoa)
  10. include_directories(${COCOA})
  11. link_libraries(${COCOA})
  12. find_library(IOSURF IOSurface)
  13. include_directories(${IOSURF})
  14. link_libraries(${IOSURF})
  15. else()
  16. endif()
  17. option(USE_BUNDLED_GLEW "Build using bundled GLEW" ${WIN32})
  18. option(USE_STATIC_GLEW "Link GLEW statically (ignored with USE_BUNDLED_GLEW)"
  19. false)
  20. include_directories(SYSTEM ${obs_SOURCE_DIR}/libobs)
  21. find_package(OpenGL REQUIRED)
  22. include_directories(${OPENGL_INCLUDE_DIRS})
  23. add_definitions(-DGLEW_NO_GLU)
  24. if(USE_BUNDLED_GLEW)
  25. include_directories(SYSTEM glew/include)
  26. add_definitions(-DGLEW_STATIC)
  27. set(GLEW_SRC glew/src/glew.c)
  28. else()
  29. if(USE_STATIC_GLEW)
  30. set(lib_prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
  31. set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_STATIC_LIBRARY_PREFIX}
  32. ${CMAKE_DYNAMIC_LIBRARY_PREFIX}
  33. ${CMAKE_SHARED_OBJECT_PREFIX})
  34. set(glew_static "static")
  35. endif()
  36. find_package(GLEW REQUIRED ${glew_static})
  37. include_directories(${GLEW_INCLUDE_DIRS})
  38. if(USE_STATIC_GLEW)
  39. unset(glew_static)
  40. set(CMAKE_FIND_LIBRARY_PREFIXES ${lib_prefixes})
  41. unset(lib_prefixes)
  42. endif()
  43. endif()
  44. add_library(libobs-opengl MODULE
  45. gl-helpers.c
  46. gl-indexbuffer.c
  47. gl-shader.c
  48. gl-shaderparser.c
  49. gl-stagesurf.c
  50. gl-subsystem.c
  51. gl-texture2d.c
  52. gl-texturecube.c
  53. gl-vertexbuffer.c
  54. gl-zstencil.c
  55. ${libobs_opengl_platform_src}
  56. ${GLEW_SRC})
  57. set_target_properties(libobs-opengl
  58. PROPERTIES OUTPUT_NAME obs-opengl)
  59. target_link_libraries(libobs-opengl
  60. libobs
  61. ${OPENGL_LIBRARIES}
  62. ${GLEW_LIBRARIES})
  63. obs_add_core_lib(libobs-opengl)