Compile Boost 1.47 for Windows CE

随声附和 提交于 2019-12-03 10:37:23

You don't actually have to use boost build to build boost. I built part of boost using an SCons script for a project where I needed more control over the build options. It worked quite well. It went something like this:

import os

env = Environment()

boost_source = os.environ.get('BOOST_SOURCE', None)
if not boost_source:
    raise Exception, 'BOOST_SOURCE not set'

env.Append(CPPPATH = [boost_source])

if env['PLATFORM'] == 'win32':
    env.Append(CPPDEFINES = ['BOOST_ALL_NO_LIB'])


VariantDir('build', boost_source + '/libs')

import glob
import re

for lib in ['iostreams', 'filesystem', 'system', 'regex', 'thread',
            'serialization']:
    src = []
    path = boost_source + '/libs/%s/src' % lib

    if lib == 'thread':
        if env['PLATFORM'] == 'win32':
            src.append(path + '/tss_null.cpp')
            path += '/win32'
            env.Append(CPPDEFINES = ['BOOST_HAS_WINTHREADS',
                                     'BOOST_THREAD_BUILD_LIB'])
        else: path += '/pthread'

    src += glob.glob(path + '/*.cpp')

    src = map(lambda x: re.sub(re.escape(boost_source + '/libs'), 'build', x),
              src)

    libname = 'boost_%s' % lib
    if env['PLATFORM'] == 'win32': libname = 'lib' + libname
    lib = env.Library('lib/' + libname, src)

Clean(lib, 'build')
Clean(lib, 'lib')

This SCons script just searches for the source files in the listed boost modules and compiles with the default compiler. I pass in the path to the boost source directory via the BOOST_SOURCE environment variable.

This could work for Windows CE as it would give you more control over the build process. You could also do something similar with make or nmake.

The moral of the story is that building boost with out using bjam/BoostBuild is not that hard.

This is the sort of error you would see if the msvc tool-set configuration has an incorrect path to where the tool-set is installed. I've seen such errors on 64-bit windows machines, where tools assume the compiler is installed in "C:\Program Files" but it is actually in "C:\Program Files (x86)"

Check the tool-set configuration and make sure it matches the location of where the SDK is installed.

I've compile with success Boost.Thread, Boost.Regex, Boost.System, Boost.Chrono and Boost.Atomic for Windows CE 6.0 on an x86 Platform.

The major work was to make WinCE more ANSI C compiliant. I've changed a bit STLPort and integrated with missing C function. Then I built boost with STLPort.

Look at the following link the I posted:

http://stackoverflow.com/questions/15906901/build-boost-c-wince

http://stackoverflow.com/questions/16016637/boost-c-and-windows-ce-6-0

http://stackoverflow.com/questions/15959877/windows-ce-6-0-and-runtime-link-to-debug-dll-mdd

http://stackoverflow.com/questions/11079337/wince-5-0-using-stlport-void-operator-newsize-t-void-already-has-a-body/15814730#15814730

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!