[CMAKE]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 2 Nov 2010 09:22:58 +0000 (09:22 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 2 Nov 2010 09:22:58 +0000 (09:22 +0000)
Rename add_importlib_def to add_importlib_target
add importlib targets for ntdll, msvcrt, shell32, user32

svn path=/branches/cmake-bringup/; revision=49427

dll/ntdll/CMakeLists.txt
dll/win32/kernel32/CMakeLists.txt
dll/win32/msvcrt/CMakeLists.txt
dll/win32/rpcrt4/CMakeLists.txt
dll/win32/shell32/CMakeLists.txt
dll/win32/user32/CMakeLists.txt
msc.cmake

index fa36f6a..0abe200 100644 (file)
@@ -55,4 +55,4 @@ add_dependencies(ntdll ntstatus)
 
 add_minicd_target(ntdll reactos/system32 ntdll.dll)
 add_cab_target(ntdll 1)
-add_importlib_def(${CMAKE_CURRENT_BINARY_DIR}/ntdll.def)
+add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/ntdll.def)
index c502a8c..4078668 100644 (file)
@@ -121,4 +121,4 @@ add_importlibs(kernel32 ntdll)
 add_pch(kernel32 ${CMAKE_CURRENT_SOURCE_DIR}/k32.h ${SOURCE})
 add_dependencies(kernel32 errcodes)
 add_cab_target(kernel32 1)
-add_importlib_def(${CMAKE_CURRENT_BINARY_DIR}/kernel32.def)
+add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/kernel32.def)
index de508f0..b4e8a37 100644 (file)
@@ -1,4 +1,6 @@
 
+spec2def(msvcrt.dll msvcrt.spec)
+
 add_definitions(
     -DUSE_MSVCRT_PREFIX
     -D_MSVCRT_
@@ -11,7 +13,11 @@ add_definitions(
 
 include_directories(${REACTOS_SOURCE_DIR}/lib/sdk/crt/include)
 
-list(APPEND SOURCE dllmain.c msvcrt_stubs.c msvcrt.rc)
+list(APPEND SOURCE
+     dllmain.c
+     msvcrt_stubs.c
+     msvcrt.rc
+     ${CMAKE_CURRENT_BINARY_DIR}/msvcrt.def)
 
 add_library(msvcrt SHARED
     ${CMAKE_CURRENT_BINARY_DIR}/msvcrt_precomp.h.gch
@@ -21,7 +27,6 @@ set_target_properties(msvcrt PROPERTIES LINK_FLAGS "-u __seh_longjmp_unwind@4")
 set_module_type(msvcrt win32dll)
 
 target_link_libraries(msvcrt
-    ${CMAKE_CURRENT_SOURCE_DIR}/msvcrt.def
     crt
     wine
     ${PSEH_LIB})
@@ -29,3 +34,5 @@ target_link_libraries(msvcrt
 add_pch(msvcrt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE})
 add_importlibs(msvcrt kernel32 ntdll)
 add_cab_target(msvcrt 1)
+add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/msvcrt.def)
+
index c5750f7..c63d6c4 100644 (file)
@@ -45,3 +45,5 @@ target_link_libraries(rpcrt4
 add_importlibs(rpcrt4 msvcrt user32 advapi32 secur32 iphlpapi ws2_32 kernel32 ntdll)
 add_dependencies(rpcrt4 winesdk)
 add_cab_target(rpcrt4 1)
+add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/rpcrt4.def)
+
index c5e6bc1..0a09372 100644 (file)
@@ -94,4 +94,6 @@ add_importlibs(shell32
     ntdll)
 
 
-add_cab_target(shell32 1)
\ No newline at end of file
+add_cab_target(shell32 1)
+add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/shell32.def)
+
index 780c97f..6394d31 100644 (file)
@@ -1,6 +1,8 @@
 
 set_unicode()
 
+spec2def(user32.dll user32.pspec)
+
 add_definitions(-D_DLL -D__USE_CRTIMP)
 
 include_directories(
@@ -64,7 +66,7 @@ list(APPEND SOURCE
     windows/winpos.c
     user32_stubs.c
     user32.rc
-    user32.def)
+    ${CMAKE_CURRENT_BINARY_DIR}/user32.def)
     
 set_source_files_properties(user32.def PROPERTIES EXTERNAL_OBJECT TRUE)
 
@@ -82,3 +84,5 @@ target_link_libraries(user32
 add_pch(user32 ${CMAKE_CURRENT_SOURCE_DIR}/include/user32.h ${SOURCE})
 add_importlibs(user32 gdi32 advapi32 imm32 kernel32 ntdll)
 add_cab_target(user32 1)
+add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/user32.def)
+
index eb0fdc7..6669204 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -14,6 +14,8 @@ else()
 add_definitions(/GS- /Zl /Zi)\r
 add_definitions(-Dinline=__inline -D__STDC__=1)\r
 \r
+link_directories("${REACTOS_BINARY_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)\r
+\r
 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>")\r
 \r
 \r
@@ -59,7 +61,18 @@ macro(set_module_type MODULE TYPE)
     endif ()\r
     if (${TYPE} MATCHES win32cui)\r
         set_subsystem(${MODULE} console)\r
+        set_entrypoint(${MODULE} mainCRTStartup)\r
     endif ()\r
+    if(${TYPE} MATCHES win32dll)\r
+        set_entrypoint(${MODULE} __DllMainCRTStartup)\r
+               if(DEFINED baseaddress_${MODULE})\r
+                       set_image_base(${MODULE} ${baseaddress_${MODULE}})\r
+               else()\r
+                       message(STATUS "${MODULE} has no base address")\r
+               endif()\r
+               target_link_libraries(${MODULE} mingw_common mingw_dllmain)\r
+    endif()\r
+\r
 endmacro()\r
 \r
 macro(set_unicode)\r
@@ -82,7 +95,7 @@ set(IDL_SERVER_ARG /sstub) #.c for stub server library
 set(IDL_CLIENT_ARG /cstub) #.c for stub client library\r
 \r
 \r
-macro(add_importlib_def _def_file)\r
+macro(add_importlib_target _def_file)\r
     get_filename_component(_name ${_def_file} NAME_WE)\r
     add_custom_target(\r
         lib${_name}\r