Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lateralusX
Copy link
Member

PR setup BTLS build on Windows using Visual Studio msvc compiler. By default, BTLS builds will be disabled on Windows but can be enabled by passing --enable-btls when running ./autogen.sh after #9306 have been merged. Normal mono.sln Visual Studio build will look at configuration and decide if BTLS should be build based on that information (in original config.h). mono.sln have been extended with a new utility project and .bat file taking care of the complete BTLS build following the build configuration currently used in Visual Studio. This way the BTLS build will be an integrated build step part of the overall mono Visual Studio build. BTLS build has been setup to work under all Visual Studio mono build configuration, x86/x64 Debug/Release and build artifacts will end up under standard build tree and output directories.

PR also fixes several mismatches in mono BTLS code related to MONO_API in order to correctly build under msvc compiler and following the same pattern as used by all other mono runtime usage of MONO_API. PR also adjust a couple of warnings in mono’s BTLS code.

Since BTLS build relies on cmake, when enabling BTLS for Windows Visual Studio build, a Windows cmake version must be found or the build will fail. Build also needs to locate a working git version since it needs to make sure mono BTLS submodule has been correctly updated before building. NOTE, since the mono Visual Studio build is done before Cygwin build we can’t depend on the normal submodule update logic to take care of this.

In order to do a full BTLS build supporting assembler optimized encrypt/decrypt/hash functions the Visual Studio cmake generator can not be used. It also adds a number of additional prerequisites like yasm, ninja and perl to the build infrastructure. In order to take this in steps, this PR builds without assembler support making it possible to use cmake Visual Studio generators. Future PR’s will add support for assembler optimized BTLS build if the correct tools can be found on the build system.

@directhex directhex mentioned this pull request Oct 11, 2018
7 tasks
@lateralusX lateralusX force-pushed the lateralusX/build-btls-msvc branch 2 times, most recently from 96c3050 to 020d01e Compare October 11, 2018 18:35
@baulig baulig requested a review from kg October 11, 2018 21:46
Copy link
Contributor

@baulig baulig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the MONO_API changes, but don't know much about compiling with msvc.

@jaykrell
Copy link
Contributor

msvc has different consistency requirements around MONO_API than non-msvc.
i.e. between .h and .c.

@baulig
Copy link
Contributor

baulig commented Oct 11, 2018

@directhex @jaykrell does any of you know something about building with msvc? The code changes look good to me, but I don't know enough about this build stuff.

@jaykrell
Copy link
Contributor

I'd just leave it to Johan, unless you insist that an expert author it, and a second expert review it.

MONO_API is extern "C" and exported from .dll (__declspec(dllexport)), and whatever the wacky ELF stuff.
The exported from .dll business should be a .def file, really, but whatever, mono does it differently.
If you use it, and again I recommend it against it entirely, then use it consistently in .h and .c.
Unix compilers might not care for consistency, but msvc does.

@jaykrell
Copy link
Contributor

Oh maybe it isn't quite that -- maybe msvc wants it on .h at least, can be also on .c.
Unix doesn't care between them -- code used either.
So use .h at least.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer portable Python over any cmd but ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for caps.

@marek-safar
Copy link
Member

@lateralusX is it still do-not-merge ?

@lateralusX lateralusX changed the title WIP: Build BTLS on Windows, Visual Studio. Build BTLS on Windows, Visual Studio. Oct 15, 2018
@lateralusX
Copy link
Member Author

I was waiting for #9306 to merge so I could do some testing with the defaults, but I believe we could merge this first and I can test with default BLTS settings in separate PR.

@lateralusX
Copy link
Member Author

lateralusX commented Oct 15, 2018

Just hold on a little with the merge for now, will get library name change into this PR first as well as rebase locally with the changes merged in #9306.

@lateralusX lateralusX force-pushed the lateralusX/build-btls-msvc branch from 020d01e to 8e58049 Compare October 15, 2018 13:58
@lateralusX lateralusX force-pushed the lateralusX/build-btls-msvc branch from 8e58049 to 360620a Compare October 15, 2018 14:53
@lateralusX lateralusX merged commit b2d0e7e into mono:master Oct 17, 2018
@lateralusX
Copy link
Member Author

Failures are unrelated and happens on other PR's.

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 this pull request may close these issues.

5 participants