Skip to content

Instantly share code, notes, and snippets.

@lattice0
Last active February 21, 2019 21:31
Show Gist options
  • Save lattice0/a3e5b3028a8b037b8c272ac97a76cc57 to your computer and use it in GitHub Desktop.
Save lattice0/a3e5b3028a8b037b8c272ac97a76cc57 to your computer and use it in GitHub Desktop.
cmake
/home/lz/cmake-3.14.0-rc2-Linux-x86_64/bin/cmake -DCMAKE_PREFIX_PATH=/home/lz/Qt5.11.2/5.11.2/gcc_64 .
# Copyright (C) 2016, Canonical Ltd.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
ADD_DEFINITIONS(-DRCT_DEV)
endif()
#find_package(Qt5Core REQUIRED)
#find_package(Qt5Qml REQUIRED)
#find_package(Qt5Quick REQUIRED)
#find_package(Qt5Svg REQUIRED) # on ubuntu: libqt5svg5-dev
#find_package(WebSockets REQUIRED) # on ubuntu: libqt5websockets5-dev
find_package(Qt5 COMPONENTS Core Qml Quick Svg WebSockets Concurrent REQUIRED)
#BEGIN ORWELL
#add_subdirectory(../../../../CMakeListsOrwellSingle.txt orwell)
#TODO: add add_subdirectory() instead of everything below
find_library(AVCODEC_LIBRARY avcodec)
find_library(AVUTIL_LIBRARY avutil)
find_library(SWSCALE_LIBRARY swscale)
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories
set(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOUIC ON) # Create code from a list of Qt designer ui files
find_package(OpenGL REQUIRED)
find_package(Boost COMPONENTS thread system REQUIRED) #todo: erase system, not necessary I guess
find_package(Qt5 COMPONENTS Qml Quick Gui Widgets Multimedia MultimediaWidgets) #OpenGLWidgets)
add_subdirectory(../../../../myRtspClient/third_party/JRTPLIB jrtplib)
include_directories(../../../../myRtspClient/third_party/Base64_live555/include)
#include_directories(../../../../myRtspClient/third_party/src)
include_directories(../../../../myRtspClient/third_party/md5/include)
include_directories(../../../../myRtspClient/third_party/JRTPLIB/src)
include_directories(../../../../myRtspClient/include)
include_directories(../../../../myRtspClient/myRtspClient/include)
include_directories(../../../../myRtspClient/third_party/JTHREAD/src)
include_directories(../../../../) #ORWELL
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
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")
add_library(myRtspClient STATIC ${SOURCES})
add_dependencies(myRtspClient jrtplib-static)
target_link_libraries(myRtspClient jrtplib-static)
qt5_add_resources(QRCS ../../../../resources.qrc)
qt5_add_resources(qml_QRC ../../../../qml.qrc)
file(GLOB orwell_SRCS "../../../../*.cpp" "../../../../*.ui")
add_library(orwell ${orwell_SRCS} ${qml_QRC})
#TODO: decide either qtquick or qt widgets libs
target_link_libraries( orwell ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${SWSCALE_LIBRARY} Qt5::Widgets Qt5::Multimedia Qt5::MultimediaWidgets Boost::thread myRtspClient pthread Qt5::Qml Qt5::Quick)
#END ORWELL
if (USE_QTWEBKIT)
find_package(Qt5WebKit REQUIRED)
endif()
if(JAVASCRIPTCORE_ENABLED)
ADD_DEFINITIONS(-DJAVASCRIPTCORE_ENABLED)
include_directories("../../../ReactCommon")
include_directories("../../../ReactAndroid/src/main/jni/third-party")
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
set(JavaScriptCore_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/JavaScriptCore_ep-prefix/src/JavaScriptCore_ep")
set(JavaScriptCore_INCLUDE_DIR "${JavaScriptCore_PREFIX}/WebKitBuild/Release/DerivedSources/ForwardingHeaders")
set(JavaScriptCore_STATIC_LIB
"${JavaScriptCore_PREFIX}/WebKitBuild/Release/lib/${CMAKE_STATIC_LIBRARY_PREFIX}JavaScriptCore${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(bmalloc_STATIC_LIB
"${JavaScriptCore_PREFIX}/WebKitBuild/Release/lib/${CMAKE_STATIC_LIBRARY_PREFIX}bmalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(WTF_STATIC_LIB
"${JavaScriptCore_PREFIX}/WebKitBuild/Release/lib/${CMAKE_STATIC_LIBRARY_PREFIX}WTF${CMAKE_STATIC_LIBRARY_SUFFIX}")
include_directories(${JavaScriptCore_INCLUDE_DIR})
ExternalProject_Add(JavaScriptCore_ep
GIT_REPOSITORY [email protected]:WebKit/webkit.git
GIT_TAG 06fcd5bda23a9f4844263b60b33f2ad83be4d871
BUILD_BYPRODUCTS ${JavaScriptCore_STATIC_LIB}
CONFIGURE_COMMAND ${JavaScriptCore_PREFIX}/Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF"
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set(FOLLY_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/folly_ep-prefix/src/folly_ep-install")
set(FOLLY_INCLUDE_DIR "${FOLLY_PREFIX}/include")
set(FOLLY_STATIC_LIB "${FOLLY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}folly${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(FOLLY_CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${FOLLY_PREFIX}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON)
include_directories(${FOLLY_INCLUDE_DIR})
MESSAGE(STATUS "FOLLY_INCLUDE_DIR = ${FOLLY_INCLUDE_DIR}")
ExternalProject_Add(folly_ep
URL "https://github.com/facebook/folly/archive/v2018.04.30.00.tar.gz"
BUILD_BYPRODUCTS "${FOLLY_STATIC_LIB}"
CMAKE_ARGS ${FOLLY_CMAKE_ARGS})
set(
SRC_JAVASCRIPTCORE
../../../ReactCommon/jschelpers/JSCHelpers.cpp
../../../ReactCommon/jschelpers/Unicode.cpp
../../../ReactCommon/jschelpers/Value.cpp
../../../ReactCommon/jschelpers/JSCWrapper.cpp
../../../ReactCommon/jschelpers/systemJSCWrapper.cpp
../../../ReactCommon/jsinspector/InspectorInterfaces.cpp
../../../ReactCommon/privatedata/PrivateDataBase.cpp
../../../ReactCommon/cxxreact/CxxNativeModule.cpp
../../../ReactCommon/cxxreact/Instance.cpp
../../../ReactCommon/cxxreact/JSBigString.cpp
../../../ReactCommon/cxxreact/JSBundleType.cpp
../../../ReactCommon/cxxreact/JSCExecutor.cpp
../../../ReactCommon/cxxreact/JSCLegacyTracing.cpp
../../../ReactCommon/cxxreact/JSCMemory.cpp
../../../ReactCommon/cxxreact/JSCNativeModules.cpp
../../../ReactCommon/cxxreact/JSCPerfStats.cpp
../../../ReactCommon/cxxreact/JSCSamplingProfiler.cpp
../../../ReactCommon/cxxreact/JSCTracing.cpp
../../../ReactCommon/cxxreact/JSCUtils.cpp
../../../ReactCommon/cxxreact/JSIndexedRAMBundle.cpp
../../../ReactCommon/cxxreact/MethodCall.cpp
../../../ReactCommon/cxxreact/ModuleRegistry.cpp
../../../ReactCommon/cxxreact/NativeToJsBridge.cpp
../../../ReactCommon/cxxreact/Platform.cpp
../../../ReactCommon/cxxreact/RAMBundleRegistry.cpp
jscutilities.cpp
communication/javascriptcoreexecutor.cpp)
endif()
set(
SRC_RUNTIME
${SRC_JAVASCRIPTCORE}
reactplugin.cpp
valuecoercion.cpp
blobprovider.cpp
bridge.cpp
deviceinfo.cpp
platform.cpp
eventdispatcher.cpp
sourcecode.cpp
componentdata.cpp
moduledata.cpp
modulemethod.cpp
propertyhandler.cpp
networking.cpp
netinfo.cpp
timing.cpp
appstate.cpp
asynclocalstorage.cpp
reactitem.cpp
rootview.cpp
reactnetworkaccessmanager.cpp
mouseeventsinterceptor.cpp
testmodule.cpp
attachedproperties.cpp
uimanager.cpp
redbox.cpp
exceptionsmanager.cpp
clipboard.cpp
linkingmanager.cpp
alert.cpp
componentmanagers/slidermanager.cpp
componentmanagers/viewmanager.cpp
componentmanagers/rawtextmanager.cpp
componentmanagers/scrollviewmanager.cpp
componentmanagers/navigatormanager.cpp
componentmanagers/activityindicatormanager.cpp
componentmanagers/buttonmanager.cpp
componentmanagers/modalmanager.cpp
componentmanagers/textmanager.cpp
componentmanagers/textinputmanager.cpp
componentmanagers/imagemanager.cpp
componentmanagers/imageloader.cpp
componentmanagers/pickermanager.cpp
componentmanagers/switchmanager.cpp
componentmanagers/webviewmanager.cpp
componentmanagers/scrollviewmodel.cpp
componentmanagers/mediaplayermanager.cpp
layout/flexbox.cpp
utilities.cpp
communication/serverconnection.cpp
communication/executor.cpp
communication/websocketexecutor.cpp
communication/iexecutor.h
websocketmodule.cpp
../../../ReactCommon/yoga/yoga/Yoga.cpp
../../../ReactCommon/yoga/yoga/YGEnums.cpp
../../../ReactCommon/yoga/yoga/YGNode.cpp
../../../ReactCommon/yoga/yoga/YGNodePrint.cpp
../../../ReactCommon/yoga/yoga/YGStyle.cpp
../../../ReactCommon/yoga/yoga/YGLayout.cpp
../../../ReactCommon/yoga/yoga/YGEnums.cpp
../../../ReactCommon/yoga/yoga/Utils.cpp
../../../ReactCommon/yoga/yoga/YGFloatOptional.cpp
../../../ReactCommon/yoga/yoga/YGConfig.cpp
)
message(STATUS "REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC = ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC}")
set (SRC ${SRC_RUNTIME} ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC})
set(
QML
qml/ReactImage.qml
qml/ReactView.qml
qml/ReactNavigator.qml
qml/ReactScrollView.qml
qml/ReactScrollListView.qml
qml/ReactRedboxItem.qml
qml/ReactText.qml
qml/ReactRawText.qml
qml/ReactActivityIndicator.qml
qml/ReactButton.qml
qml/ReactSlider.qml
qml/ReactModal.qml
qml/DevMenu.qml
qml/ReactTextInput.qml
qml/ReactTextInputArea.qml
qml/ReactTextInputField.qml
qml/ReactAlert.qml
)
if (USE_QTWEBKIT)
set(QML ${QML} qml/ReactQtWebKitWebView.qml)
ADD_DEFINITIONS(-DUSE_QTWEBKIT)
else()
set(QML ${QML} qml/ReactWebView.qml)
endif()
if(DEFINED REACT_BUILD_STATIC_LIB)
add_library(
react-native STATIC
${SRC}
${QML}
react_resources.qrc
)
else()
add_library(
react-native SHARED
${SRC}
${QML}
react_resources.qrc
)
set_target_properties(
react-native
PROPERTIES LIBRARY_OUTPUT_DIRECTORY React
)
endif()
if (REACT_NATIVE_DESKTOP_EXTERNAL_QT_COMPONENTS)
find_package(Qt5 COMPONENTS ${REACT_NATIVE_DESKTOP_EXTERNAL_QT_COMPONENTS} REQUIRED)
endif()
if (REACT_NATIVE_DESKTOP_EXTERNAL_PROJECT_DEPS)
add_dependencies(react-native orwell ${REACT_NATIVE_DESKTOP_EXTERNAL_PROJECT_DEPS})
endif()
if (REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_LIBS)
target_link_libraries(react-native orwell Boost::thread Qt5::WebSockets ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_LIBS})
endif()
if(JAVASCRIPTCORE_ENABLED)
add_dependencies(react-native orwell JavaScriptCore_ep folly_ep)
target_link_libraries(react-native orwell Boost::thread
${JavaScriptCore_STATIC_LIB} ${bmalloc_STATIC_LIB} ${WTF_STATIC_LIB}
"-licudata"
"-licui18n"
"-licuuc"
"-lglog"
"-ldouble-conversion"
${FOLLY_STATIC_LIB}
)
endif()
include_directories(${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_INCLUDE_DIRS})
set(USED_QT_MODULES Qt5::WebSockets Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Concurrent)
if (USE_QTWEBKIT)
set (USED_QT_MODULES ${USED_QT_MODULES} WebKit)
endif()
target_link_libraries(react-native orwell ${USED_QT_MODULES})
add_custom_target(
copy-qmldir ALL
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/React
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment