blob: b7371d1733e7458c376d3b0158a3418d8aef7b10 [file] [log] [blame]
Ed Tanous904063f2017-03-02 16:48:24 -08001set(JAVASCRIPT_ASSETS
2 js/selController.js
3 js/lodash.core.js
4 js/ui-bootstrap-tpls-2.1.3.js
5 js/angular-cookies.js
6 js/angular-websocket.js
7 js/angular-ui-router.js
8 js/restangular.js
9 js/kvm-controller.js
Ed Tanous38bdb982017-03-03 14:19:33 -080010 js/logincontroller.js
Ed Tanous904063f2017-03-02 16:48:24 -080011 js/angular-resource.js
12 js/angular-sanitize.js
13 js/bmcApp.js
14 js/angular-animate.js
15 js/run_prettify.js
16 js/angular.js
17 js/versionController.js
18 noVNC/utils/parse.js
19 noVNC/utils/inflator.partial.js
20 noVNC/karma.conf.js
21 noVNC/include/inflator.js
22 noVNC/include/keysym.js
23 noVNC/include/chrome-app/tcp-client.js
24 noVNC/include/ui.js
25 noVNC/include/keysymdef.js
26 noVNC/include/websock.js
27 noVNC/include/util.js
28 noVNC/include/base64.js
29 noVNC/include/logo.js
30 noVNC/include/input.js
31 noVNC/include/rfb.js
32 noVNC/include/des.js
33 noVNC/include/playback.js
34 noVNC/include/xtscancodes.js
35 noVNC/include/keyboard.js
36 noVNC/include/webutil.js
37 noVNC/include/display.js
38)
39
40set(CSS_ASSETS
41 css/intel.css
42 css/bootstrap.css
43 css/font-awesome.css
44 css/bootstrap-theme.css
45 css/prettify.css
Ed Tanous904063f2017-03-02 16:48:24 -080046 noVNC/include/base.css
47 noVNC/include/blue.css
48 noVNC/include/black.css
49)
50
Ed Tanous38bdb982017-03-03 14:19:33 -080051set(HTML_ASSETS
52 index.html
53 login.html
54 partial-eventlog.html
55 partial-fruinfo.html
56 partial-home-list.html
57 partial-kvm.html
58 partial-systeminfo.html
59 websocket.html
60)
61
62set(IMG_ASSETS
63 img/logo.png
64)
65
Ed Tanous904063f2017-03-02 16:48:24 -080066set(STATIC_ASSETS_OUT "")
67foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS})
Ed Tanous38bdb982017-03-03 14:19:33 -080068 # if it's a debug build, don't minify
69 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
70 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET})
71 else()
72 set(OUTPUT_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
73 get_filename_component(FOLDERNAME ${OUTPUT_FILENAME} DIRECTORY)
74 file(MAKE_DIRECTORY "${FOLDERNAME}")
75 # TODO only minify if not a debug build
76 add_custom_command(OUTPUT ${OUTPUT_FILENAME}
77 COMMAND closure-compiler --language_in=ECMASCRIPT5
78 --js "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
79 --js_output_file "${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET}"
Ed Tanous904063f2017-03-02 16:48:24 -080080
Ed Tanous38bdb982017-03-03 14:19:33 -080081 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
82 COMMENT "Minifying ${JAVASCRIPT_ASSET}"
83 )
84 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
85 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous904063f2017-03-02 16:48:24 -080086endforeach(JAVASCRIPT_ASSET)
87
Ed Tanous38bdb982017-03-03 14:19:33 -080088# for now CSS is included as is
89foreach(CSS_ASSET ${CSS_ASSETS})
90 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET})
91endforeach(CSS_ASSET)
92
93# for now HTML is included as is
94foreach(HTML_ASSET ${HTML_ASSETS})
95 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET})
96endforeach(HTML_ASSET)
97
98# for now IMG is included as is
99foreach(IMG_ASSET ${IMG_ASSETS})
100 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${IMG_ASSET})
101endforeach(IMG_ASSET)
102
103message(STATIC_ASSETS_OUT ${CMAKE_CURRENT_BINARY_DIR}/${STATIC_ASSETS_OUT})
104
Ed Tanous904063f2017-03-02 16:48:24 -0800105add_custom_target(minifyjs ALL DEPENDS ${STATIC_ASSETS_OUT})
106
107set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp)
108set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py")
109
110add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE}
111 COMMAND ${WEBASSET_SCRIPT}
112 -o ${CXX_STATIC_ASSETS_OUTPUT_FILE} -i ${STATIC_ASSETS_OUT}
113
114 DEPENDS ${STATIC_ASSETS_OUT} ${WEBASSET_SCRIPT}
115 COMMENT "Building CPP file ${CXX_STATIC_ASSETS_OUTPUT_FILE}"
116)
117
118add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE})