blob: 45795efe418540af2270a9bb9a6eedad46bebed5 [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
Ed Tanous1ccd57c2017-03-21 13:15:58 -07008 js/kvmController.js
9 js/loginController.js
10 js/ipmiController.js
Ed Tanous904063f2017-03-02 16:48:24 -080011 js/angular-resource.js
12 js/angular-sanitize.js
13 js/bmcApp.js
Ed Tanous1ccd57c2017-03-21 13:15:58 -070014 js/base64.js
Ed Tanous904063f2017-03-02 16:48:24 -080015 js/angular-animate.js
16 js/run_prettify.js
17 js/angular.js
18 js/versionController.js
19 noVNC/utils/parse.js
Ed Tanous1ccd57c2017-03-21 13:15:58 -070020 //noVNC/utils/inflator.partial.js
21 //noVNC/karma.conf.js
Ed Tanous904063f2017-03-02 16:48:24 -080022 noVNC/include/inflator.js
23 noVNC/include/keysym.js
24 noVNC/include/chrome-app/tcp-client.js
25 noVNC/include/ui.js
26 noVNC/include/keysymdef.js
27 noVNC/include/websock.js
28 noVNC/include/util.js
29 noVNC/include/base64.js
30 noVNC/include/logo.js
31 noVNC/include/input.js
32 noVNC/include/rfb.js
33 noVNC/include/des.js
34 noVNC/include/playback.js
35 noVNC/include/xtscancodes.js
36 noVNC/include/keyboard.js
37 noVNC/include/webutil.js
38 noVNC/include/display.js
39)
40
41set(CSS_ASSETS
42 css/intel.css
43 css/bootstrap.css
44 css/font-awesome.css
45 css/bootstrap-theme.css
46 css/prettify.css
Ed Tanous1ccd57c2017-03-21 13:15:58 -070047 //noVNC/include/base.css
48 //noVNC/include/blue.css
49 //noVNC/include/black.css
Ed Tanous904063f2017-03-02 16:48:24 -080050)
51
Ed Tanous38bdb982017-03-03 14:19:33 -080052set(HTML_ASSETS
53 index.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070054 partial-login.html
Ed Tanous38bdb982017-03-03 14:19:33 -080055 partial-eventlog.html
56 partial-fruinfo.html
57 partial-home-list.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070058 partial-ipmi.html
Ed Tanous38bdb982017-03-03 14:19:33 -080059 partial-kvm.html
60 partial-systeminfo.html
Ed Tanous38bdb982017-03-03 14:19:33 -080061)
62
Ed Tanous1ccd57c2017-03-21 13:15:58 -070063set(OTHER_ASSETS
Ed Tanous38bdb982017-03-03 14:19:33 -080064 img/logo.png
Ed Tanous1ccd57c2017-03-21 13:15:58 -070065 fonts/fontawesome-webfont.woff
Ed Tanous38bdb982017-03-03 14:19:33 -080066)
67
Ed Tanous904063f2017-03-02 16:48:24 -080068set(STATIC_ASSETS_OUT "")
69foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS})
Ed Tanous38bdb982017-03-03 14:19:33 -080070 # if it's a debug build, don't minify
Ed Tanous1ccd57c2017-03-21 13:15:58 -070071 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous38bdb982017-03-03 14:19:33 -080072 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET})
73 else()
74 set(OUTPUT_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
75 get_filename_component(FOLDERNAME ${OUTPUT_FILENAME} DIRECTORY)
Ed Tanous1ccd57c2017-03-21 13:15:58 -070076 # string(REGEX REPLACE "(\\.[^.]*$)" ".min\\1" OUTPUT_FILENAME ${OUTPUT_FILENAME})
Ed Tanous38bdb982017-03-03 14:19:33 -080077 file(MAKE_DIRECTORY "${FOLDERNAME}")
78 # TODO only minify if not a debug build
79 add_custom_command(OUTPUT ${OUTPUT_FILENAME}
80 COMMAND closure-compiler --language_in=ECMASCRIPT5
81 --js "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
Ed Tanous1ccd57c2017-03-21 13:15:58 -070082 --js_output_file "${OUTPUT_FILENAME}"
Ed Tanousc4771fb2017-03-13 13:39:49 -070083 --compilation_level SIMPLE_OPTIMIZATIONS
84 --angular_pass
Ed Tanous38bdb982017-03-03 14:19:33 -080085 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
86 COMMENT "Minifying ${JAVASCRIPT_ASSET}"
87 )
Ed Tanous1ccd57c2017-03-21 13:15:58 -070088 list(APPEND STATIC_ASSETS_OUT ${OUTPUT_FILENAME})
89 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous904063f2017-03-02 16:48:24 -080090endforeach(JAVASCRIPT_ASSET)
91
Ed Tanous38bdb982017-03-03 14:19:33 -080092# for now CSS is included as is
93foreach(CSS_ASSET ${CSS_ASSETS})
Ed Tanousc4771fb2017-03-13 13:39:49 -070094 # if it's a debug build, don't minify
Ed Tanous1ccd57c2017-03-21 13:15:58 -070095 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -070096 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET})
97 else()
98 set(OUTPUT_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET})
99 get_filename_component(FOLDERNAME ${OUTPUT_FILENAME} DIRECTORY)
100 file(MAKE_DIRECTORY "${FOLDERNAME}")
101 # TODO only minify if not a debug build
102 add_custom_command(OUTPUT ${OUTPUT_FILENAME}
103 COMMAND cssnano
104 "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}"
105 "${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET}"
106
107 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}"
108 COMMENT "Minifying ${CSS_ASSET}"
109 )
110 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET})
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700111 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700112
Ed Tanous38bdb982017-03-03 14:19:33 -0800113endforeach(CSS_ASSET)
114
115# for now HTML is included as is
116foreach(HTML_ASSET ${HTML_ASSETS})
117 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET})
118endforeach(HTML_ASSET)
119
120# for now IMG is included as is
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700121foreach(OTHER_ASSET ${OTHER_ASSETS})
122 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${OTHER_ASSET})
123endforeach(OTHER_ASSET)
Ed Tanous38bdb982017-03-03 14:19:33 -0800124
Ed Tanous904063f2017-03-02 16:48:24 -0800125add_custom_target(minifyjs ALL DEPENDS ${STATIC_ASSETS_OUT})
126
Ed Tanous9b65f1f2017-03-07 15:17:13 -0800127file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
128
Ed Tanous904063f2017-03-02 16:48:24 -0800129set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp)
130set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py")
131
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700132if (CMAKE_BUILD_TYPE STREQUAL "Debug")
133 set(DEBUG_MODE "-d")
134endif()
135
Ed Tanous904063f2017-03-02 16:48:24 -0800136add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE}
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700137 COMMAND ${WEBASSET_SCRIPT} ${DEBUG_MODE}
Ed Tanous904063f2017-03-02 16:48:24 -0800138 -o ${CXX_STATIC_ASSETS_OUTPUT_FILE} -i ${STATIC_ASSETS_OUT}
139
140 DEPENDS ${STATIC_ASSETS_OUT} ${WEBASSET_SCRIPT}
141 COMMENT "Building CPP file ${CXX_STATIC_ASSETS_OUTPUT_FILE}"
142)
143
144add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE})