Skip to content

Commit

Permalink
compilation with the new waf
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmouret committed Apr 15, 2016
1 parent 0628524 commit cb0efe3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 65 deletions.
3 changes: 2 additions & 1 deletion display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <bitset>

#ifdef USE_SDL

namespace fastsim {

void Display :: _events() {
Expand Down Expand Up @@ -485,4 +484,6 @@ namespace fastsim {

}

#else
#warning "SDL is disabled (no display for fastim)""
#endif
4 changes: 4 additions & 0 deletions fastsim_keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct Params {
};
};

#ifdef USE_SDL


int main(int argc, char *argv[]) {
Expand Down Expand Up @@ -52,3 +53,6 @@ int main(int argc, char *argv[]) {

return 0;
}
#else
# warning FASTSIM_KEYBOARD not compiled because SDL was not activated
#endif
13 changes: 5 additions & 8 deletions test_fastsim.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

#ifndef APPLE
#ifndef __APPLE__
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE fastsim



#include <boost/test/unit_test.hpp>
#endif

Expand All @@ -21,7 +17,7 @@ struct Params {
};
};


#ifndef __APPLE__
BOOST_AUTO_TEST_CASE(fastsim_intersection) {
using namespace fastsim;
typedef simu::Fastsim<Params> simu_t;
Expand Down Expand Up @@ -53,8 +49,9 @@ BOOST_AUTO_TEST_CASE(fastsim_intersection) {
// s.refresh_view();
// }
}
#endif

#ifdef APPLE
#ifdef __APPLE__
int main(int argc, char *argv[]) {
std::cout<<"WARNING: BOOST TEST framework desactivated on macos to avoid problems with SDL."<<std::endl;
#else
Expand Down Expand Up @@ -103,7 +100,7 @@ BOOST_AUTO_TEST_CASE(fastsim_simu_refresh) {
s.refresh();
s.refresh_view();
}
#ifdef APPLE
#ifdef __APPLE__
return 0;
#endif
}
88 changes: 32 additions & 56 deletions wscript
Original file line number Diff line number Diff line change
@@ -1,59 +1,35 @@
#! /usr/bin/env python
import Options;
import commands

def set_options(opt) : pass

# def detect_sdl(conf):
# env = conf.env
# opt = Options.options
# ret = conf.find_program('sdl-config')
# conf.check_message_1('Checking for SDL (optional)')
# if not ret:
# conf.check_message_2('not found', 'YELLOW')
# return 0
# conf.check_message_2('ok')
# res = commands.getoutput('sdl-config --cflags --libs')
# config_c.parse_flags(res, 'SDL', env)
# return 1

# def detect(conf):
# return detect_sdl(conf)

def configure(conf) : pass
# conf.env['CPPPATH_SDL'] = commands.getoutput('sdl-config --cflags')
# conf.env['LIBPATH_SDL'] = commands.getoutput('sdl-config --libs')


from waflib.Configure import conf

@conf
def configure(conf) :
print 'configuring'
sdl = conf.check_cfg(package='sdl',
args='--cflags --libs',
msg="Checking for SDL (optional)",
uselib_store='SDL',
mandatory=False)
if sdl:
conf.env['CXXFLAGS'] += ['-DUSE_SDL']

def build(bld):
uselib_ = 'BOOST'
model = bld.new_task_gen('cxx', 'staticlib')
model.source = 'display.cpp laser.cpp main.cpp map.cpp radar.cpp light_sensor.cpp robot.cpp linear_camera.cpp'
model.includes = '. ../../'
model.target = 'fastsim'
model.uselib = 'SDL BOOST'

test_fastsim = bld.new_task_gen('cxx', 'program')
test_fastsim.source = 'test_fastsim.cpp'
test_fastsim.includes = '. ../../'
test_fastsim.uselib_local = 'sferes2 fastsim'
if Options.options.apple:
test_fastsim.uselib = 'SDL'
else:
test_fastsim.uselib = 'BOOST_UNIT_TEST_FRAMEWORK SDL'
test_fastsim.unit_test = 1

test_fastsim.target = 'test_fastsim'


fastsim_keyboard = bld.new_task_gen('cxx', 'program')
fastsim_keyboard.source = 'fastsim_keyboard.cpp'
fastsim_keyboard.includes = '. ../../'
fastsim_keyboard.uselib_local = 'sferes2 fastsim'
fastsim_keyboard.uselib = 'SDL'
fastsim_keyboard.target = 'fastsim_keyboard'




bld.stlib('cxx', 'staticlib',
source = 'display.cpp laser.cpp main.cpp map.cpp radar.cpp light_sensor.cpp robot.cpp linear_camera.cpp',
includes = '. ../../',
target = 'fastsim',
uselib = 'SDL BOOST')

bld.program('cxx', 'program',
source = 'test_fastsim.cpp',
includes = '. ../../',
use = 'sferes2 fastsim',
uselib = 'BOOST_UNIT_TEST_FRAMEWORK SDL',
target = 'test_fastsim')


bld.program('cxx', 'program',
source = 'fastsim_keyboard.cpp',
includes = '. ../../',
use = 'sferes2 fastsim',
uselib = 'SDL',
target = 'fastsim_keyboard')

0 comments on commit cb0efe3

Please sign in to comment.