Commit faee32ea authored by Ghislain MARY's avatar Ghislain MARY

Generate import libs for projects built with autotools on Windows.

parent a302c806
############################################################################
# postinstall.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/avcodec-53.def" "/out:${INSTALL_PREFIX}/lib/avcodec.lib" "/machine:X86")
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/avutil-51.def" "/out:${INSTALL_PREFIX}/lib/avutil.lib" "/machine:X86")
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/swresample-0.def" "/out:${INSTALL_PREFIX}/lib/swresample.lib" "/machine:X86")
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/swscale-2.def" "/out:${INSTALL_PREFIX}/lib/swscale.lib" "/machine:X86")
############################################################################
# postinstall.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${SOURCE_DIR}/cmake/importlib.py" "${INSTALL_PREFIX}/bin/libopus-0.dll" "${INSTALL_PREFIX}/lib/opus.lib")
############################################################################
# postinstall.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${SOURCE_DIR}/cmake/importlib.py" "${INSTALL_PREFIX}/bin/libvpx-1.dll" "${INSTALL_PREFIX}/lib/vpx.lib")
############################################################################
# postinstall.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${SOURCE_DIR}/cmake/importlib.py" "${INSTALL_PREFIX}/bin/libxml2-2.dll" "${INSTALL_PREFIX}/lib/xml2.lib")
......@@ -33,6 +33,11 @@ else(${CMAKE_VERBOSE_MAKEFILE})
endif(${CMAKE_VERBOSE_MAKEFILE})
find_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Could not find python!")
endif(NOT PYTHONINTERP_FOUND)
if(MSVC)
find_program(SH_PROGRAM
NAMES sh.exe
......@@ -285,6 +290,17 @@ function(linphone_builder_add_project PROJNAME)
CMAKE_GENERATOR ${CMAKE_GENERATOR}
${BUILD_COMMANDS}
)
if(MSVC)
if("${EP_${PROJNAME}_USE_AUTOTOOLS}" STREQUAL "yes")
ExternalProject_Add_Step(EP_${PROJNAME} postinstall
COMMAND ${CMAKE_COMMAND} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DINSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_SOURCE_DIR}/builders/${PROJNAME}/postinstall.cmake
COMMENT "Performing post-installation step"
DEPENDEES mkdir update patch download configure build install
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif("${EP_${PROJNAME}_USE_AUTOTOOLS}" STREQUAL "yes")
endif(MSVC)
endfunction(linphone_builder_add_project)
function(linphone_builder_add_external_projects)
......
#!/usr/bin/python
import os
import re
import subprocess
import sys
import tempfile
def main(argv=None):
if argv is None:
argv = sys.argv
if len(argv) >= 3:
dllfile = argv[1]
dllpath, dllextension = os.path.splitext(dllfile)
dllname = os.path.basename(dllpath)
libfile = argv[2]
deffile = os.path.join(tempfile.gettempdir(), dllname + ".def")
ret = subprocess.check_output(["dumpbin", "/exports", dllfile, "/out:" + deffile], stderr=subprocess.STDOUT)
fin = open(deffile, "r")
lines = fin.readlines()
exports = []
for line in lines:
exportre = re.compile('^\s+\d+\s+[\dA-F]+\s+[\dA-F]+\s+(\w+)(\s=\s\w+)?$')
m = exportre.match(line)
if m:
exports.append(m.group(1))
fin.close()
fin = open(deffile, "w")
fin.write("EXPORTS " + dllname + "\n")
for export in exports:
fin.write("\t" + export + "\n")
fin.close()
ret = subprocess.check_output(["lib", "/def:" + deffile, "/out:" + libfile, "/machine:X86"], stderr=subprocess.STDOUT)
print(ret)
if __name__ == "__main__":
sys.exit(main())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment