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 |
Ed Tanous | c81ca42 | 2017-03-21 16:18:49 -0700 | [diff] [blame] | 19 | noVNC/core/inflator.js |
| 20 | noVNC/core/input/xtscancodes.js |
| 21 | noVNC/core/input/util.js |
| 22 | noVNC/core/input/devices.js |
| 23 | noVNC/core/input/keysym.js |
| 24 | noVNC/core/input/keysymdef.js |
| 25 | noVNC/core/websock.js |
| 26 | noVNC/core/util.js |
| 27 | noVNC/core/base64.js |
| 28 | noVNC/core/rfb.js |
| 29 | noVNC/core/des.js |
| 30 | noVNC/core/display.js |
| 31 | noVNC/app/ui.js |
| 32 | noVNC/app/webutil.js |
| 33 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 34 | ) |
| 35 | |
| 36 | set(CSS_ASSETS |
| 37 | css/intel.css |
| 38 | css/bootstrap.css |
| 39 | css/font-awesome.css |
| 40 | css/bootstrap-theme.css |
| 41 | css/prettify.css |
Ed Tanous | c81ca42 | 2017-03-21 16:18:49 -0700 | [diff] [blame] | 42 | noVNC/app/styles/base.css |
| 43 | noVNC/app/styles/auto.css |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 44 | ) |
| 45 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 46 | set(HTML_ASSETS |
| 47 | index.html |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 48 | partial-login.html |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 49 | partial-eventlog.html |
| 50 | partial-fruinfo.html |
| 51 | partial-home-list.html |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 52 | partial-ipmi.html |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 53 | partial-kvm.html |
| 54 | partial-systeminfo.html |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 55 | ) |
| 56 | |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 57 | set(OTHER_ASSETS |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 58 | img/logo.png |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 59 | fonts/fontawesome-webfont.woff |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 60 | ) |
| 61 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 62 | set(STATIC_ASSETS_OUT "") |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 63 | set(MINIFIED_ASSETS_OUT "") |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 64 | foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS}) |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 65 | |
| 66 | set(MINIFIED_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET}) |
| 67 | get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY) |
| 68 | # string(REGEX REPLACE "(\\.[^.]*$)" ".min\\1" OUTPUT_FILENAME ${OUTPUT_FILENAME}) |
| 69 | file(MAKE_DIRECTORY "${FOLDERNAME}") |
| 70 | add_custom_command(OUTPUT ${MINIFIED_FILENAME} |
| 71 | COMMAND closure-compiler --language_in=ECMASCRIPT5 |
| 72 | --js "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" |
| 73 | --js_output_file "${MINIFIED_FILENAME}" |
| 74 | --compilation_level SIMPLE_OPTIMIZATIONS |
| 75 | --angular_pass |
| 76 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" |
| 77 | COMMENT "Minifying ${JAVASCRIPT_ASSET}" |
| 78 | ) |
| 79 | |
| 80 | |
| 81 | list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME}) |
| 82 | # if it's a debug build, use the unminified version |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 83 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 84 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}) |
| 85 | else() |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 86 | list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME}) |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 87 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 88 | endforeach(JAVASCRIPT_ASSET) |
| 89 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 90 | # for now CSS is included as is |
| 91 | foreach(CSS_ASSET ${CSS_ASSETS}) |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 92 | set(MINIFIED_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET}) |
| 93 | get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY) |
| 94 | file(MAKE_DIRECTORY "${FOLDERNAME}") |
| 95 | add_custom_command(OUTPUT ${MINIFIED_FILENAME} |
| 96 | COMMAND cssnano |
| 97 | "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}" |
| 98 | "${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET}" |
| 99 | |
| 100 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}" |
| 101 | COMMENT "Minifying ${CSS_ASSET}" |
| 102 | ) |
| 103 | list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME}) |
| 104 | # if it's a debug build, use the unminified version |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 105 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 106 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}) |
| 107 | else() |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 108 | list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME}) |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 109 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug") |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 110 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 111 | endforeach(CSS_ASSET) |
| 112 | |
| 113 | # for now HTML is included as is |
| 114 | foreach(HTML_ASSET ${HTML_ASSETS}) |
| 115 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET}) |
| 116 | endforeach(HTML_ASSET) |
| 117 | |
| 118 | # for now IMG is included as is |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 119 | foreach(OTHER_ASSET ${OTHER_ASSETS}) |
| 120 | list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${OTHER_ASSET}) |
| 121 | endforeach(OTHER_ASSET) |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 122 | |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 123 | # this taret is the dependency that the build script uses to make sure everything is available |
| 124 | add_custom_target(buildstatic ALL DEPENDS ${STATIC_ASSETS_OUT}) |
| 125 | |
| 126 | # this target makes sure that assets are minified in debug builds, even if they aren't used |
| 127 | add_custom_target(minifyassets ALL DEPENDS ${MINIFIED_ASSETS_OUT}) |
| 128 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 129 | |
Ed Tanous | 9b65f1f | 2017-03-07 15:17:13 -0800 | [diff] [blame] | 130 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated) |
| 131 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 132 | set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp) |
| 133 | set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py") |
| 134 | |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 135 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 136 | set(DEBUG_MODE "-d") |
| 137 | endif() |
| 138 | |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 139 | add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE} |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 140 | COMMAND ${WEBASSET_SCRIPT} ${DEBUG_MODE} |
Ed Tanous | 904063f | 2017-03-02 16:48:24 -0800 | [diff] [blame] | 141 | -o ${CXX_STATIC_ASSETS_OUTPUT_FILE} -i ${STATIC_ASSETS_OUT} |
| 142 | |
| 143 | DEPENDS ${STATIC_ASSETS_OUT} ${WEBASSET_SCRIPT} |
| 144 | COMMENT "Building CPP file ${CXX_STATIC_ASSETS_OUTPUT_FILE}" |
| 145 | ) |
| 146 | |
| 147 | add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE}) |