diff -bru a/bindings/swig/perl/CMakeLists.txt b/bindings/swig/perl/CMakeLists.txt --- a/bindings/swig/perl/CMakeLists.txt 2020-07-29 18:59:48.000000000 +0200 +++ b/bindings/swig/perl/CMakeLists.txt 2020-11-01 19:56:20.825016280 +0100 @@ -1,68 +1,35 @@ -# This method works but there is no good way to install the results of it -#FIND_PACKAGE(PerlLibs REQUIRED) -#INCLUDE_DIRECTORIES(${PERL_INCLUDE_PATH}) -# -#SET_SOURCE_FILES_PROPERTIES(../sword.i PROPERTIES CPLUSPLUS ON) -#SET_SOURCE_FILES_PROPERTIES(../sword.i PROPERTIES SWIG_FLAGS "") -# -#SWIG_ADD_MODULE(Sword perl -# "../sword.i" -#) -# -#SWIG_LINK_LIBRARIES(Sword ${PERL_LIBRARY} ${SWORD_LINK_NAME}) - -FIND_PACKAGE(Perl REQUIRED) - -SET(PERL_MAKEFILE "#!${PERL_EXECUTABLE} - -use ExtUtils::MakeMaker; - -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written -WriteMakefile( - 'NAME' => 'Sword', - 'VERSION' => '${SWORD_VERSION}', - 'INC' => '-I\"${CMAKE_SOURCE_DIR}/include\" -I\"${CMAKE_CURRENT_SOURCE_DIR}/..\"', - 'DEFINE' => '-DSWIG', - 'LIBS' => '-L\"${CMAKE_BINARY_DIR}\" -lsword -lz', - 'FIRST_MAKEFILE' => 'Makefile.perlswig', - 'PREREQ_PM' => {}, - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT => 'Sword Project perl bindings', # retrieve abstract from module - AUTHOR => 'Sword Project ') : ()), -); - -rename 'Makefile.perlswig', 'Makefile.perlswig.old' or die \"Can't rename Makefile\"; -open(INPUT, 'Makefile.perlswig') or die \"Can't open output Makefile\"; -while () { - s/\\-lsword/\\-lsword \\-lstdc\\+\\+/; - print OUTPUT \"$_\"; -} - -close INPUT; -close OUTPUT;") -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Makefile.PL "${PERL_MAKEFILE}") - -SET(SKIP_MAKEFILE "\\.old -~$ -\\.bak -^CVS -Makefile$") -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Makefile.SKIP "${SKIP_MAKEFILE}") - -SWORD_SWIG_GENERATE(perl) - -ADD_CUSTOM_COMMAND(OUTPUT MANIFEST Makefile.perlswig - COMMAND ${PERL_EXECUTABLE} Makefile.PL && make -f Makefile.perlswig clean - COMMAND ${PERL_EXECUTABLE} Makefile.PL && make -f Makefile.perlswig manifest - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -ADD_CUSTOM_TARGET(perlswig ALL - COMMAND make -f Makefile.perlswig - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Sword.cxx ${CMAKE_CURRENT_BINARY_DIR}/Makefile.perlswig ${SWORD_LINK_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +# Perl Swig bindings -INSTALL(SCRIPT install.cmake) +cmake_minimum_required(VERSION 3.14.7) +cmake_policy(SET CMP0078 NEW) +cmake_policy(SET CMP0086 NEW) +set(UseSWIG_MODULE_VERSION 2) -MESSAGE(STATUS "Perl: yes") +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(PerlLibs REQUIRED) +include_directories(${PERL_INCLUDE_PATH}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + + +set_source_files_properties(../sword.i PROPERTIES CPLUSPLUS ON) + +SWIG_ADD_LIBRARY(Sword + TYPE SHARED + LANGUAGE perl SOURCES ../sword.i + ) +TARGET_LINK_LIBRARIES(Sword ${PERL_LIBRARIES} ${SWORD_LINK_NAME}) + + +install( + TARGETS Sword + LIBRARY DESTINATION "${LIB_INSTALL_DIR}/perl5/vendor_perl/auto/Sword" +) +get_target_property(SWIG_BUILDIR Sword SWIG_SUPPORT_FILES_DIRECTORY) + +message(STATUS "SWIG_BUILDIR=${SWIG_BUILDIR}") +install( + FILES ${SWIG_BUILDIR}/Sword.pm + DESTINATION "${LIB_INSTALL_DIR}/perl5/vendor_perl" +)