mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 14:28:29 +00:00
[SPEC2DEF] Implement support for debug-only exports
This commit is contained in:
parent
93ba586ec3
commit
dc25409cbf
3 changed files with 27 additions and 4 deletions
|
@ -373,11 +373,16 @@ function(fixup_load_config _target)
|
||||||
DEPENDS native-pefixup)
|
DEPENDS native-pefixup)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
|
||||||
|
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(__spec2def_dbg_arg "--dbg")
|
||||||
|
endif()
|
||||||
|
|
||||||
function(generate_import_lib _libname _dllname _spec_file __version_arg)
|
function(generate_import_lib _libname _dllname _spec_file __version_arg)
|
||||||
# Generate the def for the import lib
|
# Generate the def for the import lib
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def
|
||||||
COMMAND native-spec2def ${__version_arg} -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
COMMAND native-spec2def ${__version_arg} ${__spec2def_dbg_arg} -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
||||||
|
|
||||||
# With this, we let DLLTOOL create an import library
|
# With this, we let DLLTOOL create an import library
|
||||||
|
@ -450,7 +455,7 @@ function(spec2def _dllname _spec_file)
|
||||||
# Generate exports def and C stubs file for the DLL
|
# Generate exports def and C stubs file for the DLL
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
|
||||||
COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${__spec2def_dbg_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
||||||
|
|
||||||
# Do not use precompiled headers for the stub file
|
# Do not use precompiled headers for the stub file
|
||||||
|
|
|
@ -332,6 +332,11 @@ function(fixup_load_config _target)
|
||||||
# msvc knows how to generate a load_config so no hacks here
|
# msvc knows how to generate a load_config so no hacks here
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
|
||||||
|
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(__spec2def_dbg_arg "--dbg")
|
||||||
|
endif()
|
||||||
|
|
||||||
function(generate_import_lib _libname _dllname _spec_file __version_arg)
|
function(generate_import_lib _libname _dllname _spec_file __version_arg)
|
||||||
|
|
||||||
set(_def_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def)
|
set(_def_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def)
|
||||||
|
@ -341,7 +346,7 @@ function(generate_import_lib _libname _dllname _spec_file __version_arg)
|
||||||
# Generate the def, asm stub and alias files
|
# Generate the def, asm stub and alias files
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${_asm_stubs_file} ${_def_file} ${_asm_impalias_file}
|
OUTPUT ${_asm_stubs_file} ${_def_file} ${_asm_impalias_file}
|
||||||
COMMAND native-spec2def --ms ${__version_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} -i=${_asm_impalias_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
COMMAND native-spec2def --ms ${__version_arg} ${__spec2def_dbg_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} -i=${_asm_impalias_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
||||||
|
|
||||||
# Compile the generated asm stub file
|
# Compile the generated asm stub file
|
||||||
|
@ -414,7 +419,7 @@ function(spec2def _dllname _spec_file)
|
||||||
# Generate exports def and C stubs file for the DLL
|
# Generate exports def and C stubs file for the DLL
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
|
||||||
COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${__spec2def_dbg_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
|
||||||
|
|
||||||
# Do not use precompiled headers for the stub file
|
# Do not use precompiled headers for the stub file
|
||||||
|
|
|
@ -67,6 +67,7 @@ int gbImportLib = 0;
|
||||||
int gbNotPrivateNoWarn = 0;
|
int gbNotPrivateNoWarn = 0;
|
||||||
int gbTracing = 0;
|
int gbTracing = 0;
|
||||||
int giArch = ARCH_X86;
|
int giArch = ARCH_X86;
|
||||||
|
int gbDbgExports = 0;
|
||||||
char *pszArchString = "i386";
|
char *pszArchString = "i386";
|
||||||
char *pszArchString2;
|
char *pszArchString2;
|
||||||
char *pszSourceFileName = NULL;
|
char *pszSourceFileName = NULL;
|
||||||
|
@ -1162,6 +1163,13 @@ ParseFile(char* pcStart, FILE *fileDest, unsigned *cExports)
|
||||||
|
|
||||||
} while (*pc == ',');
|
} while (*pc == ',');
|
||||||
}
|
}
|
||||||
|
else if (CompareToken(pc, "-dbg"))
|
||||||
|
{
|
||||||
|
if (!gbDbgExports)
|
||||||
|
{
|
||||||
|
included = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (CompareToken(pc, "-private"))
|
else if (CompareToken(pc, "-private"))
|
||||||
{
|
{
|
||||||
exp.uFlags |= FL_PRIVATE;
|
exp.uFlags |= FL_PRIVATE;
|
||||||
|
@ -1505,6 +1513,7 @@ void usage(void)
|
||||||
" -s=<file> generate a stub file\n"
|
" -s=<file> generate a stub file\n"
|
||||||
" -i=<file> generate an import alias file\n"
|
" -i=<file> generate an import alias file\n"
|
||||||
" --ms MSVC compatibility\n"
|
" --ms MSVC compatibility\n"
|
||||||
|
" --dbg Enable debug exports\n"
|
||||||
" -n=<name> name of the dll\n"
|
" -n=<name> name of the dll\n"
|
||||||
" --version=<version> Sets the version to create exports for\n"
|
" --version=<version> Sets the version to create exports for\n"
|
||||||
" --implib generate a def file for an import library\n"
|
" --implib generate a def file for an import library\n"
|
||||||
|
@ -1571,6 +1580,10 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
gbMSComp = 1;
|
gbMSComp = 1;
|
||||||
}
|
}
|
||||||
|
else if (strcasecmp(argv[i], "--dbg") == 0)
|
||||||
|
{
|
||||||
|
gbDbgExports = 1;
|
||||||
|
}
|
||||||
else if (strcasecmp(argv[i], "--no-private-warnings") == 0)
|
else if (strcasecmp(argv[i], "--no-private-warnings") == 0)
|
||||||
{
|
{
|
||||||
gbNotPrivateNoWarn = 1;
|
gbNotPrivateNoWarn = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue