blob: acfc8a892424c869e5344397176d7dcf98e5f2b2 [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 Tanous904063f2017-03-02 16:48:24 -080011 js/angular-resource.js
12 js/angular-sanitize.js
13 js/bmcApp.js
Ed Tanous1ccd57c2017-03-21 13:15:58 -070014 js/base64.js
Ed Tanous904063f2017-03-02 16:48:24 -080015 js/angular-animate.js
16 js/run_prettify.js
17 js/angular.js
18 js/versionController.js
Ed Tanousc81ca422017-03-21 16:18:49 -070019 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 Tanous904063f2017-03-02 16:48:24 -080034)
35
36set(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 Tanousc81ca422017-03-21 16:18:49 -070042 noVNC/app/styles/base.css
43 noVNC/app/styles/auto.css
Ed Tanous904063f2017-03-02 16:48:24 -080044)
45
Ed Tanous38bdb982017-03-03 14:19:33 -080046set(HTML_ASSETS
47 index.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070048 partial-login.html
Ed Tanous38bdb982017-03-03 14:19:33 -080049 partial-eventlog.html
50 partial-fruinfo.html
51 partial-home-list.html
Ed Tanous1ccd57c2017-03-21 13:15:58 -070052 partial-ipmi.html
Ed Tanous38bdb982017-03-03 14:19:33 -080053 partial-kvm.html
54 partial-systeminfo.html
Ed Tanous38bdb982017-03-03 14:19:33 -080055)
56
Ed Tanous1ccd57c2017-03-21 13:15:58 -070057set(OTHER_ASSETS
Ed Tanous38bdb982017-03-03 14:19:33 -080058 img/logo.png
Ed Tanous1ccd57c2017-03-21 13:15:58 -070059 fonts/fontawesome-webfont.woff
Ed Tanous38bdb982017-03-03 14:19:33 -080060)
61
Ed Tanous904063f2017-03-02 16:48:24 -080062set(STATIC_ASSETS_OUT "")
Ed Tanous93f987d2017-04-17 17:52:36 -070063set(MINIFIED_ASSETS_OUT "")
Ed Tanous904063f2017-03-02 16:48:24 -080064foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS})
Ed Tanous93f987d2017-04-17 17:52:36 -070065
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 Tanous1ccd57c2017-03-21 13:15:58 -070083 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous38bdb982017-03-03 14:19:33 -080084 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET})
85 else()
Ed Tanous93f987d2017-04-17 17:52:36 -070086 list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME})
Ed Tanous1ccd57c2017-03-21 13:15:58 -070087 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanous904063f2017-03-02 16:48:24 -080088endforeach(JAVASCRIPT_ASSET)
89
Ed Tanous38bdb982017-03-03 14:19:33 -080090# for now CSS is included as is
91foreach(CSS_ASSET ${CSS_ASSETS})
Ed Tanous93f987d2017-04-17 17:52:36 -070092 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 Tanous1ccd57c2017-03-21 13:15:58 -0700105 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700106 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${CSS_ASSET})
107 else()
Ed Tanous93f987d2017-04-17 17:52:36 -0700108 list(APPEND STATIC_ASSETS_OUT ${MINIFIED_FILENAME})
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700109 endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
Ed Tanousc4771fb2017-03-13 13:39:49 -0700110
Ed Tanous38bdb982017-03-03 14:19:33 -0800111endforeach(CSS_ASSET)
112
113# for now HTML is included as is
114foreach(HTML_ASSET ${HTML_ASSETS})
115 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${HTML_ASSET})
116endforeach(HTML_ASSET)
117
118# for now IMG is included as is
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700119foreach(OTHER_ASSET ${OTHER_ASSETS})
120 list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${OTHER_ASSET})
121endforeach(OTHER_ASSET)
Ed Tanous38bdb982017-03-03 14:19:33 -0800122
Ed Tanous93f987d2017-04-17 17:52:36 -0700123# this taret is the dependency that the build script uses to make sure everything is available
124add_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
127add_custom_target(minifyassets ALL DEPENDS ${MINIFIED_ASSETS_OUT})
128
Ed Tanous904063f2017-03-02 16:48:24 -0800129
Ed Tanous9b65f1f2017-03-07 15:17:13 -0800130file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
131
Ed Tanous904063f2017-03-02 16:48:24 -0800132set(CXX_STATIC_ASSETS_OUTPUT_FILE ${CMAKE_BINARY_DIR}/generated/webassets.cpp)
133set(WEBASSET_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_web_assets.py")
134
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700135if (CMAKE_BUILD_TYPE STREQUAL "Debug")
136 set(DEBUG_MODE "-d")
137endif()
138
Ed Tanous904063f2017-03-02 16:48:24 -0800139add_custom_command(OUTPUT ${CXX_STATIC_ASSETS_OUTPUT_FILE}
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700140 COMMAND ${WEBASSET_SCRIPT} ${DEBUG_MODE}
Ed Tanous904063f2017-03-02 16:48:24 -0800141 -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
147add_custom_target(packagestaticcpp ALL DEPENDS ${CXX_STATIC_ASSETS_OUTPUT_FILE})