Permalink
Browse files

fixing up build config: now builds on Ubuntu 10.10 and OS X 10.6.5 cl…

…eanly
  • Loading branch information...
1 parent 22b31d6 commit 1f12f588fe79528a36e2809f996a318216bc066f @rtv rtv committed Nov 25, 2010
Showing with 26 additions and 40 deletions.
  1. +7 −28 CMakeLists.txt
  2. +3 −1 avonstage/CMakeLists.txt
  3. +10 −8 libstage/CMakeLists.txt
  4. +5 −2 libstageplugin/CMakeLists.txt
  5. +1 −1 stage.pc.in
View
@@ -31,6 +31,7 @@ SET (PROJECT_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake CACHE PATH "Location of CMake
# Determine the operating system in detail
INCLUDE (${PROJECT_CMAKE_DIR}/internal/FindOS.cmake)
INCLUDE (${PROJECT_CMAKE_DIR}/internal/UninstallTarget.cmake)
+
# Enable -Wall by default unless on Win or Solaris
IF (NOT PROJECT_OS_WIN AND NOT PROJECT_OS_SOLARIS)
# Using -Wall on Windows causes MSVC to produce thousands of warnings in its
@@ -71,7 +72,6 @@ find_library( LTDL_LIB ltdl DOC "Libtool lib" )
include_directories(
${OPENGL_INCLUDE_DIR}
${LTDL_INCLUDE_DIR}
-
)
# find the easy modules
@@ -93,7 +93,7 @@ ENDIF( LIBPNG_FOUND )
#MESSAGE( STATUS "BUILD_GUI is ${BUILD_GUI}" )
#IF( BUILD_GUI )
-## the FLTK package script is not useful - it finds an X11-based FLTK on OS X.
+## the FLTK package script is not useful - it finds an X11-based FLTK on OSX.
## so we can't do this stuff
#find_package( FLTK REQUIRED )
#IF( FLTK_FOUND )
@@ -137,18 +137,9 @@ EXECUTE_PROCESS ( COMMAND ${FLTK_CONFIG} --use-gl --use-images --libs
# replace the newlines with semicolons
STRING(REGEX REPLACE "\n" ";" FLTK_LIBS "${FLTK_LIBS_NEWLINES}")
-#MESSAGE( STATUS " FLTK_CFLAGS = ${FLTK_CFLAGS}")
-#MESSAGE( STATUS " FLTK_LDFLAGS = ${FLTK_LDFLAGS}")
-#MESSAGE( STATUS " FLTK_LIBS = ${FLTK_LIBS}")
-
-STRING(REGEX REPLACE " -lGLU" "" TMP "${FLTK_LDFLAGS}")
-STRING(REGEX REPLACE " -lGL" "" TMP2 "${TMP}")
-STRING(REGEX REPLACE " -lpng" "" FLTK_LDFLAGS_PKGCONFIG "${TMP2}")
-
-
-STRING(REGEX REPLACE " -lgl" "" FLTK_LIBS_PKGCONFIG "${FLTK_LIBS}")
-STRING(REGEX REPLACE " -lglu" "" FLTK_LIBS_PKGCONFIG" "${FLTK_LIBS_PKGCONFIG}")
-STRING(REGEX REPLACE " -lpng" "" FLTK_LIBS_PKGCONFIG" "${FLTK_LIBS_PKGCONFIG}")
+MESSAGE( STATUS " FLTK_CFLAGS = ${FLTK_CFLAGS}")
+MESSAGE( STATUS " FLTK_LDFLAGS = ${FLTK_LDFLAGS}")
+MESSAGE( STATUS " FLTK_LIBS = ${FLTK_LIBS}")
SET (FLTK_FOUND TRUE)
@@ -170,23 +161,12 @@ MESSAGE( STATUS "Checking for optional libraries..." )
pkg_search_module( PLAYER playercore>=2.1.0 )
IF( PLAYER_FOUND )
MESSAGE( STATUS ${INDENT} "Player version ${PLAYER_VERSION} detected at ${PLAYER_PREFIX}" )
-# MESSAGE( STATUS " PLAYER_CFLAGS: ${PLAYER_CFLAGS}" )
-# MESSAGE( STATUS " PLAYER_LDFLAGS: ${PLAYER_LDFLAGS}" )
+ MESSAGE( STATUS " PLAYER_CFLAGS: ${PLAYER_CFLAGS}" )
+ MESSAGE( STATUS " PLAYER_LDFLAGS: ${PLAYER_LDFLAGS}" )
ELSE( PLAYER_FOUND )
MESSAGE(STATUS ${INDENT} "Player not detected. If Player is installed but not detected, check your PKG_CONFIG_PATH." )
ENDIF( PLAYER_FOUND )
-
-## this should not be necessary now that we do the FLTK config
-## carefully above. I'll leave the code here in case of trouble
-# IF (APPLE)
-# # define flags to avoid the error:
-# # ld: cycle in dylib re-exports with /usr/X11R6/lib/libGL.dylib
-# MESSAGE(STATUS "Setting Apple specific flags")
-# # work around the OS X 10.5 X11/OpenGL library bug
-# SET(APPLE_LIBRARIES "-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
-#ENDIF (APPLE)
-
# Create the pkgconfig file
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/stage.pc.in ${CMAKE_CURRENT_BINARY_DIR}/stage.pc @ONLY)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/stage.pc DESTINATION ${PROJECT_LIB_DIR}/pkgconfig/)
@@ -212,7 +192,6 @@ ADD_SUBDIRECTORY(libstage)
ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(assets)
ADD_SUBDIRECTORY(worlds)
-# ADD_SUBDIRECTORY(webstage)
ADD_SUBDIRECTORY(avonstage)
IF ( BUILD_PLAYER_PLUGIN AND PLAYER_FOUND )
@@ -11,7 +11,9 @@ IF( AVON_FOUND )
include_directories( ${AVON_INCLUDE_DIRS} )
link_directories( ${AVON_LIBRARY_DIRS} )
add_executable( avonstage avonstage.cc )
- target_link_libraries( avonstage stage event ${AVON_LIBRARIES} )
+ target_link_libraries( avonstage stage ${AVON_LIBRARIES} )
+
+ set_target_properties( avonstage PROPERTIES LINK_FLAGS "${FLTK_LDFLAGS}" )
INSTALL(TARGETS avonstage RUNTIME DESTINATION bin )
@@ -53,15 +53,15 @@ IF (NOT(${FLTK_LDFLAGS} MATCHES "-lGL"))
target_link_libraries( stage ${OPENGL_LIBRARIES})
ENDIF (NOT(${FLTK_LDFLAGS} MATCHES "-lGL"))
-# libtool
-target_link_libraries( stage ${LTDL_LIB} )
# causes the shared library to have a version number
set_target_properties( stage PROPERTIES
VERSION ${VERSION}
LINK_FLAGS "${FLTK_LDFLAGS}"
)
+target_link_libraries( stage ${LTDL_LIB} )
+
set( stagebinarySrcs main.cc )
set_source_files_properties( ${stagebinarySrcs} PROPERTIES COMPILE_FLAGS "${FLTK_CFLAGS}" )
@@ -77,17 +77,19 @@ set_source_files_properties( ${stagebinarySrcs} PROPERTIES COMPILE_FLAGS "${FLTK
add_executable( stagebinary ${stagebinarySrcs} )
+
+set_target_properties( stagebinary PROPERTIES OUTPUT_NAME stage )
+
# Apple seems to have trouble when libstage and stagebinary are linked against FLTK
# Newer Linux distributions won't allow stagebinary to inherit libstage's links to fltk, so we need
# to explicitly link on Linux
-if (NOT PROJECT_OS_LINUX)
- set_target_properties( stagebinary PROPERTIES OUTPUT_NAME stage )
- target_link_libraries( stagebinary stage )
-ELSE (NOT PROJECT_OS_LINUX)
- set_target_properties( stagebinary PROPERTIES OUTPUT_NAME stage LINK_FLAGS "${FLTK_LDFLAGS}" )
+target_link_libraries( stagebinary stage )
+set_target_properties( stagebinary PROPERTIES LINK_FLAGS "${FLTK_LDFLAGS}" )
+
+IF(PROJECT_OS_LINUX)
target_link_libraries( stagebinary stage pthread )
-ENDIF(NOT PROJECT_OS_LINUX)
+ENDIF(PROJECT_OS_LINUX)
INSTALL(TARGETS stagebinary stage
RUNTIME DESTINATION bin
@@ -8,7 +8,7 @@ set( stagepluginSrcs
p_driver.cc
p_actarray.cc
p_blobfinder.cc
- p_gripper.cc
+ p_gripper.cc
p_simulation.cc
p_fiducial.cc
p_position.cc
@@ -29,7 +29,10 @@ target_link_libraries( stageplugin
set_source_files_properties( ${stagepluginSrcs} PROPERTIES COMPILE_FLAGS "${FLTK_CFLAGS}" )
# delete the "lib" prefix from the plugin
-SET_TARGET_PROPERTIES( stageplugin PROPERTIES PREFIX "" )
+SET_TARGET_PROPERTIES( stageplugin PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "${FLTK_LDFLAGS}"
+ )
IF (BUILD_LSPTEST)
ADD_SUBDIRECTORY(test)
View
@@ -10,5 +10,5 @@ Version: @VERSION@
# add the incantations to the flags and libs lines below
Requires:
-Libs: -L${prefix}/@PROJECT_LIB_DIR@ -lstage @FLTK_LDFLAGS_PKGCONFIG@
+Libs: -L${prefix}/@PROJECT_LIB_DIR@ -lstage @FLTK_LDFLAGS@
Cflags: -I${prefix}/include/Stage-@APIVERSION@ @FLTK_CFLAGS@

0 comments on commit 1f12f58

Please sign in to comment.