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 |
| 8 | js/restangular.js |
| 9 | js/kvm-controller.js |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame^] | 10 | js/logincontroller.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 |
| 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 | |
| 40 | set(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 Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 46 | noVNC/include/base.css |
| 47 | noVNC/include/blue.css |
| 48 | noVNC/include/black.css |
| 49 | ) |
| 50 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame^] | 51 | set(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 | |
| 62 | set(IMG_ASSETS |
| 63 | img/logo.png |
| 64 | ) |
| 65 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 66 | set(STATIC_ASSETS_OUT "") |
| 67 | foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS}) |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame^] | 68 | # 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 Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 80 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame^] | 81 | 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 Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 86 | endforeach(JAVASCRIPT_ASSET) |
| 87 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame^] | 88 | # for now CSS is included as is |
| 89 | foreach(CSS_ASSET ${CSS_ASSETS}) |
| 90 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}) |
| 91 | endforeach(CSS_ASSET) |
| 92 | |
| 93 | # for now HTML is included as is |
| 94 | foreach(HTML_ASSET ${HTML_ASSETS}) |
| 95 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET}) |
| 96 | endforeach(HTML_ASSET) |
| 97 | |
| 98 | # for now IMG is included as is |
| 99 | foreach(IMG_ASSET ${IMG_ASSETS}) |
| 100 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${IMG_ASSET}) |
| 101 | endforeach(IMG_ASSET) |
| 102 | |
| 103 | message(STATIC_ASSETS_OUT ${CMAKE_CURRENT_BINARY_DIR}/${STATIC_ASSETS_OUT}) |
| 104 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 105 | add_custom_target(minifyjs ALL DEPENDS ${STATIC_ASSETS_OUT}) |
| 106 | |
| 107 | set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp) |
| 108 | set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py") |
| 109 | |
| 110 | add_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 | |
| 118 | add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE}) |