blob: 183eeb2f43f9cdb06b1c4f0e8e7b24731e0ef9b8 [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 Tanouscc5a37f2017-05-11 10:27:23 -070011 js/versionController.js
12 js/sensorController.js
Ed Tanous904063f2017-03-02 16:48:24 -080013 js/angular-resource.js
14 js/angular-sanitize.js
15 js/bmcApp.js
Ed Tanous1ccd57c2017-03-21 13:15:58 -070016 js/base64.js
Ed Tanous904063f2017-03-02 16:48:24 -080017 js/angular-animate.js
18 js/run_prettify.js
19 js/angular.js
Ed Tanouscc5a37f2017-05-11 10:27:23 -070020
Ed Tanousc81ca422017-03-21 16:18:49 -070021 noVNC/core/inflator.js
22 noVNC/core/input/xtscancodes.js
23 noVNC/core/input/util.js
24 noVNC/core/input/devices.js
25 noVNC/core/input/keysym.js
26 noVNC/core/input/keysymdef.js
27 noVNC/core/websock.js
28 noVNC/core/util.js
29 noVNC/core/base64.js
30 noVNC/core/rfb.js
31 noVNC/core/des.js
32 noVNC/core/display.js
33 noVNC/app/ui.js
34 noVNC/app/webutil.js
35
Ed Tanous904063f2017-03-02 16:48:24 -080036)
37
38set(CSS_ASSETS
39 css/intel.css
40 css/bootstrap.css
41 css/font-awesome.css
42 css/bootstrap-theme.css
43 css/prettify.css
Ed Tanousc81ca422017-03-21 16:18:49 -070044 noVNC/app/styles/base.css
45 noVNC/app/styles/auto.css
Ed Tanous904063f2017-03-02 16:48:24 -080046)
47
Ed Tanous38bdb982017-03-03 14:19:33 -080048set(HTML_ASSETS
49 index.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070050 partial-login.html
Ed Tanous38bdb982017-03-03 14:19:33 -080051 partial-eventlog.html
52 partial-fruinfo.html
53 partial-home-list.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070054 partial-ipmi.html
Ed Tanous38bdb982017-03-03 14:19:33 -080055 partial-kvm.html
Ed Tanouscc5a37f2017-05-11 10:27:23 -070056 partial-sensor.html
Ed Tanous38bdb982017-03-03 14:19:33 -080057 partial-systeminfo.html
Ed Tanous38bdb982017-03-03 14:19:33 -080058)
59
Ed Tanous1ccd57c2017-03-21 13:15:58 -070060set(OTHER_ASSETS
Ed Tanous38bdb982017-03-03 14:19:33 -080061 img/logo.png
Ed Tanous1ccd57c2017-03-21 13:15:58 -070062 fonts/fontawesome-webfont.woff
Ed Tanous38bdb982017-03-03 14:19:33 -080063)
64
Ed Tanous904063f2017-03-02 16:48:24 -080065set(STATIC_ASSETS_OUT "")
Ed Tanous93f987d2017-04-17 17:52:36 -070066set(MINIFIED_ASSETS_OUT "")
Ed Tanous904063f2017-03-02 16:48:24 -080067foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS})
Ed Tanous93f987d2017-04-17 17:52:36 -070068
69 set(MINIFIED_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${JAVASCRIPT_ASSET})
70 get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY)
71 # string(REGEX REPLACE "(\\.[^.]*$)" ".min\\1" OUTPUT_FILENAME ${OUTPUT_FILENAME})
72 file(MAKE_DIRECTORY "${FOLDERNAME}")
73 add_custom_command(OUTPUT ${MINIFIED_FILENAME}
74 COMMAND closure-compiler --language_in=ECMASCRIPT5
75 --js "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
76 --js_output_file "${MINIFIED_FILENAME}"
77 --compilation_level SIMPLE_OPTIMIZATIONS
78 --angular_pass
79 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}"
80 COMMENT "Minifying ${JAVASCRIPT_ASSET}"
81 )
82
83
84 list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME})
85 # if it's a debug build, use the unminified version
Ed Tanous1ccd57c2017-03-21 13:15:58 -070086 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous38bdb982017-03-03 14:19:33 -080087 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET})
88 else()
Ed Tanous93f987d2017-04-17 17:52:36 -070089 list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME})
Ed Tanous1ccd57c2017-03-21 13:15:58 -070090 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous904063f2017-03-02 16:48:24 -080091endforeach(JAVASCRIPT_ASSET)
92
Ed Tanous38bdb982017-03-03 14:19:33 -080093# for now CSS is included as is
94foreach(CSS_ASSET ${CSS_ASSETS})
Ed Tanous93f987d2017-04-17 17:52:36 -070095 set(MINIFIED_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET})
96 get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY)
97 file(MAKE_DIRECTORY "${FOLDERNAME}")
98 add_custom_command(OUTPUT ${MINIFIED_FILENAME}
99 COMMAND cssnano
100 "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}"
101 "${CMAKE_CURRENT_BINARY_DIR}/${CSS_ASSET}"
102
103 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET}"
104 COMMENT "Minifying ${CSS_ASSET}"
105 )
106 list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME})
107 # if it's a debug build, use the unminified version
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700108 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700109 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET})
110 else()
Ed Tanous93f987d2017-04-17 17:52:36 -0700111 list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME})
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700112 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700113
Ed Tanous38bdb982017-03-03 14:19:33 -0800114endforeach(CSS_ASSET)
115
116# for now HTML is included as is
117foreach(HTML_ASSET ${HTML_ASSETS})
118 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET})
119endforeach(HTML_ASSET)
120
121# for now IMG is included as is
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700122foreach(OTHER_ASSET ${OTHER_ASSETS})
123 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${OTHER_ASSET})
124endforeach(OTHER_ASSET)
Ed Tanous38bdb982017-03-03 14:19:33 -0800125
Ed Tanous93f987d2017-04-17 17:52:36 -0700126# this taret is the dependency that the build script uses to make sure everything is available
127add_custom_target(buildstatic ALL DEPENDS ${STATIC_ASSETS_OUT})
128
129# this target makes sure that assets are minified in debug builds, even if they aren't used
130add_custom_target(minifyassets ALL DEPENDS ${MINIFIED_ASSETS_OUT})
131
Ed Tanous904063f2017-03-02 16:48:24 -0800132
Ed Tanous9b65f1f2017-03-07 15:17:13 -0800133file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
134
Ed Tanous904063f2017-03-02 16:48:24 -0800135set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp)
136set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py")
137
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700138if (CMAKE_BUILD_TYPE STREQUAL "Debug")
139 set(DEBUG_MODE "-d")
140endif()
141
Ed Tanous904063f2017-03-02 16:48:24 -0800142add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE}
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700143 COMMAND ${WEBASSET_SCRIPT} ${DEBUG_MODE}
Ed Tanous904063f2017-03-02 16:48:24 -0800144 -o ${CXX_STATIC_ASSETS_OUTPUT_FILE} -i ${STATIC_ASSETS_OUT}
145
146 DEPENDS ${STATIC_ASSETS_OUT} ${WEBASSET_SCRIPT}
147 COMMENT "Building CPP file ${CXX_STATIC_ASSETS_OUTPUT_FILE}"
148)
149
150add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE})