Commit 681a669a authored by Carles Cufi's avatar Carles Cufi
Browse files

More progress towards multiarch

parent 3362796e
......@@ -50,6 +50,12 @@ to find the version of the MSVC that you need to provide using the `toolset=` op
**Note**: Select 32 or 64-bit with the `address-model=` option.
#### Examples
Build 32-bit Boost with Visual Studio 15
> b2 toolset=msvc-14.0 address-model=32 link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
Build 64-bit Boost with Visual Studio 15
> b2 toolset=msvc-14.0 address-model=64 link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
### Ubuntu Linux
......@@ -57,6 +63,10 @@ Install the required packages to build Boost:
sudo apt-get install git make gcc g++
Additionally if you want to build non-native binaries (for example 32-bit binaries on a 64-bit Ubuntu installation):
sudo apt-get install gcc-multilib
Open a terminal window and issue the following commands:
$ cd $BOOST_ROOT
......
......@@ -13,3 +13,9 @@ add_compile_options(
-std=c++11
-Wlogical-op
)
if(NOT ${ARCH} STREQUAL not_set)
add_compile_options(
-m${ARCH_BITS}
)
endif()
message(STATUS "WIN32 build.")
add_definitions(
-D_WIN32_WINNT=0x0502
-DNOMINMAX
......
......@@ -4,15 +4,30 @@ if(PC_BLE_DRIVER_CMAKE_INCLUDED)
endif(PC_BLE_DRIVER_CMAKE_INCLUDED)
set(PC_BLE_DRIVER_CMAKE_INCLUDED true)
math(EXPR ARCH_BITS "8*${CMAKE_SIZEOF_VOID_P}")
math(EXPR COMPILER_ARCH_BITS "8*${CMAKE_SIZEOF_VOID_P}")
# Default to compiler architecture
set(ARCH_BITS ${COMPILER_ARCH_BITS})
SET(ARCH not_set CACHE STRING "Architecture (x86_32 or x86_64)")
string(TOLOWER "${ARCH}" ARCH)
if(${ARCH} STREQUAL not_set)
message(STATUS "Architecture not set, using native ${ARCH_BITS}-bit toolchain.")
else()
if(MSVC)
message(FATAL_ERROR "ARCH not available with MSVC. Use -G \"Visual Studio XX <Win64>\" instead.")
endif()
if(${ARCH} STREQUAL x86_32)
set(ARCH_BITS 32)
elseif(${ARCH} STREQUAL x86_64)
set(ARCH_BITS 64)
else()
message(FATAL_ERROR "Invalid architecture: ARCH=${ARCH}.")
endif()
message(STATUS "Building ${ARCH_BITS}-bit targets with ${COMPILER_ARCH_BITS}-bit toolchain.")
endif()
#set(CMAKE_EXE_LINKER_FLAGS "/machine:x64")
#set(CMAKE_EXE_LINKER_FLAGS "/machine:x86")
#set(CMAKE_EXE_LINKER_FLAGS "-m32")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment