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

Cross compile configuration #5

Open
Manu343726 opened this issue Feb 21, 2015 · 4 comments
Open

Cross compile configuration #5

Manu343726 opened this issue Feb 21, 2015 · 4 comments

Comments

@Manu343726
Copy link
Contributor

The current scripts only do the standard calls to b2 and the bootstrapper to get the Boost binaries from the CMake setup being run.

Any thoughts about how this setup should look like?

@pfultz2
Copy link

pfultz2 commented Feb 21, 2015

You can see here how MXE cross compiles boost for windows. It basically creates a user-config.bjam file, like this:

echo 'using gcc : mxe : $(TARGET)-g++ : <rc>$(TARGET)-windres <archiver>$(TARGET)-ar <ranlib>$(TARGET)-ranlib ;' > '$(1)/user-config.jam'

But rather than guess the names from the target, you can get the names from cmake variables: CMAKE_CXX_COMPILER, CMAKE_RC_COMPILER, CMAKE_RANLIB and CMAKE_AR variables.

@Manu343726
Copy link
Contributor Author

Thanks Paul, it's a good reference.

I'm actually guessing the toolset from the CMAKE_CXX_VARIABLE, my problem is more on the way of "How user code should look like?" How the user may expect this to be called/requested?

Maybe:

$ bii cpp:configure -DBII_BOOST_CROSS_COMPILE=ON -DBII_BOOST_TOOLSET=gcc-arm -DBII_BOOST_TARGET_OS=linux

Note the BII_BOOST_TOOLSET variable already exists.

@pfultz2
Copy link

pfultz2 commented Feb 21, 2015

The user shouldn't need to define any extra variables, except maybe one for address-model, but that could probably could be inferred from the compiler name.

-DBII_BOOST_CROSS_COMPILE=ON

Use CMAKE_CROSSCOMPILING variable instead.

-DBII_BOOST_TOOLSET=gcc-arm

Infer from CMAKE_SYSTEM_NAME and CMAKE_CXX_COMPILER.

-DBII_BOOST_TARGET_OS=linux

Infer from CMAKE_SYSTEM_NAME.

Now for some esoteric systems, the user might need to define these variables; they can't be inferred(considering this is open source they can just open a PR for it). However, most likely they will define these extra variables in their cmake toolchain file. So then they can just call:

bii cpp:configure -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw.cmake

Or call:

bii cpp:configure

If they add the toolchain file to their bii settings file.

@Manu343726
Copy link
Contributor Author

I'm missing a +1 button on comments. Thanks for all the info.

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

No branches or pull requests

2 participants