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

Replace build tools #1923

Merged
merged 7 commits into from
Sep 12, 2019
Merged

Conversation

pmconrad
Copy link
Contributor

@pmconrad pmconrad commented Aug 16, 2019

This is an alternative to parts of #1706 - the goal is to facilitate cross-compilation by getting rid of the c++-based build tools cat-parts and embed_genesis.
This PR replaces them with (admittedly somewhat crude) CMake-builtins, instead of the much bigger python scripts in #1706.

Note: the downside is that this PR creates the files during cmake execution, meaning that make won't rebuild if dependencies (i. e. hardfork.d/* or genesis.json) are changed.

@crypto-ape
Copy link
Contributor

Just a little idea to improve developers' experience,

we could warn the developer if he is cross-compiling, that he should consider the GRAPHENE_PREGENERATE_FILES flag.

@pmconrad
Copy link
Contributor Author

CMake will now detect changes in dependencies of generated files, and re-run itself if required.
Removed the c++-based helpers and the GRAPHENE_PREGENERATE_FILES flag since they are no longer needed.

There is one case that is not handled properly, but that wasn't handled properly before either: adding a new hardfork file in libraries/chain/hardfork.d will not be detected.

@crypto-ape
Copy link
Contributor

crypto-ape commented Aug 22, 2019

I have played a little bit with it.

See here: crypto-ape@6b9a6b1

Using @pmconrad 's CMake scripts I was able to generate the required files, but in a way that is compatible with the old build-flow.

  • hardfork.hpp generation is triggered every time the build is run, but the file is rewritten only if there was a change to the hardfork.d directory. This saves compilation time and guarantees that the generated hardfork.hpp is always up to date.

  • embed_genesis is triggered only if required and if the source files were changed.

No other dependencies, only CMake.

What do you think, @pmconrad ?

@pmconrad
Copy link
Contributor Author

Very good. Cherry-picked your changes on top of this branch.

@crypto-ape
Copy link
Contributor

crypto-ape commented Aug 22, 2019

Just tried to compile with MSVC 2015 and it fails.

The line in the generated egenesis_full.cpp is too long.

egenesis_full.cpp(35): error C2026: string too big, trailing characters truncated

According to MSDN "The maximum length of a string literal is 65,535 bytes".

I will try to find a workaround for this.

@pmconrad
Copy link
Contributor Author

pmconrad commented Sep 4, 2019

@crypto-ape modified the script to split genesis into chunks of 10k, can you test?

@crypto-ape
Copy link
Contributor

Tested it successfully on Windows with MSVC and MinGW.

Seems good to me.

@pmconrad
Copy link
Contributor Author

Thanks. @abitmore do you want to test as well?

@abitmore
Copy link
Member

I don't want to test, if not necessary :)

@pmconrad
Copy link
Contributor Author

Can you approve then?

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