CMakeLists.txt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # -*- cmake -*-
  2. #
  3. # Compared to other libraries, compiling this one is a mess. The
  4. # reason is that we have several source files that have two different
  5. # sets of behaviour, depending on whether they're intended to be part
  6. # of the viewer or the map server.
  7. #
  8. # Unfortunately, the affected code is a rat's nest of #ifdefs, so it's
  9. # easier to play compilation tricks than to actually fix the problem.
  10. project(llwindow)
  11. include(00-Common)
  12. include(LLCommon)
  13. include(LLFilesystem)
  14. include(LLImage)
  15. include(LLMath)
  16. include(LLRender)
  17. include(LLWindow)
  18. include(LLXML)
  19. set(llwindow_SOURCE_FILES
  20. llcursortypes.cpp
  21. llfindlocale.cpp
  22. llkeyboard.cpp
  23. )
  24. set(llwindows_HEADER_FILES
  25. CMakeLists.txt
  26. llcursortypes.h
  27. llfindlocale.h
  28. llkeyboard.h
  29. )
  30. set(viewer_SOURCE_FILES
  31. llwindow.cpp
  32. llmousehandler.cpp
  33. )
  34. set(viewer_HEADER_FILES
  35. llwindow.h
  36. llpreeditor.h
  37. llmousehandler.h
  38. )
  39. # Libraries on which this library depends, needed for Linux builds
  40. # Sort by high-level to low-level
  41. set(llwindow_LINK_LIBRARIES
  42. ${SDL_LIBRARY}
  43. )
  44. if (DARWIN)
  45. list(APPEND llwindow_SOURCE_FILES
  46. llkeyboardmacosx.cpp
  47. llwindowmacosx.cpp
  48. llwindowmacosx-objc.mm
  49. llopenglview-objc.mm
  50. )
  51. list(APPEND llwindow_HEADER_FILES
  52. llkeyboardmacosx.h
  53. llwindowmacosx.h
  54. llwindowmacosx-objc.h
  55. llopenglview-objc.h
  56. llappdelegate-objc.h
  57. )
  58. # We use a bunch of deprecated system APIs.
  59. set_source_files_properties(
  60. llkeyboardmacosx.cpp
  61. llwindowmacosx.cpp
  62. PROPERTIES
  63. COMPILE_FLAGS "-Wno-deprecated-declarations -fpascal-strings"
  64. )
  65. endif (DARWIN)
  66. if (LINUX)
  67. list(APPEND viewer_SOURCE_FILES
  68. llkeyboardsdl.cpp
  69. llwindowsdl.cpp
  70. )
  71. list(APPEND viewer_HEADER_FILES
  72. llkeyboardsdl.h
  73. llwindowsdl.h
  74. )
  75. endif (LINUX)
  76. if (WINDOWS)
  77. list(APPEND llwindow_SOURCE_FILES
  78. llwindowwin32.cpp
  79. lldxhardware.cpp
  80. llkeyboardwin32.cpp
  81. )
  82. list(APPEND llwindow_HEADER_FILES
  83. llwindowwin32.h
  84. lldxhardware.h
  85. llkeyboardwin32.h
  86. )
  87. endif (WINDOWS)
  88. set_source_files_properties(${llwindow_HEADER_FILES}
  89. PROPERTIES HEADER_FILE_ONLY TRUE)
  90. if (llwindow_HEADER_FILES)
  91. list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES})
  92. endif (llwindow_HEADER_FILES)
  93. list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES})
  94. add_library (llwindow
  95. ${llwindow_SOURCE_FILES}
  96. ${viewer_SOURCE_FILES}
  97. )
  98. add_dependencies(llwindow prepare)
  99. target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})
  100. if (NOT ${CMAKE_VERSION} VERSION_LESS "3.16.0")
  101. if (USEUNITYBUILD)
  102. set_target_properties(llwindow PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 0)
  103. else (USEUNITYBUILD)
  104. target_precompile_headers(llwindow PRIVATE <linden_common.h>)
  105. endif (USEUNITYBUILD)
  106. endif ()
  107. get_directory_property(ALLDEFINES COMPILE_DEFINITIONS)
  108. message("llwindow COMPILE_DEFINITIONS = ${ALLDEFINES}")