Skip to content

Commit bd3e3da

Browse files
authored
Merge pull request #99 from microsoft/vcpkgfeatures
Add vcpkg port features
2 parents afda7f9 + 6da3b12 commit bd3e3da

File tree

6 files changed

+62
-9
lines changed

6 files changed

+62
-9
lines changed

.github/actions/build-with-host/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ runs:
5353

5454
- name: CMake Configure Cross-Compile ${{ inputs.arch }}
5555
if: ${{ inputs.arch }}
56-
run: cmake --preset ${{ inputs.preset-name }} --fresh -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DNETREMOTE_DISABLE_TESTS=TRUE -A ${{ inputs.arch }}
56+
run: cmake --preset ${{ inputs.preset-name }} --fresh -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DNETREMOTE_EXCLUDE_TESTS=TRUE -A ${{ inputs.arch }}
5757
shell: pwsh
5858

5959
- name: CMake Build

CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.25)
55
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
66
include(vcpkg)
77
option(NETREMOTE_VCPKG_BUILD_FOR_PORT "Enable building the project via a vcpkg port" OFF)
8+
option(NETREMOTE_EXCLUDE_PROTOCOL "Disable building the protocol" OFF)
9+
option(NETREMOTE_EXCLUDE_SERVER "Disable building the server" OFF)
10+
option(NETREMOTE_EXCLUDE_TOOLS "Disable building the tools" OFF)
11+
option(NETREMOTE_EXCLUDE_TESTS "Disable building the tests" OFF)
812

913
# vcpkg build target.
1014
#
@@ -109,15 +113,15 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GN
109113
-Wl,-z,relro
110114
-z noexecstack
111115
)
112-
if (NOF_CODE_COVERAGE)
116+
if (NETREMOTE_CODE_COVERAGE)
113117
add_compile_options(
114118
-fprofile-arcs
115119
-ftest-coverage
116120
)
117121
endif()
118122
# clang specific options
119123
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
120-
if (NOF_CODE_COVERAGE)
124+
if (NETREMOTE_CODE_COVERAGE)
121125
add_compile_options(
122126
-fprofile-instr-generate
123127
-fcoverage-mapping
@@ -149,9 +153,12 @@ if (WERROR)
149153
endif()
150154

151155
add_subdirectory(packaging)
152-
add_subdirectory(protocol)
153156
add_subdirectory(src)
154157

155-
if (NOT NETREMOTE_DISABLE_TESTS)
158+
if (NOT NETREMOTE_EXCLUDE_PROTOCOL)
159+
add_subdirectory(protocol)
160+
endif()
161+
162+
if (NOT NETREMOTE_EXCLUDE_TESTS)
156163
add_subdirectory(tests)
157164
endif()

packaging/vcpkg/ports/netremote/portfile.cmake.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ vcpkg_find_acquire_program(
1010
GIT
1111
)
1212

13+
vcpkg_check_features(
14+
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
15+
INVERTED_FEATURES
16+
protocol NETREMOTE_EXCLUDE_PROTOCOL
17+
server NETREMOTE_EXCLUDE_SERVER
18+
tests NETREMOTE_EXCLUDE_TESTS
19+
tools NETREMOTE_EXCLUDE_TOOLS
20+
)
21+
1322
vcpkg_cmake_configure(
1423
SOURCE_PATH ${SOURCE_PATH}
1524
OPTIONS
16-
-DNETREMOTE_DISABLE_TESTS=TRUE
1725
${FEATURE_OPTIONS}
1826
)
1927

packaging/vcpkg/ports/netremote/vcpkg.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,35 @@
2121
"name": "vcpkg-cmake-config",
2222
"host": true
2323
}
24+
],
25+
"features": {
26+
"protocol": {
27+
"description": "Enable building the client protocol",
28+
"dependencies": [
29+
"grpc",
30+
"protobuf"
31+
]
32+
},
33+
"server":{
34+
"description": "Enable building the server",
35+
"dependencies": [
36+
"netremote"
37+
]
38+
},
39+
"tests":{
40+
"description": "Enable building the tests",
41+
"dependencies": [
42+
"netremote"
43+
]
44+
},
45+
"tools":{
46+
"description": "Enable building the tools",
47+
"dependencies": [
48+
"netremote"
49+
]
50+
}
51+
},
52+
"default-features": [
53+
"protocol"
2454
]
2555
}

src/linux/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11

22
add_subdirectory(external)
33
add_subdirectory(libnl-helpers)
4-
add_subdirectory(server)
5-
add_subdirectory(tools)
64
add_subdirectory(wifi)
75
add_subdirectory(wpa-controller)
6+
7+
if (NOT NETREMOTE_EXCLUDE_TOOLS)
8+
add_subdirectory(tools)
9+
endif()
10+
11+
if (NOT NETREMOTE_EXCLUDE_SERVER)
12+
add_subdirectory(server)
13+
endif()

src/windows/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ add_compile_options(
1717
/bigobj
1818
)
1919

20-
add_subdirectory(server)
20+
if (NOT NETREMOTE_EXCLUDE_SERVER)
21+
add_subdirectory(server)
22+
endif()

0 commit comments

Comments
 (0)