Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 1 | set(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 Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 8 | js/kvmController.js |
| 9 | js/loginController.js |
| 10 | js/ipmiController.js |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 11 | js/angular-resource.js |
| 12 | js/angular-sanitize.js |
| 13 | js/bmcApp.js |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 14 | js/base64.js |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 15 | js/angular-animate.js |
| 16 | js/run_prettify.js |
| 17 | js/angular.js |
| 18 | js/versionController.js |
| 19 | noVNC/utils/parse.js |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 20 | //noVNC/utils/inflator.partial.js |
| 21 | //noVNC/karma.conf.js |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 22 | 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 | |
| 41 | set(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 Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 47 | //noVNC/include/base.css |
| 48 | //noVNC/include/blue.css |
| 49 | //noVNC/include/black.css |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 50 | ) |
| 51 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 52 | set(HTML_ASSETS |
| 53 | index.html |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 54 | partial-login.html |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 55 | partial-eventlog.html |
| 56 | partial-fruinfo.html |
| 57 | partial-home-list.html |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 58 | partial-ipmi.html |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 59 | partial-kvm.html |
| 60 | partial-systeminfo.html |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 61 | ) |
| 62 | |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 63 | set(OTHER_ASSETS |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 64 | img/logo.png |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 65 | fonts/fontawesome-webfont.woff |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 66 | ) |
| 67 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 68 | set(STATIC_ASSETS_OUT "") |
| 69 | foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS}) |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 70 | # if it's a debug build, don't minify |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 71 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 72 | 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 Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 76 | # string(REGEX REPLACE "(\\.[^.]*$)" ".min\\1" OUTPUT_FILENAME ${OUTPUT_FILENAME}) |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 77 | 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 Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 82 | --js_output_file "${OUTPUT_FILENAME}" |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 83 | --compilation_level SIMPLE_OPTIMIZATIONS |
| 84 | --angular_pass |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 85 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" |
| 86 | COMMENT "Minifying ${JAVASCRIPT_ASSET}" |
| 87 | ) |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 88 | list(APPEND STATIC_ASSETS_OUT ${OUTPUT_FILENAME}) |
| 89 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 90 | endforeach(JAVASCRIPT_ASSET) |
| 91 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 92 | # for now CSS is included as is |
| 93 | foreach(CSS_ASSET ${CSS_ASSETS}) |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 94 | # if it's a debug build, don't minify |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 95 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 96 | 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 Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 111 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 112 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 113 | endforeach(CSS_ASSET) |
| 114 | |
| 115 | # for now HTML is included as is |
| 116 | foreach(HTML_ASSET ${HTML_ASSETS}) |
| 117 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET}) |
| 118 | endforeach(HTML_ASSET) |
| 119 | |
| 120 | # for now IMG is included as is |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 121 | foreach(OTHER_ASSET ${OTHER_ASSETS}) |
| 122 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${OTHER_ASSET}) |
| 123 | endforeach(OTHER_ASSET) |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 124 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 125 | add_custom_target(minifyjs ALL DEPENDS ${STATIC_ASSETS_OUT}) |
| 126 | |
Ed Tanous | 9b65f1f | 2017-03-07 15:17:13 -0800 | [diff] [blame] | 127 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated) |
| 128 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 129 | set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp) |
| 130 | set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py") |
| 131 | |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 132 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 133 | set(DEBUG_MODE "-d") |
| 134 | endif() |
| 135 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 136 | add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE} |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame^] | 137 | COMMAND ${WEBASSET_SCRIPT} ${DEBUG_MODE} |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 138 | -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 | |
| 144 | add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE}) |