Commit 9301d8a7 authored by Raymond Knopp's avatar Raymond Knopp

add websrv as optional lib and frontend as independant target in oai build

parent 8ad4c7b7
...@@ -57,7 +57,7 @@ CMAKE_BUILD_TYPE="RelWithDebInfo" ...@@ -57,7 +57,7 @@ CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_CMD="$CMAKE" CMAKE_CMD="$CMAKE"
BUILD_ECLIPSE=0 BUILD_ECLIPSE=0
NR="False" NR="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope websrv"
RU=0 RU=0
trap handle_ctrl_c INT trap handle_ctrl_c INT
......
...@@ -30,6 +30,6 @@ endforeach() ...@@ -30,6 +30,6 @@ endforeach()
install(TARGETS telnetsrv DESTINATION bin) install(TARGETS telnetsrv DESTINATION bin)
if (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build") if (EXISTS "${OPENAIR_CMAKE}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_CMAKE}/ran_build/build")
install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/ran_build/build) install(TARGETS telnetsrv DESTINATION ${OPENAIR_CMAKE}/ran_build/build)
endif (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build") endif (EXISTS "${OPENAIR_CMAKE}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_CMAKE}/ran_build/build")
...@@ -50,6 +50,10 @@ telnetshell_cmddef_t loader_cmdarray[] = { ...@@ -50,6 +50,10 @@ telnetshell_cmddef_t loader_cmdarray[] = {
/*-------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------*/
int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt) int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{ {
if (buff == NULL) {
prnt("ERROR wrong loader SHOW command...\n");
return 0;
}
if (debug > 0) if (debug > 0)
prnt( "loader_show_cmd received %s\n",buff); prnt( "loader_show_cmd received %s\n",buff);
......
...@@ -249,7 +249,6 @@ int websrv_callback_get_softmodeminfo(const struct _u_request * request, struct ...@@ -249,7 +249,6 @@ int websrv_callback_get_softmodeminfo(const struct _u_request * request, struct
// telnetparams.CmdParsers[i].cmd[j].helpstr); // telnetparams.CmdParsers[i].cmd[j].helpstr);
// } // }
} }
json_t *body=json_pack("{s:{s:s,s:s},s:o}", json_t *body=json_pack("{s:{s:s,s:s},s:o}",
"display_status", "config_file", cfgfile, "executable_function", execfunc, "display_status", "config_file", cfgfile, "executable_function", execfunc,
"menu_cmds", cmdnames); "menu_cmds", cmdnames);
......
if ( "${OPENAIR_CMAKE}" STREQUAL "")
message( FATAL_ERROR "oai Environment variables not set")
endif ( "${OPENAIR_CMAKE}" STREQUAL "")
set(WEBSRVROOT ${OPENAIR_DIR}/common/utils/websrv ) set(WEBSRVROOT ${OPENAIR_DIR}/common/utils/websrv )
# websrv dependencies
#set( ULFIUS "")
find_library(ULFIUS NAMES "libulfius.so" REQUIRED NO_CACHE)
if ("${ULFIUS}" STREQUAL "")
message( FATAL_ERROR "ulfius library (https://github.com/babelouest/ulfius) not found, install libulfius-dev (ubuntu) ")
endif("${ULFIUS}" STREQUAL "")
#set (NPM "")
find_program(NPM NAMES npm NO_CACHE)
if ("${NPM}" STREQUAL "")
message( ERROR " npm is not installed, frontend won't be built. Possibly install npm, package is available for ubuntu and fedora")
endif("${NPM}" STREQUAL "")
# build the backend ( the embedded web server)
set(WEBSRV_SOURCE set(WEBSRV_SOURCE
${WEBSRVROOT}/websrv.c ${WEBSRVROOT}/websrv.c
) )
add_library(websrv MODULE ${WEBSRV_SOURCE} ) add_library(websrv MODULE ${WEBSRV_SOURCE} )
target_link_libraries(websrv PRIVATE ulfius jansson) target_link_libraries(websrv PRIVATE ulfius jansson)
install(TARGETS websrv DESTINATION bin) # build the frontend ( loaded from web server by browsers)
add_custom_target (
websrvfront_installjsdep
WORKING_DIRECTORY ${WEBSRVROOT}/frontend
COMMAND npm install
DEPENDS ${WEBSRVROOT}/frontend/package-lock.json
)
if (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build") add_custom_target (
install(TARGETS websrv DESTINATION ${OPENAIR_BUILD_DIR}/ran_build/build) websrvfront
endif (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build") WORKING_DIRECTORY ${WEBSRVROOT}/frontend
COMMAND npm run build
DEPENDS websrvfront_installjsdep
)
#install built files, required at exec time
install(TARGETS websrv DESTINATION bin)
if (EXISTS "${OPENAIR_CMAKE}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_CMAKE}/ran_build/build")
add_custom_command(TARGET websrvfront
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBSRVROOT}/frontend/dist/softmodem-ngx ${OPENAIR_CMAKE}/ran_build/build/websrv
COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBSRVROOT}/frontend/dist/softmodem-ngx ${OPENAIR_TARGETS}/bin/websrv
COMMENT "Moving frontend files to:\n ${OPENAIR_CMAKE}/ran_build/build/websrv\n ${OPENAIR_TARGETS}/bin/websrv" )
endif (EXISTS "${OPENAIR_CMAKE}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_CMAKE}/ran_build/build")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment