Open Manu343726 opened 9 years ago
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.
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.
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.
I'm missing a +1 button on comments. Thanks for all the info.
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?