Fixed: #910 - NeL and Ryzom client should build out of the box using CMake on mac os x now.

This commit is contained in:
rti 2010-05-29 21:49:31 +02:00
parent 6b2ddf3d59
commit d17b9de3b0
7 changed files with 122 additions and 17 deletions

View file

@ -84,7 +84,7 @@ ELSE(WITH_LUA51)
ENDIF(WITH_LUA51)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(Libwww)
FIND_PACKAGE(ZLIB)
IF(NOT WIN32)
FIND_PACKAGE(X11)
ENDIF(NOT WIN32)

View file

@ -12,7 +12,7 @@ IF(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR)
SET(LIBWWW_FIND_QUIETLY TRUE)
ENDIF(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR)
FIND_PATH(LIBWWW_INCLUDE_DIR
FIND_PATH(LIBWWW_INCLUDE_DIR
WWWInit.h
PATHS
/usr/local/include
@ -24,20 +24,78 @@ FIND_PATH(LIBWWW_INCLUDE_DIR
PATH_SUFFIXES libwww w3c-libwww
)
FIND_LIBRARY(LIBWWW_LIBRARY
wwwapp
# when installing libwww on mac os x using macports the file wwwconf.h resides
# in /opt/local/include and not in the real libwww include dir :/
FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR
wwwconf.h
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# combine both include directories into one variable
SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR})
# helper to find all the libwww sub libraries
MACRO(FIND_WWW_LIBRARY MYLIBRARY)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${ARGN}
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
ENDMACRO(FIND_WWW_LIBRARY MYLIBRARY)
# on mac os x, libwww sub libraries are not "inter-linked"
# we need to link them all manually
IF(APPLE)
# find all the libwww libraries
FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY wwwapp)
FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY wwwcache)
FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY wwwcore)
FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY wwwdir)
FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY wwwfile)
FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY wwwftp)
FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY wwwgopher)
FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY wwwhtml)
FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY wwwhttp)
FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY wwwinit)
FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY wwwmime)
FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY wwwmux)
FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY wwwnews)
FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY wwwssl)
FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY wwwstream)
FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY wwwtelnet)
FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY wwwtrans)
FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY wwwutils)
FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY wwwxml)
FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY wwwzip)
# combine all the libraries into one variable
SET(LIBWWW_LIBRARY
${LIBWWWAPP_LIBRARY} ${LIBWWWCACHE_LIBRARY} ${LIBWWWCORE_LIBRARY}
${LIBWWWDIR_LIBRARY} ${LIBWWWFILE_LIBRARY} ${LIBWWWFTP_LIBRARY}
${LIBWWWGOPHER_LIBRARY} ${LIBWWWHTML_LIBRARY} ${LIBWWWHTTP_LIBRARY}
${LIBWWWINIT_LIBRARY} ${LIBWWWMIME_LIBRARY} ${LIBWWWMUX_LIBRARY}
${LIBWWWNEWS_LIBRARY} ${LIBWWWSSL_LIBRARY} ${LIBWWWSTREAM_LIBRARY}
${LIBWWWTELNET_LIBRARY} ${LIBWWWTRANS_LIBRARY} ${LIBWWWUTILS_LIBRARY}
${LIBWWWXML_LIBRARY} ${LIBWWWZIP_LIBRARY}
)
ELSE(APPLE)
FIND_WWW_LIBRARY(LIBWWW_LIBRARY wwwapp)
ENDIF(APPLE)
IF(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR)
SET(LIBWWW_FOUND "YES")
IF(NOT LIBWWW_FIND_QUIETLY)
@ -48,4 +106,3 @@ ELSE(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR)
MESSAGE(STATUS "Warning: Unable to find LibWWW!")
ENDIF(NOT LIBWWW_FIND_QUIETLY)
ENDIF(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR)

View file

@ -0,0 +1,39 @@
# - Find zlib
# Find the native ZLIB includes and library
#
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
IF (ZLIB_INCLUDE_DIR)
# Already in cache, be silent
SET(ZLIB_FIND_QUIETLY TRUE)
ENDIF (ZLIB_INCLUDE_DIR)
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
SET(ZLIB_NAMES z zlib zdll)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
# Per-recommendation
SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}")
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)

View file

@ -80,7 +80,10 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_COVERAGE)
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}")
ENDIF(WITH_COVERAGE)
SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++ -lrt")
SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++")
IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lrt")
ENDIF(NOT APPLE)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6")
SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ")

View file

@ -49,6 +49,7 @@ TARGET_LINK_LIBRARIES(client ${PLATFORM_LINKFLAGS}
${NELNET_LIBRARY}
${NELLIGO_LIBRARY}
${NELGEORGES_LIBRARY}
${NEL3D_LIBRARY}
${LUA_LIBRARIES}
${CURL_LIBRARIES}
${NELSOUND_LIBRARY}

View file

@ -14,7 +14,9 @@ ELSE(WIN32)
ENDIF(WIN32)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
TARGET_LINK_LIBRARIES(game_share ${NELMISC_LIBRARY})
TARGET_LINK_LIBRARIES(game_share
${NELMISC_LIBRARY} ${NELNET_LIBRARY} ${NELLIGO_LIBRARY} ${NELGEORGES_LIBRARY}
${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
SET_TARGET_PROPERTIES(game_share PROPERTIES VERSION ${NL_VERSION})
IF(WIN32)

View file

@ -93,7 +93,10 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_COVERAGE)
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}")
ENDIF(WITH_COVERAGE)
SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++ -lrt")
SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++")
IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lrt")
ENDIF(NOT APPLE)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6")
SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ")