Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Multiple include paths for gcc #64

Closed
wants to merge 3 commits into from

2 participants

@saelo

I added support for multiple additional include paths for gcc so I could do
#include <path/from/base/dir>
in my source code files (which I like more than #include "../../../file.h").
Maybe its useful for others, too?

@nailxx
Owner

Since 0.3.6 it can be done with ino build --compile-flags="-I/your/path"

Not sure right now whether separate argument makes sense

@saelo

sure, that works :)

@saelo saelo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 9, 2013
  1. @saelo
Commits on Feb 20, 2013
  1. @saelo
Commits on Sep 9, 2013
  1. @saelo

    Compiling with std=c++11

    saelo authored
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 12 deletions.
  1. +16 −12 ino/commands/build.py
View
28 ino/commands/build.py
@@ -45,11 +45,13 @@ def setup_arg_parser(self, parser):
self.e.add_arduino_dist_arg(parser)
parser.add_argument('-v', '--verbose', default=False, action='store_true',
help='Verbose make output')
+ parser.add_argument('-I', '--include', metavar='DIR', action='append',
+ help='Add directory to search path for headers')
def discover(self):
- self.e.find_arduino_dir('arduino_core_dir',
- ['hardware', 'arduino', 'cores', 'arduino'],
- ['Arduino.h'] if self.e.arduino_lib_version.major else ['WProgram.h'],
+ self.e.find_arduino_dir('arduino_core_dir',
+ ['hardware', 'arduino', 'cores', 'arduino'],
+ ['Arduino.h'] if self.e.arduino_lib_version.major else ['WProgram.h'],
'Arduino core library')
self.e.find_arduino_dir('arduino_libraries_dir', ['libraries'],
@@ -69,10 +71,10 @@ def discover(self):
for tool_key, tool_binary in toolset:
self.e.find_arduino_tool(
- tool_key, ['hardware', 'tools', 'avr', 'bin'],
+ tool_key, ['hardware', 'tools', 'avr', 'bin'],
items=[tool_binary], human_name=tool_binary)
- def setup_flags(self, board_key):
+ def setup_flags(self, board_key, include_path):
board = self.e.board_model(board_key)
mcu = '-mmcu=' + board['build']['mcu']
self.e['cflags'] = SpaceList([
@@ -80,24 +82,26 @@ def setup_flags(self, board_key):
'-ffunction-sections',
'-fdata-sections',
'-g',
- '-Os',
+ '-Os',
'-w',
'-DF_CPU=' + board['build']['f_cpu'],
- '-DARDUINO=' + str(self.e.arduino_lib_version.as_int()),
'-I' + self.e['arduino_core_dir'],
])
+ if include_path:
+ for path in include_path:
+ self.e['cflags'].append('-I ' + path)
if 'vid' in board['build']:
self.e['cflags'].append('-DUSB_VID=%s' % board['build']['vid'])
if 'pid' in board['build']:
self.e['cflags'].append('-DUSB_PID=%s' % board['build']['pid'])
-
+
if self.e.arduino_lib_version.major:
- variant_dir = os.path.join(self.e.arduino_variants_dir,
+ variant_dir = os.path.join(self.e.arduino_variants_dir,
board['build']['variant'])
self.e.cflags.append('-I' + variant_dir)
- self.e['cxxflags'] = SpaceList(['-fno-exceptions'])
+ self.e['cxxflags'] = SpaceList(['-std=c++11', '-fno-exceptions', '-fno-use-cxa-atexit'])
self.e['elfflags'] = SpaceList(['-Os', '-Wl,--gc-sections', mcu])
self.e['names'] = {
@@ -174,7 +178,7 @@ def scan_dependencies(self):
# If lib A depends on lib B it have to appear before B in final
# list so that linker could link all together correctly
# but order of `_scan_dependencies` is not defined, so...
-
+
# 1. Get dependencies of sources in arbitrary order
used_libs = list(self._scan_dependencies(self.e.src_dir, lib_dirs, inc_flags))
@@ -203,7 +207,7 @@ def scan_dependencies(self):
def run(self, args):
self.discover()
- self.setup_flags(args.board_model)
+ self.setup_flags(args.board_model, args.include)
self.create_jinja(verbose=args.verbose)
self.make('Makefile.sketch')
self.scan_dependencies()
Something went wrong with that request. Please try again.