CMakeLists.txt 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(WebKit)
  3. # -----------------------------------------------------------------------------
  4. # Default library type
  5. # -----------------------------------------------------------------------------
  6. set(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
  7. set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
  8. set(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
  9. set(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
  10. set(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
  11. set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
  12. set(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
  13. set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
  14. set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
  15. set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
  16. set(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
  17. set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
  18. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
  19. set(ENABLE_WEBCORE ON)
  20. if (NOT DEFINED ENABLE_WEBKIT)
  21. set(ENABLE_WEBKIT ON)
  22. endif ()
  23. if (NOT DEFINED ENABLE_TOOLS AND EXISTS ${TOOLS_DIR})
  24. set(ENABLE_TOOLS ON)
  25. endif ()
  26. include(WebKitMacros)
  27. include(WebKitFS)
  28. include(WebKitHelpers)
  29. include(WebKitFeatures)
  30. # -----------------------------------------------------------------------------
  31. # Determine which port will be built
  32. # -----------------------------------------------------------------------------
  33. set(ALL_PORTS Efl WinCE BlackBerry GTK)
  34. set(PORT "NOPORT" CACHE STRING "choose which WebKit port to build (one of ${ALL_PORTS})")
  35. list(FIND ALL_PORTS ${PORT} RET)
  36. if (${RET} EQUAL -1)
  37. message(FATAL_ERROR "Please choose which WebKit port to build (one of ${ALL_PORTS})")
  38. endif ()
  39. string(TOLOWER ${PORT} WEBKIT_PORT_DIR)
  40. # -----------------------------------------------------------------------------
  41. # Find common packages (used by all ports)
  42. # -----------------------------------------------------------------------------
  43. find_package(BISON 2.4.1 REQUIRED)
  44. find_package(FLEX 2.5.34 REQUIRED)
  45. # TODO Enforce version requirement for gperf
  46. find_package(Gperf 3.0.1 REQUIRED)
  47. # TODO Enforce version requirement for perl
  48. find_package(Perl 5.10.0 REQUIRED)
  49. find_package(PythonInterp 2.6.0 REQUIRED)
  50. find_package(Ruby 1.8.7)
  51. # -----------------------------------------------------------------------------
  52. # Determine the target processor
  53. # -----------------------------------------------------------------------------
  54. string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_SYSTEM_PROCESSOR)
  55. if (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
  56. set(WTF_CPU_ARM 1)
  57. elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
  58. set(WTF_CPU_MIPS 1)
  59. elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
  60. set(WTF_CPU_X86_64 1)
  61. elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|x86)")
  62. set(WTF_CPU_X86 1)
  63. else ()
  64. message(FATAL_ERROR "Unknown CPU '${CMAKE_SYSTEM_PROCESSOR}'")
  65. endif ()
  66. # -----------------------------------------------------------------------------
  67. # Determine the operating system
  68. # -----------------------------------------------------------------------------
  69. if (UNIX)
  70. if (APPLE)
  71. set(WTF_OS_MAC_OS_X 1)
  72. else ()
  73. set(WTF_OS_UNIX 1)
  74. endif ()
  75. elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
  76. set(WTF_OS_WINDOWS 1)
  77. elseif (CMAKE_SYSTEM_NAME MATCHES "QNX")
  78. set(WTF_OS_QNX 1)
  79. set(WTF_OS_UNIX 1)
  80. else ()
  81. message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
  82. endif ()
  83. # -----------------------------------------------------------------------------
  84. # Default library types
  85. # -----------------------------------------------------------------------------
  86. option(SHARED_CORE "build JavaScriptCore and WebCore as shared libraries")
  87. if (SHARED_CORE)
  88. set(JavaScriptCore_LIBRARY_TYPE SHARED)
  89. set(WebCore_LIBRARY_TYPE SHARED)
  90. else ()
  91. set(JavaScriptCore_LIBRARY_TYPE STATIC)
  92. set(WebCore_LIBRARY_TYPE STATIC)
  93. endif ()
  94. set(WebKit_LIBRARY_TYPE SHARED)
  95. set(WebKit2_LIBRARY_TYPE SHARED)
  96. set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
  97. # -----------------------------------------------------------------------------
  98. # Common options
  99. #------------------------------------------------------------------------------
  100. include(OptionsCommon)
  101. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
  102. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
  103. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${EXEC_INSTALL_DIR})
  104. # -----------------------------------------------------------------------------
  105. # Port-specific options
  106. # -----------------------------------------------------------------------------
  107. include(Options${PORT})
  108. # -----------------------------------------------------------------------------
  109. # Enable API unit tests and create a target for the test runner
  110. # -----------------------------------------------------------------------------
  111. if (ENABLE_API_TESTS)
  112. enable_testing()
  113. endif ()
  114. # -----------------------------------------------------------------------------
  115. # Install JavaScript shell
  116. # -----------------------------------------------------------------------------
  117. option(SHOULD_INSTALL_JS_SHELL "generate an installation rule to install the built JavaScript shell")
  118. # -----------------------------------------------------------------------------
  119. # Define packaging
  120. # -----------------------------------------------------------------------------
  121. include(WebKitPackaging)
  122. # -----------------------------------------------------------------------------
  123. # Add module directories
  124. # -----------------------------------------------------------------------------
  125. add_subdirectory(Source)
  126. # -----------------------------------------------------------------------------
  127. # Add tools
  128. # -----------------------------------------------------------------------------
  129. if (ENABLE_TOOLS)
  130. add_subdirectory(Tools)
  131. endif ()