blob: 29d5921b6bf83b7d2ae6b3395c181b9850e0a731 [file] [log] [blame]
Ed Tanous904063f2017-03-02 16:48:24 -08001set(JAVASCRIPT_ASSETS
2 js/selController.js
3 js/lodash.core.js
Ed Tanous4758d5b2017-06-06 15:28:13 -07004 js/ui-bootstrap-tpls-2.5.0.js
Ed Tanous904063f2017-03-02 16:48:24 -08005 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 Tanous4758d5b2017-06-06 15:28:13 -070011 js/fwupdateController.js
12 js/mainController.js
Ed Tanouscc5a37f2017-05-11 10:27:23 -070013 js/versionController.js
14 js/sensorController.js
Ed Tanous904063f2017-03-02 16:48:24 -080015 js/angular-sanitize.js
16 js/bmcApp.js
Ed Tanous1ccd57c2017-03-21 13:15:58 -070017 js/base64.js
Ed Tanous904063f2017-03-02 16:48:24 -080018 js/angular-animate.js
19 js/run_prettify.js
20 js/angular.js
Ed Tanous4758d5b2017-06-06 15:28:13 -070021 js/angular-ui-router-uib-modal.js
Ed Tanouscc5a37f2017-05-11 10:27:23 -070022
Ed Tanousc81ca422017-03-21 16:18:49 -070023 noVNC/core/inflator.js
24 noVNC/core/input/xtscancodes.js
25 noVNC/core/input/util.js
26 noVNC/core/input/devices.js
27 noVNC/core/input/keysym.js
28 noVNC/core/input/keysymdef.js
29 noVNC/core/websock.js
30 noVNC/core/util.js
31 noVNC/core/base64.js
32 noVNC/core/rfb.js
33 noVNC/core/des.js
34 noVNC/core/display.js
35 noVNC/app/ui.js
36 noVNC/app/webutil.js
37
Ed Tanous904063f2017-03-02 16:48:24 -080038)
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 Tanousc81ca422017-03-21 16:18:49 -070046 noVNC/app/styles/base.css
47 noVNC/app/styles/auto.css
Ed Tanous904063f2017-03-02 16:48:24 -080048)
49
Ed Tanous38bdb982017-03-03 14:19:33 -080050set(HTML_ASSETS
51 index.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070052 partial-login.html
Ed Tanous38bdb982017-03-03 14:19:33 -080053 partial-eventlog.html
54 partial-fruinfo.html
55 partial-home-list.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070056 partial-ipmi.html
Ed Tanous38bdb982017-03-03 14:19:33 -080057 partial-kvm.html
Ed Tanouscc5a37f2017-05-11 10:27:23 -070058 partial-sensor.html
Ed Tanous38bdb982017-03-03 14:19:33 -080059 partial-systeminfo.html
Ed Tanous4758d5b2017-06-06 15:28:13 -070060 partial-fwupdate.html
61 partial-fwupdateconfirm.html
Ed Tanous38bdb982017-03-03 14:19:33 -080062)
63
Ed Tanous1ccd57c2017-03-21 13:15:58 -070064set(OTHER_ASSETS
Ed Tanous38bdb982017-03-03 14:19:33 -080065 img/logo.png
Ed Tanous4758d5b2017-06-06 15:28:13 -070066 img/blur-bg.jpg
Ed Tanous1ccd57c2017-03-21 13:15:58 -070067 fonts/fontawesome-webfont.woff
Ed Tanous38bdb982017-03-03 14:19:33 -080068)
69
Ed Tanous904063f2017-03-02 16:48:24 -080070set(STATIC_ASSETS_OUT "")
Ed Tanous93f987d2017-04-17 17:52:36 -070071set(MINIFIED_ASSETS_OUT "")
Ed Tanous904063f2017-03-02 16:48:24 -080072foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS})
Ed Tanous93f987d2017-04-17 17:52:36 -070073
74 set(MINIFIED_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
75 get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY)
76 # string(REGEX REPLACE "(\\.[^.]*$)" ".min\\1" OUTPUT_FILENAME ${OUTPUT_FILENAME})
77 file(MAKE_DIRECTORY "${FOLDERNAME}")
78 add_custom_command(OUTPUT ${MINIFIED_FILENAME}
79 COMMAND closure-compiler --language_in=ECMASCRIPT5
80 --js "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
81 --js_output_file "${MINIFIED_FILENAME}"
82 --compilation_level SIMPLE_OPTIMIZATIONS
83 --angular_pass
84 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
85 COMMENT "Minifying ${JAVASCRIPT_ASSET}"
86 )
87
88
89 list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME})
90 # if it's a debug build, use the unminified version
Ed Tanous1ccd57c2017-03-21 13:15:58 -070091 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous38bdb982017-03-03 14:19:33 -080092 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET})
93 else()
Ed Tanous93f987d2017-04-17 17:52:36 -070094 list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME})
Ed Tanous1ccd57c2017-03-21 13:15:58 -070095 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous904063f2017-03-02 16:48:24 -080096endforeach(JAVASCRIPT_ASSET)
97
Ed Tanous38bdb982017-03-03 14:19:33 -080098# for now CSS is included as is
99foreach(CSS_ASSET ${CSS_ASSETS})
Ed Tanous93f987d2017-04-17 17:52:36 -0700100 set(MINIFIED_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET})
101 get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY)
102 file(MAKE_DIRECTORY "${FOLDERNAME}")
103 add_custom_command(OUTPUT ${MINIFIED_FILENAME}
104 COMMAND cssnano
105 "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}"
106 "${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET}"
107
108 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}"
109 COMMENT "Minifying ${CSS_ASSET}"
110 )
111 list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME})
112 # if it's a debug build, use the unminified version
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700113 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700114 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET})
115 else()
Ed Tanous93f987d2017-04-17 17:52:36 -0700116 list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME})
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700117 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700118
Ed Tanous38bdb982017-03-03 14:19:33 -0800119endforeach(CSS_ASSET)
120
121# for now HTML is included as is
122foreach(HTML_ASSET ${HTML_ASSETS})
123 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET})
124endforeach(HTML_ASSET)
125
126# for now IMG is included as is
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700127foreach(OTHER_ASSET ${OTHER_ASSETS})
128 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${OTHER_ASSET})
129endforeach(OTHER_ASSET)
Ed Tanous38bdb982017-03-03 14:19:33 -0800130
Ed Tanous93f987d2017-04-17 17:52:36 -0700131# this taret is the dependency that the build script uses to make sure everything is available
132add_custom_target(buildstatic ALL DEPENDS ${STATIC_ASSETS_OUT})
133
134# this target makes sure that assets are minified in debug builds, even if they aren't used
135add_custom_target(minifyassets ALL DEPENDS ${MINIFIED_ASSETS_OUT})
136
Ed Tanous904063f2017-03-02 16:48:24 -0800137
Ed Tanous9b65f1f2017-03-07 15:17:13 -0800138file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
139
Ed Tanous904063f2017-03-02 16:48:24 -0800140set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp)
141set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py")
142
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700143if (CMAKE_BUILD_TYPE STREQUAL "Debug")
144 set(DEBUG_MODE "-d")
145endif()
146
Ed Tanous904063f2017-03-02 16:48:24 -0800147add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE}
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700148 COMMAND ${WEBASSET_SCRIPT} ${DEBUG_MODE}
Ed Tanous904063f2017-03-02 16:48:24 -0800149 -o ${CXX_STATIC_ASSETS_OUTPUT_FILE} -i ${STATIC_ASSETS_OUT}
150
151 DEPENDS ${STATIC_ASSETS_OUT} ${WEBASSET_SCRIPT}
152 COMMENT "Building CPP file ${CXX_STATIC_ASSETS_OUTPUT_FILE}"
153)
154
155add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE})