Skip to content

Commit 2e3f935

Browse files
jktjktmichalvasko
authored andcommitted
MSVC: tools: disable interactive tools
I don't feel like porting linenoise to Windows, there's no getline, etc.
1 parent a3fe12a commit 2e3f935

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

tools/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
configure_file(${PROJECT_SOURCE_DIR}/tools/config.h.in ${PROJECT_BINARY_DIR}/tools/config.h @ONLY)
33

44
add_subdirectory(lint)
5-
add_subdirectory(re)
5+
if(NOT WIN32)
6+
add_subdirectory(re)
7+
endif()
68

79
set(format_sources
810
${format_sources}

tools/lint/CMakeLists.txt

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# yanglint
22

3+
if(WIN32)
4+
set(YANGLINT_INTERACTIVE OFF)
5+
else()
6+
set(YANGLINT_INTERACTIVE ON)
7+
endif()
8+
39
set(lintsrc
4-
main.c
510
main_ni.c
611
cmd.c
712
cmd_add.c
@@ -13,9 +18,17 @@ set(lintsrc
1318
cmd_print.c
1419
cmd_searchpath.c
1520
common.c
16-
completion.c
17-
configuration.c
18-
linenoise/linenoise.c)
21+
)
22+
if(YANGLINT_INTERACTIVE)
23+
set(lintsrc ${lintsrc}
24+
main.c
25+
completion.c
26+
configuration.c
27+
linenoise/linenoise.c)
28+
else()
29+
set(lintsrc ${lintsrc}
30+
main_ni_only.c)
31+
endif()
1932

2033
set(format_sources
2134
${format_sources}
@@ -53,7 +66,7 @@ if(ENABLE_TESTS)
5366
find_program(PATH_EXPECT NAMES expect)
5467
if(NOT PATH_EXPECT)
5568
message(WARNING "'expect' not found! The yanglint(1) interactive tests will not be available.")
56-
else()
69+
elseif(YANGLINT_INTERACTIVE)
5770
# add_yanglint_test(NAME in_list SCRIPT expect/list.exp)
5871
endif()
5972
endif()

tools/lint/main_ni_only.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @file main_ni_only.c
3+
* @brief non-interactive implementation of main() for those platforms without the linenoise library
4+
*
5+
* Copyright (c) 2015-2021 CESNET, z.s.p.o.
6+
*
7+
* This source code is licensed under BSD 3-Clause License (the "License").
8+
* You may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* https://opensource.org/licenses/BSD-3-Clause
12+
*/
13+
14+
int main_ni(int argc, char *argv[]);
15+
16+
int done; /* for cmd.c */
17+
18+
int
19+
main(int argc, char *argv[])
20+
{
21+
return main_ni(argc, argv);
22+
}

0 commit comments

Comments
 (0)