Remove SWIG stuff from build.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 23 Oct 2012 15:02:30 -0400
changeset 1311 ec7bcd927ccb
parent 1310 3382edc8a7f9
child 1312 a5ca4200998d
Remove SWIG stuff from build. This is never going to work well everywhere. I'll leave the SWIG stuff elsewhere, though, for those that want to build their own bindings.
CMakeLists.txt
--- a/CMakeLists.txt	Tue Oct 23 14:59:29 2012 -0400
+++ b/CMakeLists.txt	Tue Oct 23 15:02:30 2012 -0400
@@ -303,195 +303,6 @@
     set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
 endif()
 
-
-# Scripting language bindings...
-
-#CMake's SWIG support is basically useless.
-#find_package(SWIG)
-
-option(PHYSFS_BUILD_SWIG "Build ${_LANG} bindings." TRUE)
-mark_as_advanced(PHYSFS_BUILD_SWIG)
-
-find_program(SWIG swig DOC "Path to swig command line app: http://swig.org/")
-if(NOT SWIG)
-    message(STATUS "SWIG not found. You won't be able to build scripting language bindings.")
-else()
-    mark_as_advanced(SWIG)
-    if(DEFINED CMAKE_BUILD_TYPE)
-        if((NOT CMAKE_BUILD_TYPE STREQUAL "") AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
-            if(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
-                set(SWIG_OPT_CFLAGS "-small")
-            else()
-                set(SWIG_OPT_CFLAGS "-O")
-            endif()
-        endif()
-    endif()
-
-    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()
-
-        if(PHYSFS_BUILD_${_UPPERLANG})
-            add_custom_command(
-                OUTPUT "${_TARGETDIR}/${_TARGET}.c" ${_EXTRAOUTPUTS}
-                MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/extras/physfs-swig.i"
-                COMMAND "${SWIG}"
-                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 "${_TARGETDIR}/${_TARGET}.c")
-            target_link_libraries(${_TARGET} ${PHYSFS_LIB_TARGET})
-            set_target_properties(${_TARGET} PROPERTIES
-                COMPILE_FLAGS "${_EXTRACFLAGS}"
-                LINK_FLAGS "${_EXTRALDFLAGS}"
-                LIBRARY_OUTPUT_NAME "physfs"
-                LIBRARY_OUTPUT_DIRECTORY "${_TARGETDIR}"
-                CLEAN_DIRECT_OUTPUT 1
-            )
-            install(TARGETS ${_TARGET} LIBRARY DESTINATION "${_INSTALLPATH}")
-            message(STATUS "${_LANG} bindings configured!")
-        else()
-            message(STATUS "Couldn't figure out ${_LANG} configuration. Skipping ${_LANG} bindings.")
-        endif()
-    endmacro()
-
-    macro(add_script_binding_option _VAR _LANG _DEFVAL)
-        set(BUILDSWIGVAL ${_DEFVAL})
-        if(NOT PHYSFS_BUILD_SWIG)
-            set(BUILDSWIGVAL FALSE)
-        endif()
-        option(${_VAR} "Build ${_LANG} bindings." ${BUILDSWIGVAL})
-        mark_as_advanced(${_VAR})
-    endmacro()
-
-    add_script_binding_option(PHYSFS_BUILD_PERL "Perl" TRUE)
-    add_script_binding_option(PHYSFS_BUILD_RUBY "Ruby" TRUE)
-endif()
-
-if(PHYSFS_BUILD_PERL)
-    message(STATUS "Configuring Perl bindings...")
-    find_program(PERL perl DOC "Path to perl command line app: http://perl.org/")
-    if(NOT PERL)
-        message(STATUS "Perl not found. You won't be able to build perl bindings.")
-        set(PHYSFS_BUILD_PERL FALSE)
-    endif()
-    mark_as_advanced(PERL)
-
-    macro(get_perl_config _KEY _VALUE)
-        if(PHYSFS_BUILD_PERL)
-            message(STATUS "Figuring out perl config value '${_KEY}' ...")
-            execute_process(
-                COMMAND ${PERL} -w -e "use Config; print \$Config{${_KEY}};"
-                RESULT_VARIABLE GET_PERL_CONFIG_RC
-                OUTPUT_VARIABLE ${_VALUE}
-            )
-            if(NOT GET_PERL_CONFIG_RC EQUAL 0)
-                message(STATUS "Perl executable ('${PERL}') reported failure: ${GET_PERL_CONFIG_RC}")
-                set(PHYSFS_BUILD_PERL FALSE)
-            endif()
-            if(NOT ${_VALUE})
-                message(STATUS "Perl executable ('${PERL}') didn't have a value for '${_KEY}'")
-                set(PHYSFS_BUILD_PERL FALSE)
-            endif()
-
-            if(PHYSFS_BUILD_PERL)
-                message(STATUS "Perl says: '${${_VALUE}}'.")
-            endif()
-        endif()
-    endmacro()
-
-    # !!! 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("installsitearch" PERL_INSTALL_PATH)
-
-    # !!! FIXME: this test for Mac OS X is wrong.
-    if(MACOSX)
-        get_perl_config("libperl" PERL_LIBPERL)
-        set(TMPLIBPERL "${PERL_LIBPERL}")
-        string(REGEX REPLACE "^lib" "" TMPLIBPERL "${TMPLIBPERL}")
-        string(REGEX REPLACE "\\.so$" "" TMPLIBPERL "${TMPLIBPERL}")
-        string(REGEX REPLACE "\\.dylib$" "" TMPLIBPERL "${TMPLIBPERL}")
-        string(REGEX REPLACE "\\.dll$" "" TMPLIBPERL "${TMPLIBPERL}")
-        if(NOT "${TMPLIBPERL}" STREQUAL "${PERL_LIBPERL}")
-            message(STATUS "Stripped '${PERL_LIBPERL}' down to '${TMPLIBPERL}'.")
-            set(PERL_LIBPERL "${TMPLIBPERL}")
-        endif()
-        set(PERL_LIBPERL "-l${PERL_LIBPERL}")
-    endif()
-
-    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}")
-    install(
-        FILES test/test_physfs.pl
-        DESTINATION bin
-        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
-                    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-    )
-endif()
-
-# !!! FIXME: lots of cut-and-paste from perl bindings.
-if(PHYSFS_BUILD_RUBY)
-    message(STATUS "Configuring Ruby bindings...")
-    find_program(RUBY ruby DOC "Path to ruby command line app: http://ruby-lang.org/")
-    if(NOT RUBY)
-        message(STATUS "Ruby not found. You won't be able to build ruby bindings.")
-        set(PHYSFS_BUILD_RUBY FALSE)
-    endif()
-    mark_as_advanced(RUBY)
-
-    macro(get_ruby_config _KEY _VALUE)
-        if(PHYSFS_BUILD_RUBY)
-            message(STATUS "Figuring out ruby config value '${_KEY}' ...")
-            execute_process(
-                COMMAND ${RUBY} -e "require 'rbconfig'; puts RbConfig::CONFIG['${_KEY}'];"
-                RESULT_VARIABLE GET_RUBY_CONFIG_RC
-                OUTPUT_VARIABLE ${_VALUE}
-                OUTPUT_STRIP_TRAILING_WHITESPACE
-            )
-            if(NOT GET_RUBY_CONFIG_RC EQUAL 0)
-                message(STATUS "Ruby executable ('${RUBY}') reported failure: ${GET_RUBY_CONFIG_RC}")
-                set(PHYSFS_BUILD_RUBY FALSE)
-            endif()
-            if(NOT ${_VALUE})
-                message(STATUS "Ruby executable ('${RUBY}') didn't have a value for '${_KEY}'")
-                set(PHYSFS_BUILD_RUBY FALSE)
-            endif()
-
-            if(PHYSFS_BUILD_RUBY)
-                message(STATUS "Ruby says: '${${_VALUE}}'.")
-            endif()
-        endif()
-    endmacro()
-
-    get_ruby_config("archdir" RUBY_INCLUDE_PATH)
-    get_ruby_config("CFLAGS" RUBY_CCFLAGS)
-    get_ruby_config("LDFLAGS" RUBY_LDFLAGS)
-    get_ruby_config("sitearchdir" RUBY_INSTALL_PATH)
-    get_ruby_config("LIBRUBYARG_SHARED" RUBY_LIBRUBY)
-    get_ruby_config("libdir" RUBY_LIBDIR)
-
-    configure_swig_binding(Ruby "${RUBY_INSTALL_PATH}" "" "\"-I${RUBY_INCLUDE_PATH}\" ${RUBY_CCFLAGS} -w" "\"-L${RUBY_LIBDIR}\" ${RUBY_LIBRUBY} ${RUBY_LDFLAGS}")
-    set_target_properties(physfs-ruby PROPERTIES PREFIX "")
-    install(
-        FILES test/test_physfs.rb
-        DESTINATION bin
-        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
-                    GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
-    )
-endif()
-
-
 install(TARGETS ${PHYSFS_INSTALL_TARGETS}
         RUNTIME DESTINATION bin
         LIBRARY DESTINATION lib${LIB_SUFFIX}
@@ -557,8 +368,6 @@
 message_bool_option("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
 message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
 message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
-message_bool_option("Build Perl bindings" PHYSFS_BUILD_PERL)
-message_bool_option("Build Ruby bindings" PHYSFS_BUILD_RUBY)
 message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
 if(PHYSFS_BUILD_TEST)
     message_bool_option("  Use readline in test program" HAVE_SYSTEM_READLINE)