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

Support CMAKE_MSVC_RUNTIME_LIBRARY #1737

Merged
merged 3 commits into from
Aug 15, 2024
Merged

Support CMAKE_MSVC_RUNTIME_LIBRARY #1737

merged 3 commits into from
Aug 15, 2024

Conversation

justsmth
Copy link
Contributor

@justsmth justsmth commented Aug 2, 2024

Description of changes:

Testing

I tested with both the Ninja and "Visual Studio 17 2022" generators.

cmake ~/repos/aws-lc -B ~/AWS-LC-BUILD -DBUILD_SHARED_LIBS=0 -DCMAKE_GENERATOR=Ninja -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake ~/repos/aws-lc -B ~/AWS-LC-BUILD  -B C:\Users\Administrator\AWS-LC-BUILD\ -DBUILD_SHARED_LIBS=1 -DCMAKE_GENERATOR=Ninja -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake ~/repos/aws-lc -B ~/AWS-LC-BUILD -DBUILD_SHARED_LIBS=0 -DCMAKE_GENERATOR="Visual Studio 17 2022" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake ~/repos/aws-lc -B ~/AWS-LC-BUILD -DBUILD_SHARED_LIBS=1 -DCMAKE_GENERATOR="Visual Studio 17 2022" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded

Shared (not recommended, but technically possible)

Before

% for LIBR in `find "${AWS_LC_BUILD}" -name "*.dll"`; do echo ===== `basename $LIBR` =====; "${DUMPBIN}" //IMPORTS ${LIBR} | grep '.dll' ; done
...
===== crypto.dll =====
Dump of file C:\Users\Administrator\AWS-LC-BUILD\crypto\crypto.dll
    WS2_32.dll
    KERNEL32.dll
    VCRUNTIME140D.dll
    ucrtbased.dll

After

% for LIBR in `find "${AWS_LC_BUILD}" -name "*.dll"`; do echo ===== `basename $LIBR` =====; "${DUMPBIN}" //IMPORTS ${LIBR} | grep '.dll' ; done
...
===== crypto.dll =====
Dump of file C:\Users\Administrator\AWS-LC-BUILD\crypto\crypto.dll
    WS2_32.dll
    KERNEL32.dll

Static

Before

for LIBR in `find "${AWS_LC_BUILD}" -name "*.lib"`; do echo ===== `basename $LIBR` =====; "${DUMPBIN}" //DIRECTIVES ${LIBR} | grep 'DEFAULTLIB:MSVCRT' | wc -l ; done
...
===== crypto.lib =====
250
...

After

for LIBR in `find "${AWS_LC_BUILD}" -name "*.lib"`; do echo ===== `basename $LIBR` =====; "${DUMPBIN}" //DIRECTIVES ${LIBR} | grep 'DEFAULTLIB:MSVCRT' | wc -l ; done
...
===== crypto.lib =====
0
...

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@justsmth justsmth requested a review from a team as a code owner August 2, 2024 20:53
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.44%. Comparing base (94f021b) to head (7e4f381).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1737      +/-   ##
==========================================
- Coverage   78.46%   78.44%   -0.03%     
==========================================
  Files         580      580              
  Lines       96779    96780       +1     
  Branches    13865    13866       +1     
==========================================
- Hits        75936    75916      -20     
- Misses      20226    20246      +20     
- Partials      617      618       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justinwsmith
Copy link
Contributor

justinwsmith commented Aug 5, 2024

It's not recommended to use static CRT with DLL libraries, especially when CRT objects (such as FILE) could be passed across the DLL boundary.

@justsmth justsmth merged commit ae49736 into aws:main Aug 15, 2024
105 of 106 checks passed
@justsmth justsmth deleted the CMP0091 branch August 15, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants