Permalink
Browse files

improved the CMake build scripts to the point where the autotools stu…

…ff is now retired and will be removed
  • Loading branch information...
1 parent 015f747 commit 3d4fd9e9a5596d4826bfab67bfe44047a26ca493 rtv committed Jun 5, 2008
Showing with 88 additions and 37 deletions.
  1. +35 −10 CMakeLists.txt
  2. +30 −10 README.cmake
  3. +14 −8 libstage/CMakeLists.txt
  4. +3 −3 libstage/main.cc
  5. +6 −6 libstageplugin/p_driver.cc
View
45 CMakeLists.txt
@@ -1,26 +1,51 @@
PROJECT(Stage)
-SET (STAGE_VERSION 3.0.0 CACHE STRING "Stage distribution version")
-SET (STAGE_API_VERSION 3.0.0 CACHE STRING "Stage API version")
-MESSAGE (STATUS "${PROJECT_NAME} version ${STAGE_VERSION}")
+SET( V_MAJOR 3 )
+SET( V_MINOR 0 )
+SET( V_BUGFIX 0 )
+
+SET( VERSION ${V_MAJOR}.${V_MINOR}.${V_BUGFIX} )
+
+MESSAGE (STATUS "${PROJECT_NAME} version ${VERSION}")
+
+# define some preprocessor strings that the code is expecting
+ADD_DEFINITIONS( -DPROJECT='"'${PROJECT_NAME}'"'
+ -DVERSION='"'${VERSION}'"' )
include(FindPkgConfig)
pkg_check_modules( GLIB glib-2.0 )
-
+pkg_check_modules( PLAYER playercore )
find_package(OPENGL REQUIRED)
-if(APPLE)
- set(FLTK_INCLUDE_DIR /opt/local/include) # MacPorts' install path
-endif(APPLE)
+# include(FindFLTK) doesn't seem to work for me, so we work a bit harder
+set(FLTK_INCLUDE_DIR CMAKE_INCLUDE_PATH )
find_package(FLTK REQUIRED)
-include_directories( .
+# all targets need these include directories
+include_directories( .
+ libstage
replace
- libstage
${GLIB_INCLUDE_DIRS}
${FLTK_INCLUDE_DIR}
- ${OPENGL_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_DIR}
+)
+
+
+# all targets need these library directories
+link_directories(${GLIB_LIBRARY_DIRS}
+ ${FLTK_LIBRARY_DIRS}
+ ${OPENGL_LIBRARY_DIRS}
)
+# generate a configuration header file in this dir
+# CONFIGURE_FILE( config.h.cmake config.h )
+
+# work through these subdirs
ADD_SUBDIRECTORY(libstage)
ADD_SUBDIRECTORY(examples)
+
+IF( PLAYER_FOUND )
+MESSAGE( "Found Player in ${PLAYER_INCLUDE_DIRS}")
+ADD_SUBDIRECTORY(libstageplugin)
+ENDIF( PLAYER_FOUND )
+
View
40 README.cmake
@@ -1,6 +1,6 @@
-Stage build using CMake instructions
-author: Richard Vaughan, 2008.4.11 $Id$
+Stage v.3 build using CMake instructions
+Author: Richard Vaughan, 2008.4.11 $Id$
* Purpose *
@@ -15,11 +15,31 @@ which will help Stage become more portable.
Unpack the distribution or check it out from SVN. Change directory to
the top level of the Stage source tree.
-First, decide where you want to install Stage. The default
-installation directory varies by system, but is often /usr/local on
-Unix variants. This is easy and is often a good choice, but has the
-disadvantage that installation needs root/sudo priviliges. To install
-in the default location, do:
+First, you may need to help CMake find your the libraries on which
+Stage depends. For example, if you use MacPorts on OS X, packages are
+usually installed in /opt/local, which is not in CMake's default
+system search path. Add your non-standard software directories to
+CMake's search paths by setting environment variables, e.g. in bash:
+
+export CMAKE_INCLUDE_PATH=/opt/local/include
+export CMAKE_LIBRARY_PATH=/opt/local/lib
+
+If you want to use Player with Stage, install Player first, then make
+sure that pkg-config can find it. Test it like so:
+
+pkg-config --modversion playercore
+
+This should output the version number of the Player installation
+(probably 2.2.0 or later). If not, add the location of Player's
+pkg-config file to your PKG_CONFIG_PATH, eg. in bash:
+
+export PKG_CONFIG_PATH+=<Player installation prefix>/lib/pkgconfig
+
+Now that the supporting software is set up, you can decide where you
+want to install Stage. The default installation directory varies by
+system, but is often /usr/local on Unix variants. This is easy and is
+often a good choice, but has the disadvantage that installation needs
+root/sudo priviliges. To install in the default location, do:
$ cmake .
@@ -28,11 +48,11 @@ path variable when invoking cmake. To do this, use this command,
substituting <prefix> with your chosen installation
directory.
- $ cmake -DCMAKE_INSTALL_PREFIX=PATH:<prefix>
+ $ cmake -DCMAKE_INSTALL_PREFIX=<prefix>
-For example to install in $HOME/stage, do:
+For example to install in $HOME/playerstage, do:
- $ cmake -DCMAKE_INSTALL_PREFIX=PATH:$HOME/stage
+ $ cmake -DCMAKE_INSTALL_PREFIX=$HOME/playerstage
CMake will generate makefiles specifically for your machine. When this
is done, you can inspect and edit the build settings using ccmake, or
View
22 libstage/CMakeLists.txt
@@ -1,10 +1,4 @@
-link_directories(${GLIB_LIBRARY_DIRS}
- ${FLTK_LIBRARY_DIRS}
- ${OPENGL_LIBRARY_DIRS}
-)
-
-
add_library( stage SHARED
ancestor.cc
block.cc
@@ -37,10 +31,22 @@ target_link_libraries( stage
ltdl
)
+# causes the shared library to have a version number
+set_target_properties( stage PROPERTIES
+ VERSION ${VERSION}
+)
+
+
add_executable( stagebinary main.cc )
set_target_properties( stagebinary PROPERTIES
- OUTPUT_NAME stage )
+ OUTPUT_NAME stage
+)
+
+
+set_target_properties( stagebinary PROPERTIES
+ OUTPUT_NAME stage
+)
target_link_libraries( stagebinary
stage
@@ -52,4 +58,4 @@ INSTALL(TARGETS stagebinary stage
)
INSTALL(FILES stage.hh
- DESTINATION include/stage-3.0)
+ DESTINATION include/${PROJECT_NAME}-${V_MAJOR}.${V_MINOR})
View
6 libstage/main.cc
@@ -8,8 +8,8 @@
#include "stage_internal.hh"
-const char* PACKAGE = "Stage";
-const char* VERSION = "3.dev";
+//const char* PACKAGE = "Stage";
+//const char* VERSION = "3.dev";
/* options descriptor */
static struct option longopts[] = {
@@ -21,7 +21,7 @@ static struct option longopts[] = {
int main( int argc, char* argv[] )
{
- printf( "%s %s ", PACKAGE, VERSION );
+ printf( "%s %s ", PROJECT, VERSION );
int ch=0, optindex=0;
bool usegui = true;
View
12 libstageplugin/p_driver.cc
@@ -194,7 +194,7 @@ Driver* StgDriver_Init(ConfigFile* cf, int section)
// driver can support and how to create a driver instance.
void StgDriver_Register(DriverTable* table)
{
- printf( "\n ** Stage plugin v%s **", PACKAGE_VERSION );
+ printf( "\n ** Stage plugin v%s **", "3.0dev" ); // XX TODO
if( !player_quiet_startup )
{
@@ -323,7 +323,7 @@ StgDriver::StgDriver(ConfigFile* cf, int section)
ifsrc = new InterfacePosition( player_addr, this, cf, section );
break;
- case PLAYER_SONAR_CODE:
+ case PLAYER_SONAR_CODE:
ifsrc = new InterfaceSonar( player_addr, this, cf, section );
break;
@@ -351,9 +351,9 @@ StgDriver::StgDriver(ConfigFile* cf, int section)
// ifsrc = new InterfaceGraphics2d( player_addr, this, cf, section );
// break;
- case PLAYER_GRAPHICS3D_CODE:
- ifsrc = new InterfaceGraphics3d( player_addr, this, cf, section );
- break;
+// case PLAYER_GRAPHICS3D_CODE:
+ // ifsrc = new InterfaceGraphics3d( player_addr, this, cf, section );
+ //break;
// case PLAYER_GRIPPER_CODE:
// ifsrc = new InterfaceGripper( player_addr, this, cf, section );
@@ -568,7 +568,7 @@ void StgDriver::Update(void)
{
case PLAYER_SIMULATION_CODE:
//if( stg_world_update( this->world, FALSE ) )
- world->RealTimeUpdate();
+ world->Update();
//player_quit = TRUE; // set Player's global quit flag
break;

0 comments on commit 3d4fd9e

Please sign in to comment.