• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# the minimum version of CMake.
2cmake_minimum_required(VERSION 3.4.1)
3project(NapiSample)
4
5set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
6set(CJSON_LIB_PATH ${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH})
7set(FFMPEG_LIB_PATH ${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH})
8add_definitions(-DOHOS_PLATFORM)
9
10include_directories(${NATIVERENDER_ROOT_PATH}
11                    ${NATIVERENDER_ROOT_PATH}/include
12                    ${NATIVERENDER_ROOT_PATH}/thirdparty/cJSON/${OHOS_ARCH}/include
13                    ${NATIVERENDER_ROOT_PATH}/thirdparty/FFmpeg/${OHOS_ARCH}/include
14                    ${NATIVERENDER_ROOT_PATH}/ncpp/ffmpegcase)
15
16add_library(entry SHARED
17    nodeapi/envlifecycleapis/napiinstancedata.cpp
18    nodeapi/datatypes/nadatatypes.cpp
19    nodeapi/datatypes/napistatus.cpp
20    nodeapi/datatypes/napienv.cpp
21    nodeapi/datatypes/napivalue.cpp
22    nodeapi/datatypes/napithreadsafefunc.cpp
23    nodeapi/datatypes/napithreadsafefuncrel.cpp
24    nodeapi/datatypes/napithreadsafefuncall.cpp
25    nodeapi/datatypes/napiextendederrorinfo.cpp
26    ncpp/cjsoncase/cjsonsample.cpp
27    ncpp/cjsoncase/cjsoncase.cpp
28    ncpp/cjsoncase/cjsonparsecase.cpp
29    ncpp/cjsoncase/cjsongetarraysizecase.cpp
30    ncpp/cjsoncase/cjsonprintcase.cpp
31    ncpp/cjsoncase/cjsoncreateobjectcase.cpp
32    ncpp/cjsoncase/cjsoncreatestringcase.cpp
33    ncpp/cjsoncase/cjsonaddstringtoobjectcase.cpp
34    ncpp/cjsoncase/cjsonaddnumbertoobjectcase.cpp
35    ncpp/cjsoncase/cjsonaddfalsetoobjectcase.cpp
36    ncpp/cjsoncase/cjsoncommon.cpp
37    ncpp/cjsoncase/cjsonadditemtoobjectcase.cpp
38    ncpp/cjsoncase/cjsoncreatearraycase.cpp
39    ncpp/cjsoncase/cjsoncreateintarraycase.cpp
40    ncpp/cjsoncase/cjsonadditemtoarraycase.cpp
41    javascriptapi/jsproperty/napigetpropertynames.cpp
42    javascriptapi/jsproperty/napigetproperty.cpp
43    javascriptapi/jsproperty/napisetproperty.cpp
44    javascriptapi/jsproperty/napihasproperty.cpp
45    javascriptapi/jsproperty/napideleteproperty.cpp
46    javascriptapi/jsproperty/napigetnamedproperty.cpp
47    javascriptapi/jsproperty/napisetnamedproperty.cpp
48    javascriptapi/jsproperty/napihasnamedproperty.cpp
49    javascriptapi/jsproperty/napisetelement.cpp
50    javascriptapi/jsproperty/napigetelement.cpp
51    javascriptapi/jsproperty/napihaselement.cpp
52    javascriptapi/jsproperty/napideleteelement.cpp
53    javascriptapi/jsproperty/jsPropertyInit.cpp
54    javascriptapi/common.cpp
55    javascriptapi/jsabstractops/napicoercetobool.cpp
56    javascriptapi/jsabstractops/napicoercetonumber.cpp
57    javascriptapi/jsabstractops/napicoercetoobject.cpp
58    javascriptapi/jsabstractops/napicoercetostring.cpp
59    javascriptapi/jsabstractops/napitypeof.cpp
60    javascriptapi/jsabstractops/init.cpp
61    javascriptapi/jsvalues/jsValuesInit.cpp
62    javascriptapi/jsvalues/napicreateint32.cpp
63    javascriptapi/jsvalues/napicreateuint32.cpp
64    javascriptapi/jsvalues/napicreateint64.cpp
65    ncpp/ffmpegcase/render/egl_core.cpp
66    ncpp/ffmpegcase/render/plugin_render.cpp
67    ncpp/ffmpegcase/manager/plugin_manager.cpp
68    basesample/basesample.cpp
69
70    init.cpp
71)
72
73find_library(
74    # Sets the name of the path variable.
75    EGL-lib
76    # Specifies the name of the NDK library that
77    # you want CMake to locate.
78    EGL
79)
80
81find_library(
82    # Sets the name of the path variable.
83    GLES-lib
84    # Specifies the name of the NDK library that
85    # you want CMake to locate.
86    GLESv3
87)
88
89find_library(
90    # Sets the name of the path variable.
91    hilog-lib
92    # Specifies the name of the NDK library that
93    # you want CMake to locate.
94    hilog_ndk.z
95)
96
97find_library(
98    # Sets the name of the path variable.
99    libace-lib
100    # Specifies the name of the NDK library that
101    # you want CMake to locate.
102    ace_ndk.z
103)
104
105find_library(
106    # Sets the name of the path variable.
107    libnapi-lib
108    # Specifies the name of the NDK library that
109    # you want CMake to locate.
110    ace_napi.z
111)
112
113find_library(
114    # Sets the name of the path variable.
115    libuv-lib
116    # Specifies the name of the NDK library that
117    # you want CMake to locate.
118    uv
119)
120
121#    ${FFMPEG_LIB_PATH}/libavcodec.so
122#    ${FFMPEG_LIB_PATH}/libavformat.so
123#    ${FFMPEG_LIB_PATH}/libavdevice.so
124#    ${FFMPEG_LIB_PATH}/libavfilter.so
125#    ${FFMPEG_LIB_PATH}/libavutil.so
126target_link_libraries(entry PUBLIC
127    libace_napi.z.so
128    libace_ndk.z.so
129    librawfile.z.so
130    libhilog_ndk.z.so
131    ${CJSON_LIB_PATH}/libcjson.so
132    ${FFMPEG_LIB_PATH}/libavformat.so
133    ${FFMPEG_LIB_PATH}/libavcodec.so
134    ${FFMPEG_LIB_PATH}/libavutil.so
135    ${EGL-lib}
136    ${GLES-lib}
137    ${hilog-lib}
138    ${libace-lib}
139    ${libnapi-lib}
140    ${libuv-lib})
141
142