Skip to content

feat(build.bat): customize PLATFORM_TOOLSET settings#112

Closed
lotem wants to merge 12 commits into
masterfrom
build
Closed

feat(build.bat): customize PLATFORM_TOOLSET settings#112
lotem wants to merge 12 commits into
masterfrom
build

Conversation

@lotem
Copy link
Copy Markdown
Member

@lotem lotem commented Feb 20, 2018

Similar to rime/librime#178

Changes:

  • introduces PLATFORM_TOOLSET variable (defaults to v140_xp)
  • renames BOOST_HOME to BOOST_ROOT (to be consistent with librime/build.bat)

Copy link
Copy Markdown
Contributor

@Prcuvu Prcuvu left a comment

Choose a reason for hiding this comment

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

Setting platform toolset to environmental variable seems erroneous, both on AppVeyor and my local build environment. CMake may be a better solution.

@lotem
Copy link
Copy Markdown
Member Author

lotem commented Feb 21, 2018

The check failed because I did not set the environment variable PLATFORM_TOOLSET in appveyor.yml. When I did to my local build, it worked.

The same environment variable also worked for several projects in librime/thirdparty/src/ with this change rime/librime#178 . No *.props file was needed to introduce the variable to project files.

However, I did not expect user to set the environment variable, but to define the macro in weasel.props.
Somehow the default value set in weasel[-appveyor].props did not take effect.
Similarly, I expect BOOST_ROOT to be set in weasel.props in most cases, and set the environment variable only as a convenient way to override the default value.

Copy link
Copy Markdown
Member

@nameoverflow nameoverflow left a comment

Choose a reason for hiding this comment

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

So add PLATFORM_TOOLSET in appveyor.yml to pass CI check? Will it work if create a weasel.props in appveyor.install.bat ?

@Prcuvu
Copy link
Copy Markdown
Contributor

Prcuvu commented Feb 21, 2018

It turns out that weasel.props must be imported before using any of its macros.

Copy link
Copy Markdown
Contributor

@Prcuvu Prcuvu left a comment

Choose a reason for hiding this comment

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

Looks good now.

Comment thread build.bat Outdated
set boost_libs=--with-date_time --with-filesystem --with-locale --with-regex --with-signals --with-system --with-thread
cd %BOOST_ROOT%

set boost_build_flags=toolset=msvc-%VisualStudioVersion%^
Copy link
Copy Markdown
Member Author

@lotem lotem Feb 21, 2018

Choose a reason for hiding this comment

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

Should not use %VisualStudioVersion% here.
The number is platform toolset, not Visual Studio version.
For example msvc-14.1 for Visual Studio 15 2017.

https://stackoverflow.com/questions/42730478/version-numbers-for-visual-studio-2017-boost-and-cmake/42738533#42738533

@lotem
Copy link
Copy Markdown
Member Author

lotem commented Feb 21, 2018

Well, it's more complicated than what I thought.
It's great the properties file works as expected now with @Prcuvu's fix.
We might also need to set environment variables since
build.bat boost requires BOOST_ROOT and BJAM_TOOLSET set in CMD.
User have to set the environment variables manually at first run. Maybe it's a good idea to generate weasel.props to avoid typing those values twice.
It'll be nice not having to set environment variables afterwards, working in Visual Studio without command line.

@Prcuvu
Copy link
Copy Markdown
Contributor

Prcuvu commented Feb 21, 2018

Typing toolset version in both build script and property sheet is inevitable since we do not build boost in Visual Studio IDE. It is a one-time job after all.

Copy link
Copy Markdown
Member

@nameoverflow nameoverflow left a comment

Choose a reason for hiding this comment

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

LGTM.

@lotem
Copy link
Copy Markdown
Member Author

lotem commented Feb 21, 2018

Wait... I have more code to commit.

I would like to revert a part of ebf8575
Sorry.

I think it's not correct to auto-detect BJAM_TOOLSET based on VisualStudioVersion. It's ugly and vulnerable to rewrite the version number to platform toolset number. Eventually we have to maintain a mapping table of versions in the script. No.
Just set a default value and let user override it with an environment variable if they wish.

I'm working on converting .template->.vsprops. With that user only have to set environment variable once.

@Prcuvu
Copy link
Copy Markdown
Contributor

Prcuvu commented Feb 21, 2018

@lotem I would like to leave the job to users. If you come up with some better approach, force update is welcome.

@lotem
Copy link
Copy Markdown
Member Author

lotem commented Feb 22, 2018

Can we sync submodule librime to tag rime-1.2.10 ?
With latest librime, environment settings in weasel\env.bat works for both weasel\build.bat and librime\build.bat.

@Prcuvu
Copy link
Copy Markdown
Contributor

Prcuvu commented Feb 22, 2018

Currently AppVeyor CI downloads librime's CI artifact of latest commit, which is ugly and problematic.
I'm planning to build librime in weasel's CI install stage and cache built binaries.

@lotem
Copy link
Copy Markdown
Member Author

lotem commented Feb 22, 2018

@Prcuvu

is ugly and problematic

Why do you think it's ugly? Can you share more details on encountered problems with this approach?

To the contrary, I'm thinking about splitting librime into smaller projects to save CI build time by reusing artifacts from dependency projects.

build librime in weasel's CI install stage and cache built binaries.

This isn't trivial. Each build has to be tagged with librime version (commit hash) and compared to the librime version referenced in current build.

Are the binaries shared among build machines?

@Prcuvu
Copy link
Copy Markdown
Contributor

Prcuvu commented Feb 22, 2018

  • I say it's ugly because I have to modify appveyor.install.bat and add new artifact download URL every time I upgrade submodule version. Modification of appveyor.install.bat also triggers boost rebuild.
  • If we always download artifact from latest commit, it will break weasel if librime of that commit happens to have a bug.

I would like to add a librime build cache, whose dependency tracks submodule change (if possible), into appveyor.yml.

@Prcuvu
Copy link
Copy Markdown
Contributor

Prcuvu commented Feb 24, 2018

Well, reusing artifacts is a more economic approach. I will just specify artifact URL every time librime changes.

Feel free to merge when you think it is ready.

@lotem
Copy link
Copy Markdown
Member Author

lotem commented Feb 24, 2018

There is one more thing:
librime/build/include is missing in local build, and causes weasel/build.bat to fail.
Though the appveyor script handles this, it's still broken for user.
For that I'll update submodule librime to include this change
rime/librime@06c9e86
(Testing...)

@lotem lotem closed this Feb 25, 2018
@lotem lotem deleted the build branch February 25, 2018 15:39
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.

3 participants