blob: 58bfdbb3e5beef26e76b8639f5a94a2bf4f06a3d [file] [log] [blame]
Ed Tanous904063f2017-03-02 16:48:24 -08001set(HTML_ASSETS
2 hello.html
3 login.html
4 partial-eventlog.html
5 partial-fruinfo.html
6 partial-home-list.html
7 partial-kvm.html
8 partial-systeminfo.html
9 websocket.html
10)
11
12
13set(JAVASCRIPT_ASSETS
14 js/selController.js
15 js/lodash.core.js
16 js/ui-bootstrap-tpls-2.1.3.js
17 js/angular-cookies.js
18 js/angular-websocket.js
19 js/angular-ui-router.js
20 js/restangular.js
21 js/kvm-controller.js
22 js/angular-resource.js
23 js/angular-sanitize.js
24 js/bmcApp.js
25 js/angular-animate.js
26 js/run_prettify.js
27 js/angular.js
28 js/versionController.js
29 noVNC/utils/parse.js
30 noVNC/utils/inflator.partial.js
31 noVNC/karma.conf.js
32 noVNC/include/inflator.js
33 noVNC/include/keysym.js
34 noVNC/include/chrome-app/tcp-client.js
35 noVNC/include/ui.js
36 noVNC/include/keysymdef.js
37 noVNC/include/websock.js
38 noVNC/include/util.js
39 noVNC/include/base64.js
40 noVNC/include/logo.js
41 noVNC/include/input.js
42 noVNC/include/rfb.js
43 noVNC/include/des.js
44 noVNC/include/playback.js
45 noVNC/include/xtscancodes.js
46 noVNC/include/keyboard.js
47 noVNC/include/webutil.js
48 noVNC/include/display.js
49)
50
51set(CSS_ASSETS
52 css/intel.css
53 css/bootstrap.css
54 css/font-awesome.css
55 css/bootstrap-theme.css
56 css/prettify.css
57 noVNC/tests/viewport.css
58 noVNC/include/base.css
59 noVNC/include/blue.css
60 noVNC/include/black.css
61)
62
63set(STATIC_ASSETS_OUT "")
64foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS})
65 set(OUTPUT_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
66 get_filename_component(FOLDERNAME ${OUTPUT_FILENAME} DIRECTORY)
67 file(MAKE_DIRECTORY "${FOLDERNAME}")
68 # TODO only minify if not a debug build
69 add_custom_command(OUTPUT ${OUTPUT_FILENAME}
70 COMMAND closure-compiler --language_in=ECMASCRIPT5
71 --js "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
72 --js_output_file "${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET}"
73
74 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
75 COMMENT "Minifying ${JAVASCRIPT_ASSET}"
76 )
77 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
78endforeach(JAVASCRIPT_ASSET)
79
80add_custom_target(minifyjs ALL DEPENDS ${STATIC_ASSETS_OUT})
81
82set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp)
83set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py")
84
85add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE}
86 COMMAND ${WEBASSET_SCRIPT}
87 -o ${CXX_STATIC_ASSETS_OUTPUT_FILE} -i ${STATIC_ASSETS_OUT}
88
89 DEPENDS ${STATIC_ASSETS_OUT} ${WEBASSET_SCRIPT}
90 COMMENT "Building CPP file ${CXX_STATIC_ASSETS_OUTPUT_FILE}"
91)
92
93add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE})