Skip to content
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

ninja still try to compile fmt.lib when only fmt_header_only_dep is used #1803

Closed
trim21 opened this issue Dec 1, 2024 · 2 comments · Fixed by #1811
Closed

ninja still try to compile fmt.lib when only fmt_header_only_dep is used #1803

trim21 opened this issue Dec 1, 2024 · 2 comments · Fixed by #1811

Comments

@trim21
Copy link
Contributor

trim21 commented Dec 1, 2024

for a meson config like this:

project(
    'app',
    'cpp',
    meson_version: '>= 1.3.0',
)

executable(
    'app',
    'main.cc',
    dependencies: [
        subproject('fmt').get_variable('fmt_header_only_dep'),
    ],
)

and after meson setup build, build.ninja looks like this:

# Build rules for targets

build subprojects/fmt-11.0.2/fmt.dll.p/src_format.cc.obj: cpp_COMPILER ../subprojects/fmt-11.0.2/src/format.cc
 DEPFILE = "subprojects\fmt-11.0.2\fmt.dll.p\src_format.cc.obj.d"
 DEPFILE_UNQUOTED = subprojects\fmt-11.0.2\fmt.dll.p\src_format.cc.obj.d
 ARGS = "-Isubprojects\fmt-11.0.2\fmt.dll.p" "-Isubprojects\fmt-11.0.2" "-I..\subprojects\fmt-11.0.2" "-I..\subprojects\fmt-11.0.2\include" "-fdiagnostics-color=always" "-D_GLIBCXX_ASSERTIONS=1" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-std=c++14" "-O0" "-g" "-DFMT_LIB_EXPORT"

build subprojects/fmt-11.0.2/fmt.dll.p/src_os.cc.obj: cpp_COMPILER ../subprojects/fmt-11.0.2/src/os.cc
 DEPFILE = "subprojects\fmt-11.0.2\fmt.dll.p\src_os.cc.obj.d"
 DEPFILE_UNQUOTED = subprojects\fmt-11.0.2\fmt.dll.p\src_os.cc.obj.d
 ARGS = "-Isubprojects\fmt-11.0.2\fmt.dll.p" "-Isubprojects\fmt-11.0.2" "-I..\subprojects\fmt-11.0.2" "-I..\subprojects\fmt-11.0.2\include" "-fdiagnostics-color=always" "-D_GLIBCXX_ASSERTIONS=1" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-std=c++14" "-O0" "-g" "-DFMT_LIB_EXPORT"

build subprojects/fmt-11.0.2/fmt.dll.p/fmt.dll.symbols: SHSYM subprojects/fmt-11.0.2/fmt.dll
 IMPLIB = "subprojects/fmt-11.0.2/fmt.lib"

build subprojects/fmt-11.0.2/fmt.dll | subprojects/fmt-11.0.2/fmt.pdb: cpp_LINKER subprojects/fmt-11.0.2/fmt.dll.p/src_format.cc.obj subprojects/fmt-11.0.2/fmt.dll.p/src_os.cc.obj
 LINK_ARGS = "-Wl,/release" "-Wl,/nologo" "-Wl,/DEBUG" "-Wl,/PDB:subprojects\fmt-11.0.2\fmt.pdb" "-Wl,/DLL" "-Wl,/IMPLIB:subprojects\fmt-11.0.2\fmt.lib" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32"

build app.exe.p/main.cc.obj: cpp_COMPILER ../main.cc
 DEPFILE = "app.exe.p\main.cc.obj.d"
 DEPFILE_UNQUOTED = app.exe.p\main.cc.obj.d
 ARGS = "-Iapp.exe.p" "-I." "-I.." "-I..\subprojects\fmt-11.0.2\include" "-fdiagnostics-color=always" "-D_GLIBCXX_ASSERTIONS=1" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-O0" "-g" "-DFMT_HEADER_ONLY"

and build output:

meson compile -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: C:\Users\Trim21\scoop\shims\ninja.EXE -C C:/Users/Trim21/proj/meson-fmt-header-only/build
ninja: Entering directory `C:/Users/Trim21/proj/meson-fmt-header-only/build'
[5/5] Linking target subprojects/fmt-11.0.2/fmt.dll
  Creating library subprojects\fmt-11.0.2\fmt.lib and object subprojects\fmt-11.0.2\fmt.exp

Is this expected?

If this is expected, how to workaround it?

@jpakkane
Copy link
Member

jpakkane commented Dec 1, 2024

If the library in question does not have build_by_default: false in its kwargs, then it will be built by the default build command. It will also be built if it has the kwarg install: true.

@trim21
Copy link
Contributor Author

trim21 commented Dec 1, 2024

If the library in question does not have build_by_default: false in its kwargs, then it will be built by the default build command. It will also be built if it has the kwarg install: true.

So there is no way to disable it without changing subprojects/packagefiles/fmt/meson.build?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants