Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed Build Behavior on Mac OSX Snow Leopard #8

Closed
wants to merge 1 commit into from

2 participants

@chmp

On OSX libpng is installed in a non standard directory
(/usr/X11). The png package included in cmake takes care
of this.
Additionally fltk currently has to be built as 386 on
Snow Leopard, this then requires stage to be built as
386 as well.
This commit addopts the CMakeLists file to ensure the
correct behavior with OSX Snow Leopard.

@chmp chmp modified search for libpng + added arch spec
 on osx libpng is installed in a non standard directory
 (/usr/X11) the png package included in cmake takes care
 of this.
 Additionally fltk currently has to be built as 386 on
 Snow Leopard, this then requires stage to be built as
 386 as well.
 This commit addopts the CMakeLists file to ensure the
 correct behavior with OSX Snow Leopard.
524adc1
@rtv
Owner
rtv commented

I've committed a more radical overhaul of the CMake build scripts that makes things a lot more simple. Needs to be tested on Snow Leopard and Linux, but works for me on 10.7 with homebrew. I used your suggestions - thanks very much! The problem with MacPorts for a while only building the 32 bit FLTK should be worked around outside of the Stage build system. I left your suggested fix in the code but commented out.

@rtv rtv closed this
@chmp

Thanks. Works perfectly on Snow Leopard after enabling the 32bit forcing. I'm also using homebrew with the standard formula for fltk. Maybe the fault really lies with OSX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 31, 2011
  1. @chmp

    modified search for libpng + added arch spec

    chmp authored
     on osx libpng is installed in a non standard directory
     (/usr/X11) the png package included in cmake takes care
     of this.
     Additionally fltk currently has to be built as 386 on
     Snow Leopard, this then requires stage to be built as
     386 as well.
     This commit addopts the CMakeLists file to ensure the
     correct behavior with OSX Snow Leopard.
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 13 deletions.
  1. +20 −13 CMakeLists.txt
View
33 CMakeLists.txt
@@ -42,9 +42,16 @@ ENDIF (NOT PROJECT_OS_WIN AND NOT PROJECT_OS_SOLARIS)
#####################################
# Build type cflags
SET (OPTIMIZE "-O2")
-SET (CMAKE_CXX_FLAGS_RELEASE " ${OPTIMIZE} -DNDEBUG ${WALL} " CACHE INTERNAL "C Flags for release" FORCE)
-SET (CMAKE_CXX_FLAGS_DEBUG "-ggdb ${WALL} " CACHE INTERNAL "C Flags for debug" FORCE)
-SET (CMAKE_CXX_FLAGS_PROFILE " -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags for profile" FORCE)
+if( PROJECT_OS_OSX )
+ # needed for stage to work with fltk on snow leopard
+ SET (FORCE_ARCH "-arch i386" )
+else( PROJECT_OS_OSX )
+ SET (FORCE_ARCH "")
+endif( PROJECT_OS_OSX )
+SET (CMAKE_CXX_FLAGS_RELEASE " ${FORCE_ARCH} ${OPTIMIZE} -DNDEBUG ${WALL} " CACHE INTERNAL "C Flags for release" FORCE)
+SET (CMAKE_CXX_FLAGS_DEBUG " ${FORCE_ARCH} -ggdb ${WALL} " CACHE INTERNAL "C Flags for debug" FORCE)
+SET (CMAKE_CXX_FLAGS_PROFILE " ${FORCE_ARCH} -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags for profile" FORCE)
+
#####################################
# Set the default build type
@@ -81,14 +88,14 @@ MESSAGE( STATUS "Checking for required libraries..." )
SET( INDENT " * " )
-pkg_search_module( LIBPNG REQUIRED libpng )
-IF( LIBPNG_FOUND )
-# MESSAGE( STATUS ${INDENT} "Libpng version ${LIBPNG_VERSION} detected at ${LIBPNG_PREFIX}" )
-# MESSAGE( STATUS " LIBPNG_CFLAGS = ${LIBPNG_CFLAGS}" )
-# MESSAGE( STATUS " LIBPNG_LDFLAGS = ${LIBPNG_LDFLAGS}" )
-ELSE( LIBPNG_FOUND )
- MESSAGE( ${INDENT} "Libpng not detected" )
-ENDIF( LIBPNG_FOUND )
+find_package( PNG REQUIRED )
+IF( PNG_FOUND )
+# MESSAGE( STATUS ${INDENT} "PNG version ${PNG_VERSION} detected at ${PNG_PREFIX}" )
+# MESSAGE( STATUS " PNG_CFLAGS = ${PNG_CFLAGS}" )
+# MESSAGE( STATUS " PNG_LDFLAGS = ${PNG_LDFLAGS}" )
+ELSE( PNG_FOUND )
+ MESSAGE( ${INDENT} "PNG not detected" )
+ENDIF( PNG_FOUND )
#MESSAGE( STATUS "BUILD_GUI is ${BUILD_GUI}" )
#IF( BUILD_GUI )
@@ -177,14 +184,14 @@ MESSAGE( STATUS "Installation path CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
include_directories( .
libstage
replace
- ${LIBPNG_INCLUDE_DIRS}
+ ${PNG_INCLUDE_DIRS}
${CMAKE_INCLUDE_PATH}
)
# all targets need these library directories
link_directories(
- ${LIBPNG_LIBRARY_DIRS}
+ ${PNG_LIBRARY_DIRS}
)
# work through these subdirs
Something went wrong with that request. Please try again.