- Add rostests to build when the folder exists.
- Alter the importlib target macro to handle definition files along with spec files.

svn path=/branches/cmake-bringup/; revision=50101
This commit is contained in:
Amine Khaldi 2010-12-22 16:37:32 +00:00
parent 88a37f9ee8
commit bec9e0bfa6
4 changed files with 33 additions and 14 deletions

View file

@ -142,6 +142,7 @@ add_subdirectory(drivers)
add_subdirectory(hal) add_subdirectory(hal)
add_subdirectory(lib) add_subdirectory(lib)
add_subdirectory(media) add_subdirectory(media)
add_subdirectory(modules)
add_subdirectory(ntoskrnl) add_subdirectory(ntoskrnl)
add_subdirectory(subsystems) add_subdirectory(subsystems)

View file

@ -192,23 +192,37 @@ macro(add_importlibs MODULE)
endforeach() endforeach()
endmacro() endmacro()
macro(add_importlib_target _spec_file) macro(add_importlib_target _exports_file)
get_filename_component(_name ${_spec_file} NAME_WE)
get_filename_component(_name ${_exports_file} NAME_WE)
get_filename_component(_extension ${_exports_file} EXT)
if (${_extension} STREQUAL ".spec")
if (${ARGC} GREATER 1)
set(DLLNAME_OPTION "-n=${ARGV1}")
else()
set(DLLNAME_OPTION "")
endif()
if (${ARGC} GREATER 1) add_custom_command(
set(DLLNAME_OPTION "-n=${ARGV1}") OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
COMMAND native-spec2def ${DLLNAME_OPTION} -d=${CMAKE_CURRENT_BINARY_DIR}/${_name}.def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_BINARY_DIR}/${_name}.def --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
elseif(${_extension} STREQUAL ".def")
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
else() else()
set(DLLNAME_OPTION "") message(FATAL_ERROR "Unsupported exports file extension: ${_extension}")
endif() endif()
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
COMMAND native-spec2def ${DLLNAME_OPTION} -d=${CMAKE_CURRENT_BINARY_DIR}/${_name}.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_BINARY_DIR}/${_name}.def --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
add_custom_target( add_custom_target(
lib${_name} lib${_name}
DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a) DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a)
endmacro() endmacro()
macro(spec2def _dllname _spec_file) macro(spec2def _dllname _spec_file)

4
modules/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rostests/)
add_subdirectory(rostests)
endif()

View file

@ -139,14 +139,14 @@ set(IDL_PROXY_ARG /proxy)
set(IDL_DLLDATA_ARG /dlldata ) set(IDL_DLLDATA_ARG /dlldata )
# Thanks MS for creating a stupid linker # Thanks MS for creating a stupid linker
macro(add_importlib_target _spec_file) macro(add_importlib_target _exports_file)
get_filename_component(_name ${_spec_file} NAME_WE) get_filename_component(_name ${_exports_file} NAME_WE)
# Generate the asm stub file and the export def file # Generate the asm stub file and the export def file
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
COMMAND native-spec2def -@ -r -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} COMMAND native-spec2def -@ -r -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
# Assemble the stub file # Assemble the stub file
add_custom_command( add_custom_command(