Skip to content
Permalink
Browse files
More work on Perl bindings linking.
Fixes linking on Mac OS X; the bindings now work there, too!.
  • Loading branch information
icculus committed Feb 2, 2010
1 parent c844a98 commit 6116683f5e3eed7151aa0bae98d0017daeeae7b7
Showing with 11 additions and 3 deletions.
  1. +11 −3 CMakeLists.txt
@@ -379,7 +379,7 @@ ELSE(NOT SWIG)
ENDIF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
ENDIF(DEFINED CMAKE_BUILD_TYPE)

MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS)
MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
STRING(TOUPPER "${_LANG}" _UPPERLANG)
STRING(TOLOWER "${_LANG}" _LOWERLANG)
SET(_TARGET "physfs-${_LOWERLANG}")
@@ -396,6 +396,7 @@ ELSE(NOT SWIG)
TARGET_LINK_LIBRARIES(${_TARGET} ${PHYSFS_LIB_TARGET})
SET_TARGET_PROPERTIES(${_TARGET} PROPERTIES
COMPILE_FLAGS "${_EXTRACFLAGS}"
LINK_FLAGS "${_EXTRALDFLAGS}"
OUTPUT_NAME "physfs"
)
INSTALL(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
@@ -450,9 +451,16 @@ IF(PHYSFS_BUILD_PERL)
# !!! FIXME: installsitearch might be the wrong location.
GET_PERL_CONFIG("archlibexp" PERL_INCLUDE_PATH)
GET_PERL_CONFIG("ccflags" PERL_CCFLAGS)
GET_PERL_CONFIG("ldflags" PERL_LDFLAGS)
GET_PERL_CONFIG("libperl" PERL_LIBPERL)
GET_PERL_CONFIG("installsitearch" PERL_INSTALL_PATH)

CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w")
STRING(REGEX REPLACE "^lib" "" PERL_LIBPERL "${PERL_LIBPERL}")
STRING(REGEX REPLACE "\.so$" "" PERL_LIBPERL "${PERL_LIBPERL}")
STRING(REGEX REPLACE "\.dylib$" "" PERL_LIBPERL "${PERL_LIBPERL}")
STRING(REGEX REPLACE "\.dll$" "" PERL_LIBPERL "${PERL_LIBPERL}")

CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w" "\"-L${PERL_INCLUDE_PATH}/CORE\" -l${PERL_LIBPERL} ${PERL_LDFLAGS}")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
ENDIF(PHYSFS_BUILD_PERL)

@@ -473,7 +481,7 @@ IF(PHYSFS_BUILD_RUBY)
#MESSAGE(STATUS "RUBY_INCLUDE_DIRS '${RUBY_INCLUDE_DIRS}'")
#MESSAGE(STATUS "RUBY_LIBRARY '${RUBY_LIBRARY}'")
#MESSAGE(STATUS "RUBY_VERSION '${RUBY_VERSION}'")
#CONFIGURE_SWIG_BINDING(Ruby "${PERL_INSTALL_PATH}" "" "")
#CONFIGURE_SWIG_BINDING(Ruby "${PERL_INSTALL_PATH}" "" "" "")
ENDIF(PHYSFS_BUILD_RUBY)


0 comments on commit 6116683

Please sign in to comment.