Skip to content
Permalink
Browse files
Fixed filename collision when linking the library and script bindings.
  • Loading branch information
icculus committed Feb 3, 2010
1 parent 282bf1b commit 35ed8dd58682d79d523dfcff549c2ec43eec299f
Showing with 15 additions and 6 deletions.
  1. +15 −6 CMakeLists.txt
@@ -379,25 +379,34 @@ ELSE(NOT SWIG)
ENDIF((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
ENDIF(DEFINED CMAKE_BUILD_TYPE)

SET(SWIG_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/physfs-swig-bindings")

MACRO(CONFIGURE_SWIG_BINDING _LANG _INSTALLPATH _EXTRAOUTPUTS _EXTRACFLAGS _EXTRALDFLAGS)
STRING(TOUPPER "${_LANG}" _UPPERLANG)
STRING(TOLOWER "${_LANG}" _LOWERLANG)
SET(_TARGET "physfs-${_LOWERLANG}")
SET(_TARGETDIR "${SWIG_OUTPUT_DIR}/${_LOWERLANG}")

IF(NOT EXISTS "${_TARGETDIR}")
FILE(MAKE_DIRECTORY "${_TARGETDIR}")
ENDIF(NOT EXISTS "${_TARGETDIR}")

IF(PHYSFS_BUILD_${_UPPERLANG})
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/physfs-${_LOWERLANG}.c" ${_EXTRAOUTPUTS}
OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS}
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
COMMAND "${SWIG}"
ARGS ${SWIG_OPT_CFLAGS} -${_LOWERLANG} -outdir "${CMAKE_CURRENT_BINARY_DIR}" -o "${CMAKE_CURRENT_BINARY_DIR}/physfs-${_LOWERLANG}.c" "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
ARGS ${SWIG_OPT_CFLAGS} -${_LOWERLANG} -outdir "${_TARGETDIR}" -o "${_TARGETDIR}/${_TARGET}.c" "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
COMMENT "Generating ${_LANG} bindings..."
)

ADD_LIBRARY(${_TARGET} SHARED "${CMAKE_CURRENT_BINARY_DIR}/physfs-${_LOWERLANG}.c")
ADD_LIBRARY(${_TARGET} SHARED "${_TARGETDIR}/${_TARGET}.c")
TARGET_LINK_LIBRARIES(${_TARGET} ${PHYSFS_LIB_TARGET})
SET_TARGET_PROPERTIES(${_TARGET} PROPERTIES
COMPILE_FLAGS "${_EXTRACFLAGS}"
LINK_FLAGS "${_EXTRALDFLAGS}"
OUTPUT_NAME "physfs"
LIBRARY_OUTPUT_NAME "physfs"
LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}"
)
INSTALL(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
MESSAGE(STATUS "${_LANG} bindings configured!")
@@ -469,8 +478,8 @@ IF(PHYSFS_BUILD_PERL)
SET(PERL_LIBPERL "-l${PERL_LIBPERL}")
ENDIF(MACOSX)

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\" ${PERL_LIBPERL} ${PERL_LDFLAGS}")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
CONFIGURE_SWIG_BINDING(Perl "${PERL_INSTALL_PATH}" "${SWIG_OUTPUT_DIR}/perl/physfs.pm" "\"-I${PERL_INCLUDE_PATH}/CORE\" ${PERL_CCFLAGS} -w" "\"-L${PERL_INCLUDE_PATH}/CORE\" ${PERL_LIBPERL} ${PERL_LDFLAGS}")
INSTALL(FILES "${SWIG_OUTPUT_DIR}/perl/physfs.pm" DESTINATION "${PERL_INSTALL_PATH}")
ENDIF(PHYSFS_BUILD_PERL)

IF(PHYSFS_BUILD_RUBY)

0 comments on commit 35ed8dd

Please sign in to comment.