Refactor IDL compilation:
- Move all macros to idl-support.cmake
- Make rpc proxy a static library, instead of fiddeling with SOURCE variable
- Merge client and server rpc libraries into one library
- Reorder global makelist file a little
- Improve configure script
- Improve naming, use add_* when a target is added, generate_* when only a file is generated
- Don't compile wbemcli.idl on MSVC (temp hack)
- Don't compile rossym on MSVC, we don't use it
- Use ml64 as assembler when compiling for amd64
- fix spec2def invocation

svn path=/branches/cmake-bringup/; revision=50478
This commit is contained in:
Timo Kreuzer 2011-01-24 18:13:40 +00:00
parent 256c5c72c0
commit 0d54e35b94
36 changed files with 265 additions and 254 deletions

View file

@ -8,6 +8,14 @@ include(include/reactos/version.cmake)
# Don't escape preprocessor definition values added via add_definitions
cmake_policy(SET CMP0005 OLD)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
set(CMAKE_COLOR_MAKEFILE OFF)
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
if(NOT ARCH)
set(ARCH i386)
endif()
@ -22,6 +30,8 @@ elseif(ARCH MATCHES arm)
include(config-arm.cmake)
endif()
add_definitions(-D__REACTOS__)
if(NOT CMAKE_CROSSCOMPILING)
add_definitions(-DTARGET_${ARCH})
@ -51,41 +61,7 @@ if(NOT CMAKE_CROSSCOMPILING)
else()
if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
endif()
set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
include(${IMPORT_EXECUTABLES})
endif()
# Compiler specific definitions and macros
if(MSVC)
include(msc.cmake)
else()
include(gcc.cmake)
endif()
# Generic macros
include(CMakeMacros.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
set(CMAKE_COLOR_MAKEFILE OFF)
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
add_definitions(-D__REACTOS__)
if(CMAKE_CROSSCOMPILING)
#Some cleanup
# Do some cleanup
file(REMOVE
${REACTOS_BINARY_DIR}/dependencies.graphml
${REACTOS_BINARY_DIR}/boot/ros_livecd.txt
@ -95,6 +71,26 @@ if(CMAKE_CROSSCOMPILING)
${REACTOS_BINARY_DIR}/boot/ros_cab.txt
${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
endif()
set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables")
include(${IMPORT_EXECUTABLES})
# Compiler specific definitions and macros
if(MSVC)
include(msc.cmake)
else()
include(gcc.cmake)
endif()
# Generic macros
include(CMakeMacros.cmake)
# IDL macros for widl/midl
include(cmake/idl-support.cmake)
#Some useful variables
set(LIVECD_DIR "${REACTOS_BINARY_DIR}/boot/livecd")
set(BOOTCD_DIR "${REACTOS_BINARY_DIR}/boot/bootcd")
@ -118,7 +114,11 @@ if(CMAKE_CROSSCOMPILING)
endif()
# Version Options
add_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502 -D_WIN32_WINDOWS=0x502 -D_SETUPAPI_VER=0x502)
add_definitions(-DWINVER=0x502
-D_WIN32_IE=0x600
-D_WIN32_WINNT=0x502
-D_WIN32_WINDOWS=0x502
-D_SETUPAPI_VER=0x502)
# Arch Options
if(ARCH MATCHES i386)

View file

@ -32,40 +32,6 @@ endmacro()
endif()
macro(idl_compile_object OBJECT SOURCE)
get_property(FLAGS SOURCE ${SOURCE} PROPERTY COMPILE_FLAGS)
get_property(DEFINES SOURCE ${SOURCE} PROPERTY COMPILE_DEFINITIONS)
get_property(INCLUDE_DIRECTORIES DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
foreach(DIR ${INCLUDE_DIRECTORIES})
set(FLAGS "${FLAGS} -I${DIR}")
endforeach()
set(IDL_COMMAND ${CMAKE_IDL_COMPILE_OBJECT})
string(REPLACE "<CMAKE_IDL_COMPILER>" "${CMAKE_IDL_COMPILER}" IDL_COMMAND "${IDL_COMMAND}")
string(REPLACE <FLAGS> "${FLAGS}" IDL_COMMAND "${IDL_COMMAND}")
string(REPLACE "<DEFINES>" "${DEFINES}" IDL_COMMAND "${IDL_COMMAND}")
string(REPLACE "<OBJECT>" "${OBJECT}" IDL_COMMAND "${IDL_COMMAND}")
string(REPLACE "<SOURCE>" "${SOURCE}" IDL_COMMAND "${IDL_COMMAND}")
separate_arguments(IDL_COMMAND)
add_custom_command(
OUTPUT ${OBJECT}
COMMAND ${IDL_COMMAND}
DEPENDS ${SOURCE}
VERBATIM)
endmacro()
macro(add_interface_definitions TARGET)
foreach(SOURCE ${ARGN})
get_filename_component(FILE ${SOURCE} NAME_WE)
set(OBJECT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.h)
idl_compile_object(${OBJECT} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE})
list(APPEND OBJECTS ${OBJECT})
endforeach()
add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
endmacro()
macro(add_minicd_target _targetname _dir) # optional parameter: _nameoncd
if("${ARGN}" STREQUAL "")
get_target_property(FILENAME ${_targetname} LOCATION)
@ -151,97 +117,6 @@ macro(add_cab FILENAME _num)
add_livecd(${FILENAME} ${_dir})
endmacro()
macro(custom_incdefs)
if(NOT DEFINED result_incs) #rpc_defines
get_directory_property(rpc_defines COMPILE_DEFINITIONS)
get_directory_property(rpc_includes INCLUDE_DIRECTORIES)
foreach(arg ${rpc_defines})
set(result_defs ${result_defs} -D${arg})
endforeach()
foreach(arg ${rpc_includes})
set(result_incs -I${arg} ${result_incs})
endforeach()
endif()
endmacro()
macro(rpcproxy TARGET)
custom_incdefs()
list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c)
foreach(_in_FILE ${ARGN})
get_filename_component(FILE ${_in_FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c
COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} ${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h ${IDL_PROXY_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c
PROPERTIES GENERATED TRUE)
list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)
list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl)
endforeach()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c
COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} ${IDL_DLLDATA_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c ${IDLS}
DEPENDS ${IDLS})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c
PROPERTIES GENERATED TRUE)
endmacro()
macro(idl_files)
custom_incdefs()
foreach(_in_FILE ${ARGN})
get_filename_component(FILE ${_in_FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c
COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${IDL_SERVER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl
DEPENDS ${_in_file})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c
PROPERTIES GENERATED TRUE)
add_library(${FILE}_server ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c)
add_dependencies(${FILE}_server psdk)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c
COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${IDL_CLIENT_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl
DEPENDS ${_in_file})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c
PROPERTIES GENERATED TRUE)
add_library(${FILE}_client ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c)
add_dependencies(${FILE}_client psdk)
endforeach()
endmacro()
macro(add_typelib TARGET)
custom_incdefs()
foreach(SOURCE ${ARGN})
get_filename_component(FILE ${SOURCE} NAME_WE)
set(OBJECT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb
COMMAND ${IDL_COMPILER} ${result_incs} ${IDL_FLAGS} ${IDL_TYPELIB_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
DEPENDS ${SOURCE})
list(APPEND OBJECTS ${OBJECT})
endforeach()
add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
endmacro()
macro(add_idl_interface IDL_FILE)
custom_incdefs()
get_filename_component(FILE ${IDL_FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c
COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} ${IDL_INTERFACE_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}
DEPENDS ${IDL_FILE})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${FILE}_i.c PROPERTIES GENERATED TRUE)
endmacro()
macro(add_dependency_node _node)
if(GENERATE_DEPENDENCY_GRAPH)
get_target_property(_type ${_node} TYPE)

View file

@ -12,7 +12,7 @@ list(APPEND SOURCE
add_executable(eventlog ${CMAKE_CURRENT_BINARY_DIR}/eventlog_eventlog.h.gch ${SOURCE})
target_link_libraries(eventlog eventlogrpc_server ${PSEH_LIB})
target_link_libraries(eventlog eventlogrpc ${PSEH_LIB})
add_pch(eventlog ${CMAKE_CURRENT_SOURCE_DIR}/eventlog.h ${SOURCE})

View file

@ -12,7 +12,7 @@ include_directories(${REACTOS_BINARY_DIR}/include/reactos/wine)
add_executable(rpcss ${SOURCE})
target_link_libraries(rpcss epm_server irot_server ${PSEH_LIB} wine)
target_link_libraries(rpcss epmrpc irotrpc ${PSEH_LIB} wine)
set_module_type(rpcss win32cui)

View file

@ -7,7 +7,7 @@ remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
add_executable(umpnpmgr umpnpmgr.c umpnpmgr.rc)
target_link_libraries(umpnpmgr pnp_server wdmguid ${PSEH_LIB})
target_link_libraries(umpnpmgr pnprpc wdmguid ${PSEH_LIB})
set_module_type(umpnpmgr win32cui)
add_importlibs(umpnpmgr advapi32 rpcrt4 userenv msvcrt kernel32 ntdll)

View file

@ -4,7 +4,7 @@ include_directories(${REACTOS_BINARY_DIR}/include/reactos/idl)
add_executable(wlansvc wlansvc.c rpcserver.c)
target_link_libraries(wlansvc wlansvc_server ${PSEH_LIB})
target_link_libraries(wlansvc wlansvcrpc ${PSEH_LIB})
set_module_type(wlansvc win32cui)
add_importlibs(wlansvc advapi32 rpcrt4 iphlpapi msvcrt kernel32 ntdll)

View file

@ -17,7 +17,7 @@ list(APPEND SOURCE
add_executable(services ${CMAKE_CURRENT_BINARY_DIR}/services_services.h.gch ${SOURCE})
target_link_libraries(services
svcctl_server
svcctlrpc
${PSEH_LIB})
add_pch(services ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${SOURCE})

151
cmake/idl-support.cmake Normal file
View file

@ -0,0 +1,151 @@
#idl files support
if(MSVC)
set(IDL_COMPILER midl)
set(IDL_HEADER_ARG /h) #.h
set(IDL_HEADER_ARG2 /h) #.h
set(IDL_TYPELIB_ARG /tlb) #.tlb
set(IDL_SERVER_ARG /sstub) #.c for stub server library
set(IDL_CLIENT_ARG /cstub) #.c for stub client library
set(IDL_PROXY_ARG /proxy)
set(IDL_INTERFACE_ARG /iid)
if(ARCH MATCHES i386)
set(IDL_FLAGS /win32)
elseif(ARCH MATCHES amd64)
set(IDL_FLAGS /amd64)
else()
set(IDL_FLAGS "")
endif()
else()
set(IDL_COMPILER native-widl)
set(IDL_HEADER_ARG -h -o) #.h
set(IDL_HEADER_ARG2 -h -H) #.h
set(IDL_TYPELIB_ARG -t -o) #.tlb
set(IDL_SERVER_ARG -s -S) #.c for server library
set(IDL_CLIENT_ARG -c -C) #.c for stub client library
set(IDL_PROXY_ARG -p -P)
set(IDL_INTERFACE_ARG -u -o)
if(ARCH MATCHES i386)
set(IDL_FLAGS -m32 --win32)
elseif(ARCH MATCHES amd64)
set(IDL_FLAGS -m64 --win64)
else()
set(IDL_FLAGS "")
endif()
endif()
macro(get_includes OUTPUT_VAR)
get_directory_property(_includes INCLUDE_DIRECTORIES)
foreach(arg ${_includes})
set(${OUTPUT_VAR} -I${arg} ${${OUTPUT_VAR}})
endforeach()
endmacro()
macro(get_defines OUTPUT_VAR)
get_directory_property(_defines COMPILE_DEFINITIONS)
foreach(arg ${_defines})
set(${OUTPUT_VAR} ${${OUTPUT_VAR}} -D${arg})
endforeach()
endmacro()
macro(add_typelib TARGET)
get_includes(INCLUDES)
get_defines(DEFINES)
foreach(FILE ${ARGN})
get_filename_component(NAME ${FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_TYPELIB_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
list(APPEND OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb)
endforeach()
add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
endmacro()
macro(add_idl_headers TARGET)
get_includes(INCLUDES)
get_defines(DEFINES)
foreach(FILE ${ARGN})
get_filename_component(NAME ${FILE} NAME_WE)
set(HEADER ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
list(APPEND HEADERS ${HEADER})
endforeach()
add_custom_target(${TARGET} ALL DEPENDS ${HEADERS})
endmacro()
macro(add_rpcproxy_library TARGET)
get_includes(INCLUDES)
get_defines(DEFINES)
foreach(FILE ${ARGN})
get_filename_component(NAME ${FILE} NAME_WE)
if(MSVC)
set(IDL_DLLDATA_ARG /dlldata ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c)
else()
set(IDL_DLLDATA_ARG "")
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h ${IDL_PROXY_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${IDL_DLLDATA_ARG} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c
PROPERTIES GENERATED TRUE)
list(APPEND rpcproxy_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c)
list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.idl)
endforeach()
if(NOT MSVC)
# Extra pass to generate dlldata for widl
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} --dlldata-only -o ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c ${IDLS}
DEPENDS ${IDLS})
endif()
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c
PROPERTIES GENERATED TRUE)
add_library(${TARGET} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c ${rpcproxy_SOURCES})
endmacro()
macro(add_rpc_library TARGET)
get_includes(INCLUDES)
get_defines(DEFINES)
foreach(FILE ${ARGN})
get_filename_component(NAME ${FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h ${IDL_SERVER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c
PROPERTIES GENERATED TRUE)
list(APPEND server_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${IDL_CLIENT_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c
PROPERTIES GENERATED TRUE)
list(APPEND client_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c)
endforeach()
add_library(${TARGET} ${server_SOURCES} ${client_SOURCES})
add_dependencies(${TARGET} psdk)
endmacro()
macro(generate_idl_iids IDL_FILE)
get_includes(INCLUDES)
get_defines(DEFINES)
get_filename_component(NAME ${IDL_FILE} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_INTERFACE_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c PROPERTIES GENERATED TRUE)
endmacro()

View file

@ -11,10 +11,12 @@ if not "%ROS_ARCH%" == "" (
)
if not "%DDK_TARGET_OS%" == "" (
echo Detected DDK/WDK for %_BUILDARCH%
set ARCH=%_BUILDARCH%
if "%_BUILDARCH%" == "x86" (
set ARCH=i386
)
if "%_BUILDARCH%" == "AMD64" (
set ARCH=amd64
)
set BUILD_ENVIRONMENT=WDK
)
@ -25,7 +27,9 @@ if not exist host-tools (
mkdir host-tools
)
cd host-tools
del CMakeCache.txt /q
if EXIST CMakeCache.txt (
del CMakeCache.txt /q
)
set REACTOS_BUILD_TOOLS_DIR=%CD%
if "%BUILD_ENVIRONMENT%" == "MINGW" (
cmake -G "MinGW Makefiles" -DARCH=%ARCH% %ROS_SOURCE_DIR%
@ -41,7 +45,9 @@ if not exist reactos (
)
cd reactos
del CMakeCache.txt /q
if EXIST CMakeCache.txt (
del CMakeCache.txt /q
)
if "%BUILD_ENVIRONMENT%" == "MINGW" (
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %ROS_SOURCE_DIR%
)

View file

@ -14,7 +14,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(quartz.dll quartz.spec)
rpcproxy(quartz quartz_strmif.idl)
add_rpcproxy_library(quartzproxy quartz_strmif.idl)
list(APPEND SOURCE
avidec.c
@ -49,6 +49,7 @@ add_library(quartz SHARED ${SOURCE})
set_module_type(quartz win32dll)
target_link_libraries(quartz
quartzproxy
strmiids
uuid
wine

View file

@ -4,7 +4,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(actxprxy.dll actxprxy.spec)
rpcproxy(actxprxy
add_rpcproxy_library(actxprxylib
actxprxy_activscp.idl
actxprxy_comcat.idl
actxprxy_docobj.idl
@ -25,6 +25,7 @@ add_library(actxprxy SHARED ${SOURCE})
set_entrypoint(actxprxy 0)
target_link_libraries(actxprxy
actxprxylib
uuid
wine
${PSEH_LIB})

View file

@ -52,9 +52,9 @@ add_library(advapi32 SHARED
set_module_type(advapi32 win32dll)
target_link_libraries(advapi32
svcctl_client
lsa_client
eventlogrpc_client
svcctlrpc
lsarpc
eventlogrpc
wine
${PSEH_LIB})

View file

@ -6,7 +6,7 @@ add_definitions(-D_WIN32_WINNT=0x600)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_interface_definitions(atl_atliface_header atliface.idl)
add_idl_headers(atl_atliface_header atliface.idl)
set_rc_compiler()
spec2def(atl.dll atl.spec)

View file

@ -23,7 +23,7 @@ add_library(lsasrv SHARED ${SOURCE})
set_entrypoint(lsasrv 0)
target_link_libraries(lsasrv
lsa_server
lsarpc
wine
${PSEH_LIB})

View file

@ -9,7 +9,7 @@ add_definitions(
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_interface_definitions(mshtml_nsiface_header nsiface.idl)
add_idl_Headers(mshtml_nsiface_header nsiface.idl)
set_rc_compiler()

View file

@ -7,7 +7,7 @@ add_definitions(-D_WIN32_WINNT=0x600)
spec2def(msi.dll msi.spec)
add_idl_interface(msiserver.idl)
generate_idl_iids(msiserver.idl)
list(APPEND SOURCE
action.c
@ -60,7 +60,7 @@ list(APPEND SOURCE
add_library(msi SHARED ${SOURCE})
add_interface_definitions(msi_idlheader msiserver.idl)
add_idl_Headers(msi_idlheader msiserver.idl)
add_typelib(msi_tlb msiserver.idl)

View file

@ -9,7 +9,7 @@ add_definitions(-D_WIN32_WINNT=0x600)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_idl_interface(mstask_local.idl)
generate_idl_iids(mstask_local.idl)
spec2def(mstask.dll mstask.spec)

View file

@ -54,9 +54,9 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_interface_definitions(ole32idl dcom.idl irot.idl)
add_idl_headers(ole32idl dcom.idl irot.idl)
rpcproxy(ole32
add_rpcproxy_library(ole32proxy
dcom.idl
ole32_unknwn.idl
ole32_objidl.idl
@ -69,8 +69,9 @@ add_library(ole32 SHARED ${SOURCE})
set_module_type(ole32 win32dll)
target_link_libraries(ole32
ole32proxy
wine
irot_client
irotrpc
uuid
${PSEH_LIB})

View file

@ -46,13 +46,14 @@ include_directories(
spec2def(oleaut32.dll oleaut32.spec)
rpcproxy(oleaut32 oleaut32_oaidl.idl oleaut32_ocidl.idl)
add_rpcproxy_library(oleaut32proxy oleaut32_oaidl.idl oleaut32_ocidl.idl)
add_library(oleaut32 SHARED ${SOURCE})
set_module_type(oleaut32 win32dll)
target_link_libraries(oleaut32
oleaut32proxy
wine
wineldr
uuid

View file

@ -2,7 +2,7 @@
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_idl_interface(qmgr_local.idl)
generate_idl_iids(qmgr_local.idl)
spec2def(qmgr.dll qmgr.spec)
@ -21,7 +21,7 @@ list(APPEND SOURCE
add_library(qmgr SHARED ${SOURCE})
add_interface_definitions(qmgr_idlheader qmgr_local.idl)
add_idl_headers(qmgr_idlheader qmgr_local.idl)
set_module_type(qmgr win32dll)
target_link_libraries(qmgr uuid wine)

View file

@ -5,7 +5,7 @@ add_definitions(
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_idl_interface(qmgrprxy.idl)
generate_idl_iids(qmgrprxy.idl)
spec2def(qmgrprxy.dll qmgrprxy.spec)
@ -14,11 +14,11 @@ list(APPEND SOURCE
${CMAKE_CURRENT_BINARY_DIR}/qmgrprxy_i.c
${CMAKE_CURRENT_BINARY_DIR}/qmgrprxy.def)
rpcproxy(qmgrprxy qmgrprxy.idl)
add_rpcproxy_library(qmgrprxylib qmgrprxy.idl)
add_library(qmgrprxy SHARED ${SOURCE})
set_module_type(qmgrprxy win32dll)
target_link_libraries(qmgrprxy ${PSEH_LIB} wine)
target_link_libraries(qmgrprxy qmgrprxylib ${PSEH_LIB} wine)
add_importlibs(qmgrprxy rpcrt4 msvcrt kernel32 ntdll)
add_cab_target(qmgrprxy 1)

View file

@ -43,7 +43,7 @@ include_directories(
target_link_libraries(rpcrt4
wine
uuid
epm_client
epmrpc
${PSEH_LIB})
add_importlibs(rpcrt4 msvcrt user32 advapi32 secur32 iphlpapi ws2_32 kernel32 ntdll)

View file

@ -40,7 +40,7 @@ add_library(setupapi SHARED ${SOURCE})
set_module_type(setupapi win32dll)
target_link_libraries(setupapi
pnp_client
pnprpc
uuid
wine
${PSEH_LIB})

View file

@ -12,7 +12,7 @@ include_directories(
${REACTOS_SOURCE_DIR}/lib/recyclebin
${REACTOS_SOURCE_DIR})
add_idl_interface(shobjidl_local.idl)
generate_idl_iids(shobjidl_local.idl)
spec2def(shell32.dll shell32.spec)

View file

@ -18,13 +18,14 @@ list(APPEND SOURCE
sti_main.c
${CMAKE_CURRENT_BINARY_DIR}/sti.def)
rpcproxy(sti sti_wia.idl)
add_rpcproxy_library(stiproxy sti_wia.idl)
add_library(sti SHARED ${SOURCE})
set_entrypoint(sti 0)
target_link_libraries(sti
stiproxy
wine
uuid
${PSEH_LIB})

View file

@ -8,7 +8,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(urlmon.dll urlmon.spec)
rpcproxy(urlmon urlmon_urlmon.idl)
add_rpcproxy_library(urlmonproxy urlmon_urlmon.idl)
list(APPEND SOURCE
bindctx.c
@ -42,6 +42,7 @@ add_library(urlmon SHARED ${SOURCE})
set_module_type(urlmon win32dll)
target_link_libraries(urlmon
urlmonproxy
uuid
wine
${PSEH_LIB})

View file

@ -12,7 +12,7 @@ add_library(wlanapi SHARED ${SOURCE})
set_entrypoint(wlanapi 0)
target_link_libraries(wlanapi
wlansvc_client
wlansvcrpc
wine
${PSEH_LIB})

View file

@ -1,6 +1,4 @@
if(CMAKE_CROSSCOMPILING)
# Linking
if(ARCH MATCHES i386)
link_directories("${REACTOS_SOURCE_DIR}/importlibs")
@ -317,5 +315,3 @@ endmacro()
#pseh lib, needed with mingw
set(PSEH_LIB "pseh")
endif(CMAKE_CROSSCOMPILING)

View file

@ -24,4 +24,4 @@ list(APPEND SOURCE
#vmrender.idl
)
add_interface_definitions(dxsdk ${SOURCE})
add_idl_headers(dxsdk ${SOURCE})

View file

@ -92,7 +92,6 @@ list(APPEND SOURCE
urlmon.idl
vmr9.idl
# vmrender.idl
wbemcli.idl
wia_lh.idl
wia_xp.idl
winsxs.idl
@ -104,10 +103,11 @@ list(APPEND SOURCE
if(NOT MSVC)
list(APPEND SOURCE
wbemcli.idl
wincodec.idl
wuapi.idl)
endif()
add_interface_definitions(psdk ${SOURCE})
add_idl_headers(psdk ${SOURCE})
add_typelib(stdole2 stdole2.idl)

View file

@ -1,15 +1,12 @@
include_directories(.)
list(APPEND SOURCE
eventlogrpc.idl
lsa.idl
svcctl.idl
wlansvc.idl)
idl_files(${SOURCE})
add_rpc_library(eventlogrpc eventlogrpc.idl)
add_rpc_library(lsarpc lsa.idl)
add_rpc_library(svcctlrpc svcctl.idl)
add_rpc_library(wlansvcrpc wlansvc.idl)
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
idl_files(pnp.idl)
add_rpc_library(pnprpc pnp.idl)

View file

@ -1,9 +1,7 @@
add_interface_definitions(wineheaders itss.idl wined3d.idl)
add_idl_headers(wineheaders itss.idl wined3d.idl)
add_idl_headers(winesdk epm.idl irot.idl)
list(APPEND SOURCE
epm.idl
irot.idl)
add_rpc_library(epmrpc epm.idl)
add_rpc_library(irotrpc irot.idl)
idl_files(${SOURCE})
add_interface_definitions(winesdk ${SOURCE})

View file

@ -1,4 +1,5 @@
if(NOT MSVC)
add_definitions(-D_NTSYSTEM_)
list(APPEND SOURCE
delete.c
@ -20,3 +21,4 @@ list(APPEND SOURCE
zwfile.c)
add_library(rossym ${SOURCE})
add_dependencies(rossym psdk bugcodes)
endif()

View file

@ -1,12 +1,4 @@
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
add_definitions(-D__i386__)
endif()
add_definitions(-Dinline=__inline)
if(CMAKE_CROSSCOMPILING)
if(OPTIMIZE STREQUAL "1")
add_definitions(/O1)
elseif(OPTIMIZE STREQUAL "2")
@ -28,6 +20,10 @@ if(${_MACHINE_ARCH_FLAG} MATCHES X86)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
endif()
if(${ARCH} MATCHES amd64)
add_definitions(-D__x86_64)
endif()
link_directories("${REACTOS_BINARY_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)
set(CMAKE_RC_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
@ -137,16 +133,6 @@ macro(set_rc_compiler)
# dummy, this workaround is only needed in mingw due to lack of RC support in cmake
endmacro()
#idl files support
set(IDL_COMPILER midl)
set(IDL_FLAGS /win32)
set(IDL_HEADER_ARG /h) #.h
set(IDL_TYPELIB_ARG /tlb) #.tlb
set(IDL_SERVER_ARG /sstub) #.c for stub server library
set(IDL_CLIENT_ARG /cstub) #.c for stub client library
set(IDL_PROXY_ARG /proxy)
set(IDL_DLLDATA_ARG /dlldata )
# Thanks MS for creating a stupid linker
macro(add_importlib_target _exports_file)
get_filename_component(_name ${_exports_file} NAME_WE)
@ -154,7 +140,7 @@ macro(add_importlib_target _exports_file)
# Generate the asm stub file and the export def file
add_custom_command(
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}/${_exports_file}
COMMAND native-spec2def --kill-at -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}/${_exports_file})
# Assemble the stub file
@ -180,7 +166,7 @@ macro(add_importlib_target _exports_file)
add_custom_target(
lib${_name}
DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib)
add_dependencies(lib${_name} asm ${_dependencies})
endmacro()
@ -195,7 +181,7 @@ macro(spec2def _dllname _spec_file)
get_filename_component(_file ${_spec_file} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
COMMAND native-spec2def -@ -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND native-spec2def --kill-at -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
PROPERTIES GENERATED TRUE)
@ -222,5 +208,3 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)
#pseh workaround
set(PSEH_LIB "")
endif(CMAKE_CROSSCOMPILING)

View file

@ -34,16 +34,6 @@ set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_PREFIX}g++)
set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres)
set(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>")
set(CMAKE_IDL_COMPILER native-widl)
if(ARCH MATCHES i386)
set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -m32 --win32 -h -o <OBJECT> <SOURCE>")
elseif(ARCH MATCHES amd64)
set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -m64 --win64 -h -o <OBJECT> <SOURCE>")
elseif(ARCH MATCHES arm)
set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -h -o <OBJECT> <SOURCE>")
endif()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> <CMAKE_C_LINK_FLAGS> <DEFINES> -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -O coff -o <OBJECT> ")
# Use stdcall fixups, and don't link with anything by default unless we say so

View file

@ -6,12 +6,14 @@ set(CMAKE_SYSTEM_PROCESSOR i686)
# which compilers to use for C and C++
set(CMAKE_C_COMPILER cl)
set(CMAKE_CXX_COMPILER cl)
SET(CMAKE_RC_COMPILER rc)
SET(CMAKE_ASM_COMPILER ml)
SET(CMAKE_IDL_COMPILER midl)
set(CMAKE_RC_COMPILER rc)
if(${ARCH} MATCHES amd64)
set(CMAKE_ASM_COMPILER ml64)
else()
set(CMAKE_ASM_COMPILER ml)
endif()
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <DEFINES> /I${REACTOS_SOURCE_DIR}/include/psdk /I${REACTOS_BINARY_DIR}/include/psdk /I${REACTOS_SOURCE_DIR}/include /I${REACTOS_SOURCE_DIR}/include/reactos /I${REACTOS_BINARY_DIR}/include/reactos /I${REACTOS_SOURCE_DIR}/include/reactos/wine /I${REACTOS_SOURCE_DIR}/include/crt /I${REACTOS_SOURCE_DIR}/include/crt/mingw32 /fo <OBJECT> <SOURCE>")
SET(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> /win32 /Dstrict_context_handle= /h <OBJECT> <SOURCE>")
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <DEFINES> /I${REACTOS_SOURCE_DIR}/include/psdk /I${REACTOS_BINARY_DIR}/include/psdk /I${REACTOS_SOURCE_DIR}/include /I${REACTOS_SOURCE_DIR}/include/reactos /I${REACTOS_BINARY_DIR}/include/reactos /I${REACTOS_SOURCE_DIR}/include/reactos/wine /I${REACTOS_SOURCE_DIR}/include/crt /I${REACTOS_SOURCE_DIR}/include/crt/mingw32 /fo <OBJECT> <SOURCE>")
SET(CMAKE_ASM_COMPILE_OBJECT
"<CMAKE_C_COMPILER> /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
@ -29,3 +31,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_BUILD_TYPE "RelwithDebInfo" CACHE STRING "Build Type")
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
add_definitions(-D__i386__)
endif()