Skip to content

Commit

Permalink
cmake: improve def files and remove workarounds for old def files
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm authored and jrfonseca committed Dec 9, 2023
1 parent 5641503 commit 61f2782
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 284 deletions.
3 changes: 1 addition & 2 deletions sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ force_debug ()
add_executable (sample
sample.cpp
)
add_dependencies (sample exchndl_implib)
target_link_libraries (sample PRIVATE exchndl_implib)
target_link_libraries (sample PRIVATE exchndl)

install (FILES sample.cpp DESTINATION sample)
install (FILES sample.mak DESTINATION sample RENAME Makefile)
6 changes: 2 additions & 4 deletions src/addr2line/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ add_executable (addr2line
addr2line.cpp
)

add_dependencies (addr2line mgwhelp_implib)

target_link_libraries (addr2line
target_link_libraries (addr2line PRIVATE
common
mgwhelp_implib
mgwhelp
)

install (TARGETS addr2line RUNTIME DESTINATION bin)
6 changes: 2 additions & 4 deletions src/catchsegv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ include_directories (

set_property (TARGET catchsegv APPEND_STRING PROPERTY LINK_FLAGS " -municode")

add_dependencies (catchsegv mgwhelp_implib)

target_link_libraries (catchsegv
target_link_libraries (catchsegv PRIVATE
common
getoptW
mgwhelp_implib
mgwhelp
winmm
)

Expand Down
6 changes: 2 additions & 4 deletions src/drmingw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ target_compile_definitions (drmingw PRIVATE
VERSION="${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
)

add_dependencies (drmingw mgwhelp_implib)

target_link_libraries (drmingw
target_link_libraries (drmingw PRIVATE
common
mgwhelp_implib
mgwhelp
)

install (TARGETS drmingw RUNTIME DESTINATION bin)
20 changes: 2 additions & 18 deletions src/exchndl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
if (CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_C_COMPILER_ID STREQUAL GNU)
# Build import library separately, to deal with MinGW issues

add_library (exchndl MODULE exchndl32exp.def)

set (EXCHNDL_IMPLIB ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libexchndl.dll.a)
add_custom_command (
OUTPUT ${EXCHNDL_IMPLIB}
COMMAND ${CMAKE_DLLTOOL} --output-lib ${EXCHNDL_IMPLIB} --dllname exchndl.dll --kill-at --input-def ${CMAKE_CURRENT_SOURCE_DIR}/exchndl32imp.def
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/exchndl32imp.def
)
add_custom_target (libexchndl_implib DEPENDS exchndl ${EXCHNDL_IMPLIB})
add_library (exchndl_implib INTERFACE IMPORTED GLOBAL)
target_link_libraries (exchndl_implib INTERFACE ${EXCHNDL_IMPLIB})
install (FILES ${EXCHNDL_IMPLIB} DESTINATION lib)
add_library (exchndl SHARED exchndl32.def)
else ()
add_library (exchndl SHARED exchndl64.def)
add_library (exchndl_implib ALIAS exchndl)
endif ()

target_sources (exchndl PRIVATE
exchndl.cpp
version.rc
)

add_dependencies (exchndl mgwhelp_implib)

target_link_libraries (exchndl PRIVATE
common
mgwhelp_implib
mgwhelp
)

set_target_properties (exchndl PROPERTIES
Expand Down
6 changes: 6 additions & 0 deletions src/exchndl/exchndl32.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LIBRARY exchndl.dll

EXPORTS
ExcHndlInit@0 == ExcHndlInit
ExcHndlSetLogFileNameA@4 == ExcHndlSetLogFileNameA
ExcHndlSetLogFileNameW@4 == ExcHndlSetLogFileNameW
6 changes: 0 additions & 6 deletions src/exchndl/exchndl32exp.def

This file was deleted.

6 changes: 0 additions & 6 deletions src/exchndl/exchndl32imp.def

This file was deleted.

17 changes: 2 additions & 15 deletions src/mgwhelp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
if (CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_C_COMPILER_ID STREQUAL GNU)
# Build import library separately, to deal with MinGW issues

add_library (mgwhelp MODULE mgwhelp32exp.def)

set (MGWHELP_IMPLIB ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libmgwhelp.dll.a)
add_custom_command (
OUTPUT ${MGWHELP_IMPLIB}
COMMAND ${CMAKE_DLLTOOL} --output-lib ${MGWHELP_IMPLIB} --dllname mgwhelp.dll --kill-at --input-def ${CMAKE_CURRENT_SOURCE_DIR}/mgwhelp32imp.def
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/mgwhelp32imp.def
)
add_custom_target (libmgwhelp_implib DEPENDS mgwhelp ${MGWHELP_IMPLIB})
add_library (mgwhelp_implib INTERFACE IMPORTED GLOBAL)
target_link_libraries (mgwhelp_implib INTERFACE ${MGWHELP_IMPLIB})
install (FILES ${MGWHELP_IMPLIB} DESTINATION lib)
add_library (mgwhelp SHARED mgwhelp32.def)
else ()
add_library (mgwhelp SHARED mgwhelp64.def)
add_library (mgwhelp_implib ALIAS mgwhelp)
endif ()

target_sources (mgwhelp PRIVATE
Expand All @@ -29,6 +15,7 @@ target_link_libraries (mgwhelp PRIVATE
common
dwarf
libiberty
PUBLIC
dbghelp
)

Expand Down
108 changes: 108 additions & 0 deletions src/mgwhelp/mgwhelp32.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
EXPORTS
SymInitialize@12 = MgwSymInitialize@12 == SymInitialize
SymInitializeW@12 = MgwSymInitializeW@12 == SymInitializeW
SymCleanup@4 = MgwSymCleanup@4 == SymCleanup
SymSetOptions@4 = MgwSymSetOptions@4 == SymSetOptions
SymFromAddr@20 = MgwSymFromAddr@20 == SymFromAddr
SymFromAddrW@20 = MgwSymFromAddrW@20 == SymFromAddrW
SymGetLineFromAddr64@20 = MgwSymGetLineFromAddr64@20 == SymGetLineFromAddr64
SymGetLineFromAddrW64@20 = MgwSymGetLineFromAddrW64@20 == SymGetLineFromAddrW64
SymLoadModuleEx@36 = MgwSymLoadModuleEx@36 == SymLoadModuleEx
SymLoadModuleExW@36 = MgwSymLoadModuleExW@36 == SymLoadModuleExW
UnDecorateSymbolName@16 = MgwUnDecorateSymbolName@16 == UnDecorateSymbolName

EnumDirTree = dbghelp.EnumDirTree
EnumDirTreeW = dbghelp.EnumDirTreeW
EnumerateLoadedModules = dbghelp.EnumerateLoadedModules
EnumerateLoadedModules64 = dbghelp.EnumerateLoadedModules64
EnumerateLoadedModulesW64 = dbghelp.EnumerateLoadedModulesW64
ExtensionApiVersion = dbghelp.ExtensionApiVersion
FindDebugInfoFile = dbghelp.FindDebugInfoFile
FindDebugInfoFileEx = dbghelp.FindDebugInfoFileEx
FindExecutableImage = dbghelp.FindExecutableImage
FindExecutableImageEx = dbghelp.FindExecutableImageEx
FindExecutableImageExW = dbghelp.FindExecutableImageExW
GetTimestampForLoadedLibrary = dbghelp.GetTimestampForLoadedLibrary
ImageDirectoryEntryToData = dbghelp.ImageDirectoryEntryToData
ImageDirectoryEntryToDataEx = dbghelp.ImageDirectoryEntryToDataEx
ImageNtHeader = dbghelp.ImageNtHeader
ImageRvaToSection = dbghelp.ImageRvaToSection
ImageRvaToVa = dbghelp.ImageRvaToVa
ImagehlpApiVersion = dbghelp.ImagehlpApiVersion
ImagehlpApiVersionEx = dbghelp.ImagehlpApiVersionEx
MakeSureDirectoryPathExists = dbghelp.MakeSureDirectoryPathExists
MapDebugInformation = dbghelp.MapDebugInformation
MiniDumpReadDumpStream = dbghelp.MiniDumpReadDumpStream
MiniDumpWriteDump = dbghelp.MiniDumpWriteDump
SearchTreeForFile = dbghelp.SearchTreeForFile
SearchTreeForFileW = dbghelp.SearchTreeForFileW
StackWalk = dbghelp.StackWalk
StackWalk64 = dbghelp.StackWalk64
SymAddSymbol = dbghelp.SymAddSymbol
SymAddSymbolW = dbghelp.SymAddSymbolW
SymEnumLines = dbghelp.SymEnumLines
SymEnumSourceFiles = dbghelp.SymEnumSourceFiles
SymEnumSymbols = dbghelp.SymEnumSymbols
SymEnumSymbolsW = dbghelp.SymEnumSymbolsW
SymEnumTypes = dbghelp.SymEnumTypes
SymEnumTypesW = dbghelp.SymEnumTypesW
SymEnumerateModules = dbghelp.SymEnumerateModules
SymEnumerateModules64 = dbghelp.SymEnumerateModules64
SymEnumerateModulesW64 = dbghelp.SymEnumerateModulesW64
SymEnumerateSymbols = dbghelp.SymEnumerateSymbols
SymEnumerateSymbols64 = dbghelp.SymEnumerateSymbols64
SymFindFileInPath = dbghelp.SymFindFileInPath
SymFindFileInPathW = dbghelp.SymFindFileInPathW
SymFromName = dbghelp.SymFromName
SymFunctionTableAccess = dbghelp.SymFunctionTableAccess
SymFunctionTableAccess64 = dbghelp.SymFunctionTableAccess64
SymGetLineFromAddr = dbghelp.SymGetLineFromAddr
SymGetLineNext = dbghelp.SymGetLineNext
SymGetLineNext64 = dbghelp.SymGetLineNext64
SymGetLinePrev = dbghelp.SymGetLinePrev
SymGetLinePrev64 = dbghelp.SymGetLinePrev64
SymGetModuleBase = dbghelp.SymGetModuleBase
SymGetModuleBase64 = dbghelp.SymGetModuleBase64
SymGetModuleInfo = dbghelp.SymGetModuleInfo
SymGetModuleInfo64 = dbghelp.SymGetModuleInfo64
SymGetModuleInfoW = dbghelp.SymGetModuleInfoW
SymGetModuleInfoW64 = dbghelp.SymGetModuleInfoW64
SymGetOptions = dbghelp.SymGetOptions
SymGetSearchPath = dbghelp.SymGetSearchPath
SymGetSearchPathW = dbghelp.SymGetSearchPathW
SymGetSourceFileToken = dbghelp.SymGetSourceFileToken
SymGetSourceFileTokenW = dbghelp.SymGetSourceFileTokenW
SymGetSymFromAddr = dbghelp.SymGetSymFromAddr
SymGetSymFromAddr64 = dbghelp.SymGetSymFromAddr64
SymGetSymFromName = dbghelp.SymGetSymFromName
SymGetSymFromName64 = dbghelp.SymGetSymFromName64
SymGetSymNext = dbghelp.SymGetSymNext
SymGetSymNext64 = dbghelp.SymGetSymNext64
SymGetSymPrev = dbghelp.SymGetSymPrev
SymGetSymPrev64 = dbghelp.SymGetSymPrev64
SymGetTypeFromName = dbghelp.SymGetTypeFromName
SymGetTypeInfo = dbghelp.SymGetTypeInfo
SymLoadModule = dbghelp.SymLoadModule
SymLoadModule64 = dbghelp.SymLoadModule64
SymMatchFileName = dbghelp.SymMatchFileName
SymMatchFileNameW = dbghelp.SymMatchFileNameW
SymMatchString = dbghelp.SymMatchString
SymRefreshModuleList = dbghelp.SymRefreshModuleList
SymRegisterCallback = dbghelp.SymRegisterCallback
SymRegisterCallback64 = dbghelp.SymRegisterCallback64
SymRegisterCallbackW64 = dbghelp.SymRegisterCallbackW64
SymRegisterFunctionEntryCallback = dbghelp.SymRegisterFunctionEntryCallback
SymRegisterFunctionEntryCallback64 = dbghelp.SymRegisterFunctionEntryCallback64
SymSearch = dbghelp.SymSearch
SymSearchW = dbghelp.SymSearchW
SymSetContext = dbghelp.SymSetContext
SymSetParentWindow = dbghelp.SymSetParentWindow
SymSetScopeFromAddr = dbghelp.SymSetScopeFromAddr
SymSetSearchPath = dbghelp.SymSetSearchPath
SymSetSearchPathW = dbghelp.SymSetSearchPathW
SymUnDName = dbghelp.SymUnDName
SymUnDName64 = dbghelp.SymUnDName64
SymUnloadModule = dbghelp.SymUnloadModule
SymUnloadModule64 = dbghelp.SymUnloadModule64
UnmapDebugInformation = dbghelp.UnmapDebugInformation
WinDbgExtensionDllInit = dbghelp.WinDbgExtensionDllInit
108 changes: 0 additions & 108 deletions src/mgwhelp/mgwhelp32exp.def

This file was deleted.

Loading

0 comments on commit 61f2782

Please sign in to comment.