How to build dynamic (shared) libraries of crashpad?

后端 未结 4 2100
说谎
说谎 2021-01-14 10:36

Crashpad is an error reporting system for c++ apps. https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/developing.md

build instructions are



        
相关标签:
4条回答
  • 2021-01-14 11:12

    We took another look at this today. If you run gn args --list out\Default you'll notice the following:

    extra_cflags
        Current value (from the default) = ""
          From //third_party/mini_chromium/mini_chromium/build/BUILD.gn:50
    
        Extra flags passed to the C compiler.
        Space-separated string of flags.
        "cflags" are passed to all invocations of the C, C++, Objective-C, and
        Objective-C++ compilers.
    

    To add the /MDd flag to your build config run gn args out\Default and add extra_cflags="/MDd" to the build config.

    0 讨论(0)
  • 2021-01-14 11:19

    @bobbyg603's answer is almost what I needed.

    But as usual things are not written by hand but embedded in a script, so opening up an editor to change things is oftentimes not really useful at all. Programmatically, you can also use:

    gn gen out\Default --args="extra_cflags=\"/MD\""
    

    This will also change the arguments for cxx by the way.

    0 讨论(0)
  • 2021-01-14 11:21

    After running gn gen out\Default, you can edit the out\Default\toolchain.ninja file to add extra compiler flags to the command for the cc and cxx rules.

    rule cc
      command = ninja -t msvc -e environment.amd64 -- cl.exe ... ${cflags} ${cflags_c} /c ...
                                     add the /MD compiler flag after the others, here ^
    
    0 讨论(0)
  • 2021-01-14 11:21

    after you generate ninja files, for each ninja file find the switch /MTd (debug) or /MT (release version) and change it to /MDd or /MD so the dynamic libs will be created

    then you can build crashpad with ninja, the output is still lib files so they will be included in the exe file when you link them to your project (you do not have to add them to your project as using dlls).

    0 讨论(0)
提交回复
热议问题