-
Notifications
You must be signed in to change notification settings - Fork 710
Windows build #3213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows build #3213
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,5 @@ tests/*.pyc | |
|
|
||
| # Ignore PyPI build artifacts | ||
| dist/ | ||
|
|
||
| .vscode/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,22 +5,27 @@ | |
| # | ||
| # Authors: Martin Belanger <[email protected]> | ||
| # | ||
| sources = [ | ||
| 'nvme/accessors.c', | ||
| 'nvme/base64.c', | ||
| 'nvme/cmds.c', | ||
| 'nvme/crc32.c', | ||
| 'nvme/filters.c', | ||
| 'nvme/ioctl.c', | ||
| 'nvme/lib.c', | ||
| 'nvme/linux.c', | ||
| 'nvme/log.c', | ||
| 'nvme/mi-mctp.c', | ||
| 'nvme/mi.c', | ||
| 'nvme/sysfs.c', | ||
| 'nvme/tree.c', | ||
| 'nvme/util.c', | ||
| ] | ||
| sources = [] | ||
| if host_system == 'windows' | ||
| sources += [] | ||
| else | ||
| sources += [ | ||
| 'nvme/accessors.c', | ||
| 'nvme/base64.c', | ||
| 'nvme/cmds.c', | ||
| 'nvme/crc32.c', | ||
| 'nvme/filters.c', | ||
| 'nvme/ioctl.c', | ||
| 'nvme/lib.c', | ||
| 'nvme/linux.c', | ||
| 'nvme/log.c', | ||
| 'nvme/mi-mctp.c', | ||
| 'nvme/mi.c', | ||
| 'nvme/sysfs.c', | ||
| 'nvme/tree.c', | ||
| 'nvme/util.c', | ||
| ] | ||
| endif | ||
| headers = [ | ||
| 'nvme/accessors.h', | ||
| 'nvme/cmds.h', | ||
|
|
@@ -50,21 +55,31 @@ if liburing_dep.found() | |
| sources += 'nvme/uring.c' | ||
| endif | ||
|
|
||
| if json_c_dep.found() | ||
| sources += 'nvme/json.c' | ||
| else | ||
| sources += 'nvme/no-json.c' | ||
| if host_system != 'windows' | ||
| if json_c_dep.found() | ||
| sources += 'nvme/json.c' | ||
| else | ||
| sources += 'nvme/no-json.c' | ||
| endif | ||
| endif | ||
|
|
||
| deps = [ | ||
| config_dep, | ||
| ccan_dep, | ||
| json_c_dep, | ||
| keyutils_dep, | ||
| libdbus_dep, | ||
| liburing_dep, | ||
| openssl_dep, | ||
| ] | ||
| if host_system == 'windows' | ||
| deps += [ | ||
| kernel32_dep | ||
| ] | ||
| else | ||
| deps += [ | ||
| libdbus_dep, | ||
| liburing_dep, | ||
| ] | ||
| endif | ||
|
|
||
| nvme_ld = meson.current_source_dir() / 'libnvme.ld' | ||
| nvmf_ld = meson.current_source_dir() / 'libnvmf.ld' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ fs = import('fs') | |
|
|
||
| cc = meson.get_compiler('c') | ||
| cxx_available = add_languages('cpp', required: false, native: false) | ||
| host_system = host_machine.system() | ||
|
|
||
| ################################################################################ | ||
| # Determine which features we need to build: The nvme executable, the libnvme | ||
|
|
@@ -51,10 +52,15 @@ cxx_available = add_languages('cpp', required: false, native: false) | |
| # dependencies are present. Also, -Dpython=enabled forces -Dlibnvme=enabled. | ||
| want_nvme = get_option('nvme').disabled() == false | ||
| want_libnvme = get_option('libnvme').disabled() == false | ||
| want_fabrics = get_option('fabrics').disabled() == false | ||
| want_fabrics = get_option('fabrics').disabled() == false and host_system != 'windows' | ||
| want_json_c = get_option('json-c').disabled() == false and host_system != 'windows' | ||
| want_tests = get_option('tests') and host_system != 'windows' | ||
|
Comment on lines
53
to
+57
|
||
| want_examples = get_option('examples') and host_system != 'windows' | ||
| want_docs = get_option('docs') | ||
| want_docs_build = get_option('docs-build') | ||
|
|
||
| is_static = get_option('default_library') == 'static' and host_system != 'windows' | ||
|
|
||
| feature_python = get_option('python') | ||
| if not want_fabrics or feature_python.disabled() | ||
| py3_dep = dependency('', required: false) # Needed for muon | ||
|
|
@@ -131,8 +137,12 @@ conf.set('RUNDIR', '"@0@"'.format(rundir)) | |
|
|
||
| conf.set('CONFIG_FABRICS', want_fabrics, description: 'Is fabrics enabled') | ||
|
|
||
| if host_system == 'windows' | ||
| kernel32_dep = cc.find_library('kernel32', required: true) | ||
| endif | ||
|
|
||
| # Check for libjson-c availability | ||
| if get_option('json-c').disabled() | ||
| if not want_json_c | ||
| json_c_dep = dependency('', required: false) | ||
| else | ||
| json_c_dep = dependency( | ||
|
|
@@ -363,7 +373,6 @@ conf.set10( | |
| description: 'Is linux/mctp.h include-able?' | ||
| ) | ||
|
|
||
| is_static = get_option('default_library') == 'static' | ||
| have_netdb = false | ||
| if not is_static | ||
| have_netdb = cc.links( | ||
|
|
@@ -473,45 +482,67 @@ if want_nvme | |
| subdir('plugins') # declares: plugin_sources | ||
| subdir('util') # declares: util_sources | ||
|
|
||
| sources = [ | ||
| 'libnvme-wrap.c', | ||
| 'logging.c', | ||
| 'nvme-cmds.c', | ||
| 'nvme-models.c', | ||
| 'nvme-print-binary.c', | ||
| 'nvme-print-stdout.c', | ||
| 'nvme-print.c', | ||
| 'nvme-rpmb.c', | ||
| 'nvme.c', | ||
| 'plugin.c', | ||
| ] | ||
| sources = [] | ||
| if host_system == 'windows' | ||
| sources += [ | ||
| 'nvme-dummy.c', # Dummy source file for Windows port bring up. | ||
| ] | ||
| else | ||
| sources += [ | ||
| 'libnvme-wrap.c', | ||
| 'logging.c', | ||
| 'nvme-cmds.c', | ||
| 'nvme-models.c', | ||
| 'nvme-print-binary.c', | ||
| 'nvme-print-stdout.c', | ||
| 'nvme-print.c', | ||
| 'nvme-rpmb.c', | ||
| 'nvme.c', | ||
| 'plugin.c', | ||
| ] | ||
|
|
||
| if json_c_dep.found() | ||
| sources += [ | ||
| 'nvme-print-json.c', | ||
| ] | ||
| endif | ||
| endif | ||
|
|
||
| if want_fabrics | ||
| sources += 'fabrics.c' | ||
| endif | ||
|
|
||
| if json_c_dep.found() | ||
| sources += [ | ||
| 'nvme-print-json.c', | ||
| ] | ||
| endif | ||
| sources += plugin_sources | ||
| sources += util_sources | ||
|
|
||
| link_args_list = [] | ||
| link_deps = [ | ||
| config_dep, | ||
| ccan_dep, | ||
| libnvme_dep, | ||
| json_c_dep, | ||
| ] | ||
|
|
||
| if host_system == 'windows' | ||
| link_deps += [ | ||
| kernel32_dep, | ||
| ] | ||
| else | ||
| link_args_list = ['-ldl'] | ||
| endif | ||
|
|
||
| executable( | ||
| 'nvme', | ||
| sources, | ||
| dependencies: [ | ||
| config_dep, | ||
| ccan_dep, | ||
| libnvme_dep, | ||
| json_c_dep, | ||
| ], | ||
| link_args: '-ldl', | ||
| dependencies: link_deps, | ||
| link_args: link_args_list, | ||
| install: true, | ||
| install_dir: sbindir, | ||
| ) | ||
|
|
||
| subdir('unit') | ||
| if host_system != 'windows' | ||
| subdir('unit') | ||
| endif | ||
| if get_option('nvme-tests') | ||
| subdir('tests') | ||
| endif | ||
|
|
@@ -645,6 +676,11 @@ dep_dict = { | |
| 'python3': py3_dep.found(), | ||
| 'liburing': liburing_dep.found(), | ||
| } | ||
| if host_system == 'windows' | ||
| dep_dict += { | ||
| 'kernel32': kernel32_dep.found(), | ||
| } | ||
| endif | ||
| summary(dep_dict, section: 'Dependencies', bool_yn: true) | ||
|
|
||
| wanted_dict = { | ||
|
|
@@ -661,4 +697,3 @@ conf_dict = { | |
| 'pdc enabled': get_option('pdc-enabled'), | ||
| } | ||
| summary(conf_dict, section: 'Configuration', bool_yn: true) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||||||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||||||||||
|
|
||||||||||
| #include <stdio.h> | ||||||||||
|
|
||||||||||
| int main(int argc, char **argv) | ||||||||||
| { | ||||||||||
|
||||||||||
| { | |
| { | |
| (void)argc; | |
| (void)argv; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,25 @@ | ||
| # SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| util_sources = [ | ||
| 'util/argconfig.c', | ||
| 'util/base64.c', | ||
| 'util/crc32.c', | ||
| 'util/mem.c', | ||
| 'util/sighdl.c', | ||
| 'util/suffix.c', | ||
| 'util/types.c', | ||
| 'util/utils.c', | ||
| 'util/table.c' | ||
| ] | ||
| util_sources = [] | ||
|
|
||
| if json_c_dep.found() | ||
| if host_system == 'windows' | ||
| util_sources += [] | ||
| else | ||
| util_sources += [ | ||
| 'util/json.c', | ||
| 'util/argconfig.c', | ||
| 'util/base64.c', | ||
| 'util/crc32.c', | ||
| 'util/mem.c', | ||
| 'util/sighdl.c', | ||
| 'util/suffix.c', | ||
| 'util/types.c', | ||
| 'util/utils.c', | ||
| 'util/table.c' | ||
| ] | ||
|
|
||
| if json_c_dep.found() | ||
| util_sources += [ | ||
| 'util/json.c', | ||
| ] | ||
| endif | ||
| endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows, this leaves
sourcesempty (want_fabrics is disabled on Windows, liburing/json sources are also gated away), but the file later unconditionally createslibrary('nvme', sources, ...). Meson typically errors on a library target with no sources; add at least a stub source for Windows or skip building libnvme on Windows.