From 7a979e42165930b02f46edae86ca81a819be8d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hermann=20H=C3=B6hne?= Date: Thu, 2 Mar 2023 23:19:03 +0100 Subject: [PATCH] Removing MSVC specifics from CMakeLists. cgo never supported MSVC anyways. --- dependencies/win32/CMakeLists.txt | 23 +++++------------------ dependencies/win32/dll2lib.bat | 29 ----------------------------- 2 files changed, 5 insertions(+), 47 deletions(-) delete mode 100644 dependencies/win32/dll2lib.bat diff --git a/dependencies/win32/CMakeLists.txt b/dependencies/win32/CMakeLists.txt index a2bb656..ac5d7ff 100644 --- a/dependencies/win32/CMakeLists.txt +++ b/dependencies/win32/CMakeLists.txt @@ -39,24 +39,7 @@ ENDIF() IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin/libpurple.dll) file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_BINARY_ZIP} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) ENDIF() -if (MSVC) - set(LIBPURPLE_LIB ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin/libpurple.lib) - add_custom_target( - libpurple_lib - DEPENDS ${LIBPURPLE_LIB} - ) - add_custom_command( - OUTPUT ${LIBPURPLE_LIB} - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dll2lib.bat - ARGS 32 ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin/libpurple.dll - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin - MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin/libpurple.dll - COMMENT "Generating .lib file from .dll..." - USES_TERMINAL - ) -else() - set(LIBPURPLE_LIB ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin/libpurple.dll) -endif() +set(LIBPURPLE_LIB ${CMAKE_CURRENT_BINARY_DIR}/${PIDGIN_DIRNAME}-win32bin/libpurple.dll) set(PURPLE_INCLUDE_DIRS ${GTK_INCLUDE_DIRS} @@ -87,19 +70,23 @@ set(PIXBUF_LIBRARIES find_path(OPUSFILE_INCLUDE_DIR opusfile.h PATH_SUFFIXES opus) find_path(OGG_INCLUDE_DIR ogg/ogg.h) +if(OPUSFILE_INCLUDE_DIR) set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDE_DIR} ${OPUSFILE_INCLUDE_DIR}/opus ${OGG_INCLUDE_DIR} PARENT_SCOPE ) +endif() find_library(OPUSFILE_LIB opusfile) find_library(OPUS_LIB opus) find_library(OGG_LIB ogg) +if(OPUSFILE_LIB) set(OPUSFILE_LIBRARIES ${OPUSFILE_LIB} ${OPUS_LIB} ${OGG_LIB} PARENT_SCOPE ) +endif() diff --git a/dependencies/win32/dll2lib.bat b/dependencies/win32/dll2lib.bat deleted file mode 100644 index a0e3a40..0000000 --- a/dependencies/win32/dll2lib.bat +++ /dev/null @@ -1,29 +0,0 @@ -@echo off - -REM Usage: dll2lib [32|64] some-file.dll -REM -REM Generates some-file.lib from some-file.dll, making an intermediate -REM some-file.def from the results of dumpbin /exports some-file.dll. -REM -REM Requires 'dumpbin' and 'lib' in PATH - run from VS developer prompt. -REM -REM Script inspired by http://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll -SETLOCAL -if "%1"=="32" (set machine=x86) else (set machine=x64) -set dll_file=%2 -set dll_file_no_ext=%~n2 -set exports_file=%dll_file_no_ext%-exports.txt -set def_file=%dll_file_no_ext%.def -set lib_file=%dll_file_no_ext%.lib -set lib_name=%dll_file_no_ext% - -dumpbin /exports %dll_file% > %exports_file% - -echo LIBRARY %lib_name% > %def_file% -echo EXPORTS >> %def_file% -for /f "skip=19 tokens=1,4" %%A in (%exports_file%) do if NOT "%%B" == "" (echo %%B @%%A >> %def_file%) - -lib /def:%def_file% /out:%lib_file% /machine:%machine% - -REM Clean up temporary intermediate files -del %exports_file% %def_file% %dll_file_no_ext%.exp