[WIN32KNT_APITEST] Split win32knt_apitest to 3 modules (#1588)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Wed, 29 May 2019 11:32:32 +0000 (20:32 +0900)
committerGitHub <noreply@github.com>
Wed, 29 May 2019 11:32:32 +0000 (20:32 +0900)
Split win32knt_apitest to 3 modules (win32knt_apitest, win32knt_xpsp2_apitest and win32knt_2k3sp2_apitest) for usability. These 3 modules are different in linking (win32u.dll, win32u_xpsp2.dll and win32u_2k3sp2.dll). I think it's better to separate for clarity.

modules/rostests/apitests/win32nt/CMakeLists.txt

index 666f823..8ef26f5 100644 (file)
@@ -64,23 +64,47 @@ list(APPEND SOURCE
     #osver.c
     win32nt.h)
 
-add_executable(win32knt_apitest
-    ${SOURCE}
-    testlist.c
-    w32knapi.rc)
+add_library(win32knt_static STATIC ${SOURCE} w32knapi.rc)
+add_dependencies(win32knt_static xdk)
+add_pch(win32knt_static win32nt.h SOURCE)
 
-target_link_libraries(win32knt_apitest ${PSEH_LIB} gditools)
-set_module_type(win32knt_apitest win32cui)
-add_importlibs(win32knt_apitest
-    win32u # win32u_2ksp4 win32u_xpsp2 win32u_2k3sp2 win32u_vista
-    gdi32
-    user32
-    shell32
-    advapi32
-    msvcrt
-    kernel32
-    ntdll)
+set(WIN32KNT_IMPORTLIBS gdi32 user32 shell32 advapi32 msvcrt kernel32 ntdll)
 
-add_dependencies(win32knt_apitest xdk)
-add_pch(win32knt_apitest win32nt.h SOURCE)
-add_rostests_file(TARGET win32knt_apitest)
+if(1)  # ros
+    add_executable(win32knt_apitest testlist.c)
+    target_link_libraries(win32knt_apitest ${PSEH_LIB} win32knt_static gditools)
+    set_module_type(win32knt_apitest win32cui)
+    add_importlibs(win32knt_apitest win32u ${WIN32KNT_IMPORTLIBS})
+
+    add_rostests_file(TARGET win32knt_apitest)
+endif()
+
+if(0)  # Specify 1 if you want 2ksp4 version
+    # See also ../win32u/CMakeLists.txt
+    add_executable(win32knt_2ksp4_apitest testlist.c)
+    target_link_libraries(win32knt_2ksp4_apitest ${PSEH_LIB} win32knt_static gditools)
+    set_module_type(win32knt_2ksp4_apitest win32cui)
+    add_importlibs(win32knt_2ksp4_apitest win32u_2ksp4 ${WIN32KNT_IMPORTLIBS})
+endif()
+
+if(1) # xpsp2
+    add_executable(win32knt_xpsp2_apitest testlist.c)
+    target_link_libraries(win32knt_xpsp2_apitest ${PSEH_LIB} win32knt_static gditools)
+    set_module_type(win32knt_xpsp2_apitest win32cui)
+    add_importlibs(win32knt_xpsp2_apitest win32u_xpsp2 ${WIN32KNT_IMPORTLIBS})
+endif()
+
+if(1) # 2k3sp2
+    add_executable(win32knt_2k3sp2_apitest testlist.c)
+    target_link_libraries(win32knt_2k3sp2_apitest ${PSEH_LIB} win32knt_static gditools)
+    set_module_type(win32knt_2k3sp2_apitest win32cui)
+    add_importlibs(win32knt_2k3sp2_apitest win32u_2k3sp2 ${WIN32KNT_IMPORTLIBS})
+endif()
+
+if(0)  # Specify 1 if you want vista version
+    # See also ../win32u/CMakeLists.txt
+    add_executable(win32knt_vista_apitest testlist.c)
+    target_link_libraries(win32knt_vista_apitest ${PSEH_LIB} win32knt_static gditools)
+    set_module_type(win32knt_vista_apitest win32cui)
+    add_importlibs(win32knt_vista_apitest win32u_vista ${WIN32KNT_IMPORTLIBS})
+endif()