Skip to content

Commit 190921c

Browse files
author
psoetens
committed
Merge patch #355 from bug #533: Mac OS X port.
Seems to work. Well done. git-svn-id: https://svn.mech.kuleuven.be/repos/orocos/trunk/rtt@29594 ce417995-dfc9-0310-95a0-acdaff106893
1 parent 27761c0 commit 190921c

12 files changed

+85
-101
lines changed

config/CheckIncludeFileCXX.cmake

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +0,0 @@
1-
2-
3-
#### MODIFIED VERSION FOR OROCOS ####
4-
5-
# - Check if the include file exists.
6-
# CHECK_INCLUDE_FILE_CXX(INCLUDE VARIABLE)
7-
#
8-
# INCLUDE - name of include file
9-
# VARIABLE - variable to return result
10-
#
11-
# An optional third argument is the CFlags to add to the compile line
12-
# or you can use CMAKE_REQUIRED_FLAGS.
13-
#
14-
# The following variables may be set before calling this macro to
15-
# modify the way the check is run:
16-
#
17-
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
18-
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
19-
# CMAKE_REQUIRED_INCLUDES = list of include directories
20-
#
21-
MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
22-
IF( "${${VARIABLE}}" MATCHES "^$")
23-
IF(CMAKE_REQUIRED_INCLUDES)
24-
SET(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
25-
ELSE(CMAKE_REQUIRED_INCLUDES)
26-
SET(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS)
27-
ENDIF(CMAKE_REQUIRED_INCLUDES)
28-
SET(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS})
29-
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
30-
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
31-
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
32-
MESSAGE(STATUS "Looking for C++ include ${INCLUDE}")
33-
IF(${ARGC} EQUAL 3)
34-
SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
35-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
36-
ENDIF(${ARGC} EQUAL 3)
37-
38-
TRY_COMPILE(${VARIABLE}
39-
${CMAKE_BINARY_DIR}
40-
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
41-
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
42-
CMAKE_FLAGS
43-
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
44-
"${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}"
45-
OUTPUT_VARIABLE OUTPUT)
46-
47-
IF(${ARGC} EQUAL 3)
48-
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE})
49-
ENDIF(${ARGC} EQUAL 3)
50-
51-
IF(${VARIABLE})
52-
MESSAGE(STATUS "Looking for C++ include ${INCLUDE} - found")
53-
SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
54-
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
55-
"Determining if the include file ${INCLUDE} "
56-
"exists passed with the following output:\n"
57-
"${OUTPUT}\n\n")
58-
ELSE(${VARIABLE})
59-
MESSAGE(STATUS "Looking for C++ include ${INCLUDE} - not found")
60-
SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
61-
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
62-
"Determining if the include file ${INCLUDE} "
63-
"exists failed with the following output:\n"
64-
"${OUTPUT}\n\n")
65-
ENDIF(${VARIABLE})
66-
ENDIF( "${${VARIABLE}}" MATCHES "^$")
67-
ENDMACRO(CHECK_INCLUDE_FILE_CXX)

config/check_depend.cmake

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,15 @@
44
# #
55
###########################################################
66

7-
# The cmake version is f*cked up, i.e. the spirit of cmake.
8-
INCLUDE( config/CheckIncludeFileCXX.cmake )
9-
107
# Look for boost
118
IF (NOT CMAKE_CROSS_COMPILE)
12-
13-
SET(BOOST_INSTALL "" CACHE STRING "Specify the location (e.g. /opt/include) in which the Boost/C++ headers have been installed.")
14-
15-
# This is the Orocos version of the macro:
16-
IF( BOOST_INSTALL )
17-
MESSAGE("-- Looking for Boost/C++ headers in ${BOOST_INSTALL}")
18-
SET(CMAKE_REQUIRED_INCLUDES ${BOOST_INSTALL})
19-
SET( RTT_CFLAGS "${RTT_CFLAGS} -I${BOOST_INSTALL}" )
20-
ENDIF( BOOST_INSTALL )
21-
CHECK_INCLUDE_FILE_CXX( boost/shared_ptr.hpp BOOST)
22-
CHECK_INCLUDE_FILE_CXX( boost/spirit.hpp BOOST_SPIRIT)
23-
CHECK_INCLUDE_FILE_CXX( boost/graph/adjacency_list.hpp BOOST_GRAPH)
9+
MESSAGE("-- Looking for Boost/C++ headers --")
10+
FIND_PATH( BOOST boost/shared_ptr.hpp )
11+
FIND_PATH( BOOST_SPIRIT boost/spirit.hpp )
12+
FIND_PATH( BOOST_GRAPH boost/graph/adjacency_list.hpp )
2413
IF(BOOST AND BOOST_GRAPH AND BOOST_SPIRIT)
2514
MESSAGE("-- Looking for Boost headers - found")
15+
SET( RTT_CFLAGS "${RTT_CFLAGS} -I${BOOST}" )
2616
SET(ORO_SUPPORT_BOOST TRUE CACHE INTERNAL "" FORCE)
2717
ELSE(BOOST AND BOOST_GRAPH AND BOOST_SPIRIT)
2818
MESSAGE("-- Looking for Boost headers - not found")
@@ -35,11 +25,9 @@ ENDIF (NOT CMAKE_CROSS_COMPILE)
3525
IF (NOT CMAKE_CROSS_COMPILE )
3626
FIND_LIBRARY(XERCES NAMES xerces-c
3727
PATHS /usr/local/lib /usr/lib )
38-
CHECK_INCLUDE_FILE_CXX( xercesc/util/PlatformUtils.hpp XERCES_HEADERS)
28+
FIND_PATH( XERCES_HEADERS xercesc/util/PlatformUtils.hpp)
3929
ELSE (NOT CMAKE_CROSS_COMPILE )
40-
FIND_LIBRARY(XERCES NAMES xerces-c
41-
NO_DEFAULT_PATH
42-
)
30+
FIND_LIBRARY(XERCES NAMES xerces-c NO_DEFAULT_PATH )
4331
ENDIF (NOT CMAKE_CROSS_COMPILE )
4432
IF ( XERCES AND XERCES_HEADERS)
4533
MESSAGE("-- Looking for Xerces - found")
@@ -62,7 +50,7 @@ ELSE ( XERCES AND XERCES_HEADERS )
6250
SET(OROCLS_CORELIB_PROPERTIES_DEMARSHALLING_DRIVER "TinyDemarshaller")
6351
ENDIF ( XERCES AND XERCES_HEADERS )
6452

65-
SET( OROCOS_TARGET gnulinux CACHE STRING "The Operating System target. One of [lxrt gnulinux xenomai]")
53+
SET( OROCOS_TARGET gnulinux CACHE STRING "The Operating System target. One of [lxrt gnulinux xenomai macosx]")
6654
STRING(TOUPPER ${OROCOS_TARGET} OROCOS_TARGET_CAP)
6755

6856
SET(LINUX_SOURCE_DIR ${LINUX_SOURCE_DIR} CACHE PATH "path to linux source dir" FORCE)
@@ -145,6 +133,15 @@ ELSE(OROCOS_TARGET STREQUAL "gnulinux")
145133
SET(OROPKG_OS_GNULINUX FALSE CACHE INTERNAL "" FORCE)
146134
ENDIF(OROCOS_TARGET STREQUAL "gnulinux")
147135

136+
IF(OROCOS_TARGET STREQUAL "macosx")
137+
SET(OROPKG_OS_MACOSX TRUE CACHE INTERNAL "" FORCE)
138+
SET(RTT_LINKFLAGS "${RTT_LINKFLAGS} -lpthread" CACHE INTERNAL "")
139+
LINK_LIBRARIES(pthread dl)
140+
ELSE(OROCOS_TARGET STREQUAL "macosx")
141+
SET(OROPKG_OS_MACOSX FALSE CACHE INTERNAL "" FORCE)
142+
ENDIF(OROCOS_TARGET STREQUAL "macosx")
143+
144+
148145
IF(OROCOS_TARGET STREQUAL "ecos")
149146

150147
# Look for Ecos

config/global_setup.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ OPTION( ENABLE_TESTS "Turn me off to disable compilation of all tests" ON )
6363
IF( ENABLE_TESTS )
6464
IF (NOT CMAKE_CROSS_COMPILE )
6565
FIND_LIBRARY(CPPUNIT NAMES cppunit PATHS /usr/local/lib /usr/lib )
66-
CHECK_INCLUDE_FILE_CXX( cppunit/TestRunner.h CPPUNIT_HEADERS)
66+
FIND_PATH( CPPUNIT_HEADERS cppunit/TestRunner.h)
6767
ELSE (NOT CMAKE_CROSS_COMPILE )
6868
FIND_LIBRARY(CPPUNIT NAMES cppunit NO_DEFAULT_PATH )
6969
ENDIF (NOT CMAKE_CROSS_COMPILE )

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
echo "Orocos configure script."
3+
echo "Orocos configure script. WARNING: ONLY WORKS FOR GNULINUX INSTALLATIONS"
44

55
function usage
66
{

doc/xml/orocos-installation.xml

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
<revremark>Improved/fixed Debian/Ubuntu package install instructions.</revremark>
7676
</revision>
7777
</revhistory>
78+
<revnumber>1.5.0</revnumber>
79+
<date>02 Aug 2008</date>
80+
<authorinitials>kg</authorinitials>
81+
<revremark>Added Mac OS X install instructions.</revremark>
82+
</revision>
83+
</revhistory>
7884

7985
<legalnotice>
8086
<para>
@@ -104,10 +110,12 @@
104110
&orocos; was designed with portability in mind. Currently, we support RTAI/LXRT
105111
(<ulink url="http://www.rtai.org">http://www.rtai.org</ulink>), GNU/Linux
106112
userspace, Xenomai (<ulink
107-
url="http://www.xenomai.org">Xenomai.org</ulink>). So,
108-
you can first write your software as a normal Linux program, using the framework
109-
for testing and debugging purposes in plain userspace Linux and recompile
110-
later to another real-time target.
113+
url="http://www.xenomai.org">Xenomai.org</ulink>) and Mac OS X (<ulink
114+
url="http://www.apple.com/macosx/">apple.com</ulink>). So,
115+
you can first write your software as a normal Linux/Mac OS X
116+
program, using the framework for testing and debugging
117+
purposes in plain userspace (Linux/Mac OS X) and recompile
118+
later to a real-time target.
111119
</para>
112120
</section>
113121
<section id="vers-scheme">
@@ -186,7 +194,10 @@
186194
</tgroup>
187195
</table>
188196
<para>
189-
All these packages are provided by most Linux distributions.
197+
All these packages are provided by most Linux distributions. In Mac OS X,
198+
you can install them easily using <ulink
199+
url="http://www.finkproject.org">fink</ulink> or <ulink
200+
url="http://www.macports.org/">macports</a>.
190201
Take also a look on the Orocos.org <ulink
191202
url="http://www.orocos.org/rtt/source">RTT download</ulink> page
192203
for the latest information.
@@ -266,22 +277,33 @@
266277
<title>Orocos Build and Configuration Tools </title>
267278
<para>
268279
The tool you will need is <command>cmake</command>
280+
Most linux distros have a cmake package, and so do fink/macports in OS X.
269281
In Debian, you can use the official Debian version using
270282
<screen> apt-get install cmake</screen>
271283
If this does not work for you, you can download cmake from
272284
the CMake homepage.
273285
</para>
274286
</section>
275287
<section>
276-
<title>Quick Installation Instructions</title>
277-
<para>
288+
<para>
289+
<title>Download and extract the RTT packages</title>
278290
Download the <filename>orocos-rtt-&oversion;-src.tar.bz2</filename> package from the
279291
Orocos webpage.
280292
</para>
281293
<para>
282294
Extract it using :
283295
<screen><command> tar -xvjf orocos-rtt-&oversion;-src.tar.bz2</command></screen>
284-
Then proceed as in:
296+
</para>
297+
<para>
298+
The next section provides quick installation instructions if you
299+
want to install the RTT on GNU/Linux. Please check out
300+
section FIXME for installation on other OSes and/or if you
301+
want to change the default configuration settings.
302+
</para>
303+
</section>
304+
<section>
305+
<title>Quick Installation Instructions for GNU/Linux</title>
306+
<para>
285307
<screen><command>
286308
mkdir orocos-rtt-&oversion;/build
287309
cd orocos-rtt-&oversion;/build
@@ -317,11 +339,14 @@
317339
<section>
318340
<title>Real-Time Toolkit Configuration</title>
319341
<para>
320-
The RTT can be configured depending on you target.
342+
The RTT can be configured depending on your target.
321343
For embedded targets, the large scripting infrastructure and
322344
use of exceptions can be left out. When CORBA is available,
323345
an additional library is built which allows components to
324346
communicate over a network.
347+
348+
Also, when building for another OS than GNU/Linux, you will have to
349+
build the RTT using cmake.
325350
</para>
326351
<para>
327352
In order to configure the RTT in detail, you
@@ -425,6 +450,21 @@
425450
</section>
426451
<section id="install-configure">
427452
<title>Detailed Configuration using 'CMake'</title>
453+
<para>
454+
If you have some of the orocos dependencies installed in
455+
non-standard locations, you have to specify
456+
this using cmake variables <emphasis>before</emphasis> running
457+
the cmake configuration. Specify header locations using
458+
the <option>CMAKE_INCLUDE_PATH</option> variable (e.g. using
459+
bash and fink in Mac OS X, the boost library headers are
460+
installed in /sw/include, so you would specify <screen>export
461+
CMAKE_INCLUDE_PATH=/sw/include</screen>.
462+
For libraries in none default locations, use
463+
the <option>CMAKE_LIBRARY_PATH</option> variable. For more
464+
information,
465+
see <ulink url="http://www.cmake.org/Wiki/CMake_Useful_Variables#Environment_Variables">cmake
466+
useful variables</ulink> link.
467+
</para>
428468
<para>
429469
In order to start cmake configuration, in your build
430470
directory, run <command>ccmake ..</command> . Press 'c' (from
@@ -441,6 +481,7 @@
441481
on of the following supported targets (all in lowercase):
442482
<itemizedlist>
443483
<listitem><para>gnulinux</para></listitem>
484+
<listitem><para>macosx</para></listitem>
444485
<listitem><para>xenomai</para></listitem>
445486
<listitem><para>lxrt</para></listitem>
446487
</itemizedlist>

src/BufferPolicy.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ namespace RTT
7575
count.wait();
7676
}
7777
}
78+
#ifndef OROPKG_OS_MACOSX
7879
void reset( int c ) {
7980
while( c > count.value() )
8081
count.signal();
8182
while( c < count.value() )
8283
count.wait();
8384
}
85+
#endif
8486
private:
8587
OS::Semaphore count;
8688
};

src/os/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ADD_SUBDIRECTORY( gnulinux )
99
ADD_SUBDIRECTORY( lxrt )
1010
ADD_SUBDIRECTORY( xenomai )
1111
ADD_SUBDIRECTORY( ecos )
12+
ADD_SUBDIRECTORY( macosx )
1213

1314
# Supported Hardware
1415
ADD_SUBDIRECTORY( oro_i386 )

src/os/Semaphore.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ namespace RTT
141141
/**
142142
* Return the current count of this semaphore.
143143
*/
144+
#ifndef OROPKG_OS_MACOSX
144145
int value()
145146
{
146147
return rtos_sem_value( &sem );
147148
}
149+
#endif
148150
};
149151
}}
150152

src/os/SingleThread.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,10 @@ namespace RTT
280280
{
281281
// just signal if already active.
282282
if ( isActive() ) {
283+
#ifndef OROPKG_OS_MACOSX
283284
if ( rtos_sem_value(&sem) > 0 )
284285
return false;
286+
#endif
285287
rtos_sem_signal(&sem);
286288
return true;
287289
}

src/os/fosi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@
5454
#ifdef OROPKG_OS_ECOS
5555
#include "ecos/fosi.h"
5656
#endif
57+
58+
#ifdef OROPKG_OS_MACOSX
59+
#include "macosx/fosi.h"
60+
#endif

0 commit comments

Comments
 (0)