X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=SConstruct;h=0a829631c57f6654e46c649a5cfe2c1d1219b2f3;hb=38f5e9d1bee8eb61494a3acbf053a3b6d5c2b779;hp=f2a9b50bd90c03eb3b813601a27f212326a2b0f7;hpb=b5316392791e499dec3a381349c50602ecdbd69c;p=platform%2Fupstream%2Fiotivity.git diff --git a/SConstruct b/SConstruct index f2a9b50..0a82963 100644 --- a/SConstruct +++ b/SConstruct @@ -2,52 +2,43 @@ # The main build script # ## -import os -SRC_TOP_DIR = os.path.abspath('.') + '/' #oic-resource project top directory - -# Common build options +# Load common build config SConscript('build_common/SConscript') -Import('RELEASE_BUILD', 'BUILD_TARGET', 'TARGET_CPU_ARCH') -# Set build directory -if RELEASE_BUILD: - BUILD_DIR = SRC_TOP_DIR + '/out/' + BUILD_TARGET + '/' + TARGET_CPU_ARCH + '/release/' -else: - BUILD_DIR = SRC_TOP_DIR + '/out/' + BUILD_TARGET + '/' + TARGET_CPU_ARCH + '/debug/' -VariantDir(BUILD_DIR, SRC_TOP_DIR, duplicate=0) -Export('SRC_TOP_DIR', 'BUILD_DIR') +Import('env') -if BUILD_TARGET == 'arduino': +target_os = env.get('TARGET_OS') +if target_os == 'arduino': SConscript('arduino.scons') +else: + # Prepare libraries + env.PrepareLib('cereal') + env.PrepareLib('expat') + env.PrepareLib('boost', 'boost_thread', env.get('SRC_DIR') + '/extlibs/boost/') + env.PrepareLib('boost', 'boost_system', env.get('SRC_DIR') + '/extlibs/boost/') + +# By default, src_dir is current dir, the build_dir is: +# ./out//// +# +# The build_dir is a variant directory of the source directory(You can +# consider build_dir as a soft link to src_dir, for detail please refer to: +# http://www.scons.org/doc/production/HTML/scons-user.html#f-VariantDir +# +# Any way, to make the output is in build_dir, when load scripts, the path should +# be relevant to build_dir. +build_dir = env.get('BUILD_DIR') -# Build libcoap -SConscript(BUILD_DIR + 'csdk/libcoap/SConscript') - -# Build liboctbstack -SConscript(BUILD_DIR + 'csdk/SConscript') - -if BUILD_TARGET != 'arduino': - # Build liboc_logger - SConscript(BUILD_DIR + 'oc_logger/SConscript') - - # Build liboc - SConscript(BUILD_DIR + 'src/SConscript') +# Build 'resource' sub-project +SConscript(build_dir + 'resource/SConscript') - # Build examples - SConscript(BUILD_DIR + 'examples/SConscript') +# Build 'service' sub-project +SConscript(build_dir + 'service/SConscript') -# Print targets -Import('env') +# Append targets information to the help information, to see help info, execute command line: +# $ scon [options] -h +env.PrintTargets() -Help(''' -=============================================================================== -Targets:\n ''') -for t in env.get('TS'): - Help(t + ' ') -Help(''' -\nDefault all targets will be built. You can specify the target to build: - - #scons [options] [target] -=============================================================================== -''') \ No newline at end of file +# Print bin upload command line (arduino only) +if target_os == 'arduino': + env.UploadHelp()