Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 11.08 KB | None | 0 0
  1.  
  2. # Copyright (C) 2016, Canonical Ltd.
  3. # All rights reserved.
  4.  
  5. # This source code is licensed under the BSD-style license found in the
  6. # LICENSE file in the root directory of this source tree. An additional grant
  7. # of patent rights can be found in the PATENTS file in the same directory.
  8.  
  9. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  10. set(CMAKE_AUTOMOC ON)
  11. set(CMAKE_AUTORCC ON)
  12. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  13. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
  14.  
  15. if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  16.   ADD_DEFINITIONS(-DRCT_DEV)
  17. endif()
  18.  
  19. #find_package(Qt5Core REQUIRED)
  20. #find_package(Qt5Qml REQUIRED)
  21. #find_package(Qt5Quick REQUIRED)
  22. #find_package(Qt5Svg REQUIRED) # on ubuntu: libqt5svg5-dev
  23. #find_package(WebSockets REQUIRED) # on ubuntu: libqt5websockets5-dev
  24. find_package(Qt5 COMPONENTS Core Qml Quick Svg WebSockets Concurrent REQUIRED)
  25.  
  26. #BEGIN ORWELL
  27. #add_subdirectory(../../../../CMakeListsOrwellSingle.txt orwell)
  28.  
  29. #TODO: add add_subdirectory() instead of everything below
  30.  
  31. find_library(AVCODEC_LIBRARY avcodec)
  32. find_library(AVUTIL_LIBRARY avutil)
  33. find_library(SWSCALE_LIBRARY swscale)
  34.  
  35. set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories
  36. set(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed
  37. set(CMAKE_AUTOUIC ON) # Create code from a list of Qt designer ui files
  38.  
  39. find_package(OpenGL REQUIRED)
  40. find_package(Boost COMPONENTS thread system REQUIRED) #todo: erase system, not necessary I guess
  41. find_package(Qt5 COMPONENTS Qml Quick Gui Widgets Multimedia MultimediaWidgets) #OpenGLWidgets)
  42.  
  43. add_subdirectory(../../../../myRtspClient/third_party/JRTPLIB jrtplib)
  44. include_directories(../../../../myRtspClient/third_party/Base64_live555/include)
  45. #include_directories(../../../../myRtspClient/third_party/src)
  46. include_directories(../../../../myRtspClient/third_party/md5/include)
  47. include_directories(../../../../myRtspClient/third_party/JRTPLIB/src)
  48. include_directories(../../../../myRtspClient/include)
  49. include_directories(../../../../myRtspClient/myRtspClient/include)
  50. include_directories(../../../../myRtspClient/third_party/JTHREAD/src)
  51. include_directories(../../../../) #ORWELL
  52. include_directories(jrtplib/src) #TODO: this is the folder autogenerated by jrtplib. I either have to make it generate the .in files to other places or find an elegant solution to this
  53.  
  54. file(GLOB SOURCES "../../../../myRtspClient/myRtspClient/*.cpp" "../../../../myRtspClient/third_party/Base64_live555/*.cpp" "../../../../myRtspClient/third_party/md5/*.cpp" "../../../../myRtspClient/third_party/JTHREAD/*.cpp"  "../../../../myRtspClient/third_party/JTHREAD/src*.cpp"  "../../../../myRtspClient/third_party/JTHREAD/jthread/*.cpp")
  55.  
  56. add_library(myRtspClient SHARED ${SOURCES})
  57. add_dependencies(myRtspClient jrtplib-shared)
  58. target_link_libraries(myRtspClient jrtplib-shared)
  59.  
  60. #qt5_add_resources(QRCS ../../../../resources.qrc)
  61. #qt5_add_resources(qml_QRC ../../../../qml.qrc)
  62.  
  63. file(GLOB orwell_SRCS "../../../../*.cpp" "../../../../*.ui")
  64.  
  65. add_library(orwell SHARED ${orwell_SRCS} ${qml_QRC})
  66. #TODO: decide either qtquick or qt widgets libs
  67. target_link_libraries( orwell ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${SWSCALE_LIBRARY} Qt5::Widgets Qt5::Multimedia Qt5::MultimediaWidgets Boost::thread myRtspClient pthread Qt5::Qml Qt5::Quick)
  68.  
  69. #END ORWELL
  70.  
  71.  
  72. if (USE_QTWEBKIT)
  73.   find_package(Qt5WebKit REQUIRED)
  74. endif()
  75.  
  76. if(JAVASCRIPTCORE_ENABLED)
  77.   ADD_DEFINITIONS(-DJAVASCRIPTCORE_ENABLED)
  78.  
  79.   include_directories("../../../ReactCommon")
  80.   include_directories("../../../ReactAndroid/src/main/jni/third-party")
  81.  
  82.   include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
  83.  
  84.   set(JavaScriptCore_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/JavaScriptCore_ep-prefix/src/JavaScriptCore_ep")
  85.   set(JavaScriptCore_INCLUDE_DIR "${JavaScriptCore_PREFIX}/WebKitBuild/Release/DerivedSources/ForwardingHeaders")
  86.   set(JavaScriptCore_STATIC_LIB
  87.       "${JavaScriptCore_PREFIX}/WebKitBuild/Release/lib/${CMAKE_STATIC_LIBRARY_PREFIX}JavaScriptCore${CMAKE_STATIC_LIBRARY_SUFFIX}")
  88.   set(bmalloc_STATIC_LIB
  89.        "${JavaScriptCore_PREFIX}/WebKitBuild/Release/lib/${CMAKE_STATIC_LIBRARY_PREFIX}bmalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
  90.   set(WTF_STATIC_LIB
  91.        "${JavaScriptCore_PREFIX}/WebKitBuild/Release/lib/${CMAKE_STATIC_LIBRARY_PREFIX}WTF${CMAKE_STATIC_LIBRARY_SUFFIX}")
  92.  
  93.   include_directories(${JavaScriptCore_INCLUDE_DIR})
  94.  
  95.   ExternalProject_Add(JavaScriptCore_ep
  96.     GIT_REPOSITORY git@github.com:WebKit/webkit.git
  97.     GIT_TAG 06fcd5bda23a9f4844263b60b33f2ad83be4d871
  98.     BUILD_BYPRODUCTS ${JavaScriptCore_STATIC_LIB}
  99.     CONFIGURE_COMMAND ${JavaScriptCore_PREFIX}/Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF"
  100.     BUILD_COMMAND ""
  101.     INSTALL_COMMAND ""
  102.   )
  103.  
  104.   set(FOLLY_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/folly_ep-prefix/src/folly_ep-install")
  105.   set(FOLLY_INCLUDE_DIR "${FOLLY_PREFIX}/include")
  106.   set(FOLLY_STATIC_LIB "${FOLLY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}folly${CMAKE_STATIC_LIBRARY_SUFFIX}")
  107.   set(FOLLY_CMAKE_ARGS
  108.       -DCMAKE_INSTALL_PREFIX:PATH=${FOLLY_PREFIX}
  109.       -DCMAKE_POSITION_INDEPENDENT_CODE=ON)
  110.  
  111.   include_directories(${FOLLY_INCLUDE_DIR})
  112.   MESSAGE(STATUS "FOLLY_INCLUDE_DIR = ${FOLLY_INCLUDE_DIR}")
  113.  
  114.   ExternalProject_Add(folly_ep
  115.         URL "https://github.com/facebook/folly/archive/v2018.04.30.00.tar.gz"
  116.         BUILD_BYPRODUCTS "${FOLLY_STATIC_LIB}"
  117.         CMAKE_ARGS ${FOLLY_CMAKE_ARGS})
  118.  
  119.   set(
  120.     SRC_JAVASCRIPTCORE
  121.     ../../../ReactCommon/jschelpers/JSCHelpers.cpp
  122.     ../../../ReactCommon/jschelpers/Unicode.cpp
  123.     ../../../ReactCommon/jschelpers/Value.cpp
  124.     ../../../ReactCommon/jschelpers/JSCWrapper.cpp
  125.     ../../../ReactCommon/jschelpers/systemJSCWrapper.cpp
  126.  
  127.     ../../../ReactCommon/jsinspector/InspectorInterfaces.cpp
  128.  
  129.     ../../../ReactCommon/privatedata/PrivateDataBase.cpp
  130.  
  131.     ../../../ReactCommon/cxxreact/CxxNativeModule.cpp
  132.     ../../../ReactCommon/cxxreact/Instance.cpp
  133.     ../../../ReactCommon/cxxreact/JSBigString.cpp
  134.     ../../../ReactCommon/cxxreact/JSBundleType.cpp
  135.     ../../../ReactCommon/cxxreact/JSCExecutor.cpp
  136.     ../../../ReactCommon/cxxreact/JSCLegacyTracing.cpp
  137.     ../../../ReactCommon/cxxreact/JSCMemory.cpp
  138.     ../../../ReactCommon/cxxreact/JSCNativeModules.cpp
  139.     ../../../ReactCommon/cxxreact/JSCPerfStats.cpp
  140.     ../../../ReactCommon/cxxreact/JSCSamplingProfiler.cpp
  141.     ../../../ReactCommon/cxxreact/JSCTracing.cpp
  142.     ../../../ReactCommon/cxxreact/JSCUtils.cpp
  143.     ../../../ReactCommon/cxxreact/JSIndexedRAMBundle.cpp
  144.     ../../../ReactCommon/cxxreact/MethodCall.cpp
  145.     ../../../ReactCommon/cxxreact/ModuleRegistry.cpp
  146.     ../../../ReactCommon/cxxreact/NativeToJsBridge.cpp
  147.     ../../../ReactCommon/cxxreact/Platform.cpp
  148.     ../../../ReactCommon/cxxreact/RAMBundleRegistry.cpp
  149.     jscutilities.cpp
  150.     communication/javascriptcoreexecutor.cpp)
  151. endif()
  152.  
  153. set(
  154.   SRC_RUNTIME
  155.   ${SRC_JAVASCRIPTCORE}
  156.   reactplugin.cpp
  157.   valuecoercion.cpp
  158.   blobprovider.cpp
  159.   bridge.cpp
  160.   deviceinfo.cpp
  161.   platform.cpp
  162.   eventdispatcher.cpp
  163.   sourcecode.cpp
  164.   componentdata.cpp
  165.   moduledata.cpp
  166.   modulemethod.cpp
  167.   propertyhandler.cpp
  168.   networking.cpp
  169.   netinfo.cpp
  170.   timing.cpp
  171.   appstate.cpp
  172.   asynclocalstorage.cpp
  173.   reactitem.cpp
  174.   rootview.cpp
  175.   reactnetworkaccessmanager.cpp
  176.   mouseeventsinterceptor.cpp
  177.   testmodule.cpp
  178.   attachedproperties.cpp
  179.   uimanager.cpp
  180.   redbox.cpp
  181.   exceptionsmanager.cpp
  182.   clipboard.cpp
  183.   linkingmanager.cpp
  184.   alert.cpp
  185.   componentmanagers/slidermanager.cpp
  186.   componentmanagers/viewmanager.cpp
  187.   componentmanagers/rawtextmanager.cpp
  188.   componentmanagers/scrollviewmanager.cpp
  189.   componentmanagers/navigatormanager.cpp
  190.   componentmanagers/activityindicatormanager.cpp
  191.   componentmanagers/buttonmanager.cpp
  192.   componentmanagers/modalmanager.cpp
  193.   componentmanagers/textmanager.cpp
  194.   componentmanagers/textinputmanager.cpp
  195.   componentmanagers/imagemanager.cpp
  196.   componentmanagers/imageloader.cpp
  197.   componentmanagers/pickermanager.cpp
  198.   componentmanagers/switchmanager.cpp
  199.   componentmanagers/webviewmanager.cpp
  200.   componentmanagers/scrollviewmodel.cpp
  201.   componentmanagers/mediaplayermanager.cpp
  202.   layout/flexbox.cpp
  203.   utilities.cpp
  204.   communication/serverconnection.cpp
  205.   communication/executor.cpp
  206.   communication/websocketexecutor.cpp
  207.   communication/iexecutor.h
  208.   websocketmodule.cpp
  209.   ../../../ReactCommon/yoga/yoga/Yoga.cpp
  210.   ../../../ReactCommon/yoga/yoga/YGEnums.cpp
  211.   ../../../ReactCommon/yoga/yoga/YGNode.cpp
  212.   ../../../ReactCommon/yoga/yoga/YGNodePrint.cpp
  213.   ../../../ReactCommon/yoga/yoga/YGStyle.cpp
  214.   ../../../ReactCommon/yoga/yoga/YGLayout.cpp
  215.   ../../../ReactCommon/yoga/yoga/YGEnums.cpp
  216.   ../../../ReactCommon/yoga/yoga/Utils.cpp
  217.   ../../../ReactCommon/yoga/yoga/YGFloatOptional.cpp
  218.   ../../../ReactCommon/yoga/yoga/YGConfig.cpp
  219. )
  220.  
  221. message(STATUS "REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC = ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC}")
  222.  
  223. set (SRC ${SRC_RUNTIME} ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC})
  224.  
  225. set(
  226.   QML
  227.   qml/ReactImage.qml
  228.   qml/ReactView.qml
  229.   qml/ReactNavigator.qml
  230.   qml/ReactScrollView.qml
  231.   qml/ReactScrollListView.qml
  232.   qml/ReactRedboxItem.qml
  233.   qml/ReactText.qml
  234.   qml/ReactRawText.qml
  235.   qml/ReactActivityIndicator.qml
  236.   qml/ReactButton.qml
  237.   qml/ReactSlider.qml
  238.   qml/ReactModal.qml
  239.   qml/DevMenu.qml
  240.   qml/ReactTextInput.qml
  241.   qml/ReactTextInputArea.qml
  242.   qml/ReactTextInputField.qml
  243.   qml/ReactAlert.qml
  244. )
  245.  
  246. if (USE_QTWEBKIT)
  247.   set(QML ${QML} qml/ReactQtWebKitWebView.qml)
  248.   ADD_DEFINITIONS(-DUSE_QTWEBKIT)
  249. else()
  250.   set(QML ${QML} qml/ReactWebView.qml)
  251. endif()
  252.  
  253. if(DEFINED REACT_BUILD_STATIC_LIB)
  254. add_library(
  255.   react-native STATIC
  256.   ${SRC}
  257.   ${QML}
  258.   react_resources.qrc
  259. )
  260. else()
  261. add_library(
  262.   react-native SHARED
  263.   ${SRC}
  264.   ${QML}
  265.   react_resources.qrc
  266. )
  267.  
  268. set_target_properties(
  269.   react-native
  270.   PROPERTIES LIBRARY_OUTPUT_DIRECTORY React
  271. )
  272. endif()
  273.  
  274.  
  275. if (REACT_NATIVE_DESKTOP_EXTERNAL_QT_COMPONENTS)
  276.   find_package(Qt5 COMPONENTS ${REACT_NATIVE_DESKTOP_EXTERNAL_QT_COMPONENTS} REQUIRED)
  277. endif()
  278.  
  279. if (REACT_NATIVE_DESKTOP_EXTERNAL_PROJECT_DEPS)
  280.   add_dependencies(react-native orwell ${REACT_NATIVE_DESKTOP_EXTERNAL_PROJECT_DEPS})
  281. endif()
  282.  
  283. if (REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_LIBS)
  284.   target_link_libraries(react-native orwell Boost::thread Qt5::WebSockets ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_LIBS})
  285. endif()
  286.  
  287.  
  288. if(JAVASCRIPTCORE_ENABLED)
  289.   add_dependencies(react-native orwell JavaScriptCore_ep folly_ep)
  290.  
  291.   target_link_libraries(react-native orwell Boost::thread
  292.     ${JavaScriptCore_STATIC_LIB} ${bmalloc_STATIC_LIB} ${WTF_STATIC_LIB}
  293.     "-licudata"
  294.     "-licui18n"
  295.     "-licuuc"
  296.     "-lglog"
  297.     "-ldouble-conversion"
  298.     ${FOLLY_STATIC_LIB}
  299.   )
  300. endif()
  301.  
  302. include_directories(${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_INCLUDE_DIRS})
  303.  
  304. set(USED_QT_MODULES Qt5::WebSockets Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Concurrent)
  305. if (USE_QTWEBKIT)
  306.   set (USED_QT_MODULES ${USED_QT_MODULES} WebKit)
  307. endif()
  308.  
  309. target_link_libraries(react-native orwell ${USED_QT_MODULES})
  310.  
  311. add_custom_target(
  312.   copy-qmldir ALL
  313.   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/React
  314. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement