[CMAKE]
[reactos.git] / CMakeMacros.cmake
index b006cca..880555a 100644 (file)
@@ -116,11 +116,17 @@ MACRO(ADD_INTERFACE_DEFINITIONS TARGET)
   ADD_CUSTOM_TARGET(${TARGET} ALL DEPENDS ${OBJECTS})\r
 ENDMACRO()\r
 \r
-MACRO(add_minicd_target _targetname _dir _nameoncd)\r
+MACRO(add_minicd_target _targetname _dir) # optional parameter: _nameoncd\r
     get_target_property(FILENAME ${_targetname} LOCATION)\r
 \r
+    if("${ARGN}" STREQUAL "")\r
+       get_filename_component(_nameoncd ${FILENAME} NAME)\r
+    else()\r
+       set(_nameoncd ${ARGN})\r
+    endif()\r
+\r
     add_custom_command(\r
-        OUTPUT ${REACTOS_BINARY_DIR}/boot/bootcd/${_dir}/${_nameoncd}        \r
+        OUTPUT ${BOOTCD_DIR}/${_dir}/${_nameoncd}        \r
         COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${BOOTCD_DIR}/${_dir}/${_nameoncd})\r
 \r
     add_custom_target(${_targetname}_minicd DEPENDS ${BOOTCD_DIR}/${_dir}/${_nameoncd})\r
@@ -139,3 +145,114 @@ MACRO(add_minicd FILENAME _dir _nameoncd)
     \r
     add_dependencies(minicd ${_nameoncd}_minicd)\r
 ENDMACRO(add_minicd)\r
+
+macro(set_cpp)
+  include_directories(BEFORE ${REACTOS_SOURCE_DIR}/lib/3rdparty/stlport/stlport)
+  set(IS_CPP 1)
+endmacro()
+\r
+MACRO(add_livecd_target _targetname _dir )# optional parameter : _nameoncd\r
+    \r
+    get_target_property(FILENAME ${_targetname} LOCATION)\r
+\r
+    if("${ARGN}" STREQUAL "")\r
+       get_filename_component(_nameoncd ${FILENAME} NAME)\r
+    else()\r
+       set(_nameoncd ${ARGN})\r
+    endif()\r
+\r
+    add_custom_command(\r
+        OUTPUT ${LIVECD_DIR}/${_dir}/${_nameoncd}        \r
+        COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
+        \r
+    add_custom_target(${_targetname}_livecd DEPENDS ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
+\r
+    add_dependencies(${_targetname}_livecd ${_targetname})\r
+    add_dependencies(livecd ${_targetname}_livecd)\r
+ENDMACRO(add_livecd_target _targetname _dir _nameoncd)\r
+\r
+MACRO(add_livecd FILENAME _dir _nameoncd)\r
+    add_custom_command(\r
+        OUTPUT ${LIVECD_DIR}/${_dir}/${_nameoncd}\r
+        DEPENDS ${FILENAME}\r
+        COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
+        \r
+    add_custom_target(${_nameoncd}_livecd DEPENDS ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
+    \r
+    add_dependencies(livecd ${_nameoncd}_livecd)\r
+ENDMACRO(add_livecd)\r
+\r
+macro(custom_incdefs)\r
+    if(NOT DEFINED result_incs) #rpc_defines\r
+        get_directory_property(rpc_defines COMPILE_DEFINITIONS)\r
+        get_directory_property(rpc_includes INCLUDE_DIRECTORIES)\r
+\r
+        foreach(arg ${rpc_defines})\r
+            set(result_defs ${result_defs} -D${arg})\r
+        endforeach(arg ${defines})\r
+\r
+        foreach(arg ${rpc_includes})\r
+            set(result_incs -I${arg} ${result_incs})\r
+        endforeach(arg ${includes})\r
+    endif()\r
+endmacro(custom_incdefs)\r
+\r
+macro(rpcproxy TARGET)\r
+    custom_incdefs()\r
+        list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c)\r
+\r
+    foreach(_in_FILE ${ARGN})\r
+        get_filename_component(FILE ${_in_FILE} NAME_WE)\r
+        add_custom_command(\r
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c\r
+            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h -p -P ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl\r
+            DEPENDS native-widl)\r
+        set_source_files_properties(\r
+            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c\r
+            PROPERTIES GENERATED TRUE)\r
+        list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)\r
+        list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl)\r
+        list(APPEND PROXY_DEPENDS ${TARGET}_${FILE}_p)\r
+        add_custom_target(${TARGET}_${FILE}_p \r
+            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)\r
+        #add_dependencies(${TARGET}_proxy ${TARGET}_${FILE}_p)\r
+    endforeach(_in_FILE ${ARGN})\r
+    \r
+       add_custom_command(\r
+           OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c\r
+           COMMAND native-widl ${result_incs} ${result_defs}  -m32 --win32 --dlldata-only --dlldata=${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c ${IDLS}\r
+           DEPENDS native-widl)\r
+       set_source_files_properties(\r
+           ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c\r
+           PROPERTIES GENERATED TRUE)\r
+        \r
+        add_library(${TARGET}_proxy ${SOURCE})\r
+        add_dependencies(${TARGET}_proxy psdk ${PROXY_DEPENDS})\r
+endmacro(rpcproxy)\r
+\r
+macro (MACRO_IDL_FILES)\r
+    custom_incdefs()\r
+    foreach(_in_FILE ${ARGN})\r
+        get_filename_component(FILE ${_in_FILE} NAME_WE)\r
+        add_custom_command(\r
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c\r
+            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h -s -S ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl\r
+            DEPENDS native-widl)\r
+        set_source_files_properties(\r
+            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c\r
+            PROPERTIES GENERATED TRUE)\r
+        add_library(${FILE}_server ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c)\r
+        add_dependencies(${FILE}_server psdk)\r
+    \r
+        add_custom_command(\r
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c\r
+            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h -c -C ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl\r
+            DEPENDS native-widl)\r
+        set_source_files_properties(\r
+            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c\r
+            PROPERTIES GENERATED TRUE)\r
+        add_library(${FILE}_client ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c)\r
+        add_dependencies(${FILE}_client psdk)\r
+    endforeach(_in_FILE ${ARGN})\r
+\r
+endmacro (MACRO_IDL_FILES)\r