File tree 4 files changed +41
-30
lines changed
4 files changed +41
-30
lines changed Original file line number Diff line number Diff line change @@ -14,43 +14,23 @@ add_compile_options(
14
14
"$<$<CONFIG:Debug>:/fsanitize=address>"
15
15
)
16
16
17
- include (CheckCXXSourceCompiles)
18
- check_cxx_source_compiles("
19
- #include <winrt/base.h>
20
- int main() { return 0; }"
21
- CAN_INCLUDE_CPPWINRT)
22
-
23
- if (NOT CAN_INCLUDE_CPPWINRT)
24
- add_compile_options ("/await" )
25
- check_cxx_source_compiles("
26
- #include <winrt/base.h>
27
- int main() { return 0; }"
28
- CAN_INCLUDE_CPPWINRT_WITH_AWAIT)
29
-
30
- if (NOT CAN_INCLUDE_CPPWINRT_WITH_AWAIT)
31
- message (FATAL_ERROR "Can't figure out build options for C++/Winrt" )
32
- endif ()
33
-
34
- message (WARNING "Using C++/WinRT from old Windows SDK; requires pre-C++20 coroutines (/await)" )
35
- endif ()
36
-
37
17
function (add_cppremapper_executable TARGET )
38
18
add_executable (${TARGET} ${ARGN} )
39
19
target_link_libraries (
40
- " ${TARGET} "
20
+ "${TARGET} "
41
21
PRIVATE
42
22
LibCppRemapper
43
23
)
44
24
add_custom_command (
45
- TARGET " ${TARGET} "
25
+ TARGET "${TARGET} "
46
26
POST_BUILD
47
27
COMMAND
48
- " ${CMAKE_COMMAND} "
28
+ "${CMAKE_COMMAND} "
49
29
-E copy
50
- " $<TARGET_RUNTIME_DLLS:${TARGET} > "
51
- " $<TARGET_FILE_DIR:${TARGET} > "
30
+ "$<TARGET_RUNTIME_DLLS:${TARGET} >"
31
+ "$<TARGET_FILE_DIR:${TARGET} >"
52
32
)
53
- install (TARGETS " ${TARGET} " )
33
+ install (TARGETS "${TARGET} " )
54
34
endfunction ()
55
35
56
36
add_subdirectory (third-party)
Original file line number Diff line number Diff line change @@ -42,17 +42,22 @@ target_link_libraries(
42
42
ThirdParty-ViGEmClient
43
43
ThirdParty-VJoy
44
44
)
45
+ target_link_libraries (
46
+ LibCppRemapper
47
+ PUBLIC
48
+ ThirdParty-CppWinRT
49
+ )
45
50
target_include_directories (
46
51
LibCppRemapper
47
52
PUBLIC
48
53
"${CMAKE_CURRENT_SOURCE_DIR} /include"
49
54
)
50
- target_compile_options (
55
+
56
+ install (
57
+ TARGETS
51
58
LibCppRemapper
52
- PRIVATE
53
- /await:strict # C++20 standard-compliant
59
+ LIBRARY
54
60
)
55
- install (TARGETS LibCppRemapper)
56
61
57
62
add_library (LibCppRemapper-compat INTERFACE )
58
63
target_link_libraries (LibCppRemapper-compat INTERFACE LibCppRemapper)
Original file line number Diff line number Diff line change 1
1
include (catch.cmake)
2
+ include (cppwinrt.cmake)
2
3
include (vjoy.cmake)
3
4
include (vigemclient.cmake)
Original file line number Diff line number Diff line change
1
+ include (ExternalProject)
2
+
3
+ ExternalProject_Add(
4
+ EP_CppWinRT
5
+ URL "https://github.com/microsoft/cppwinrt/releases/download/2.0.220912.1/Microsoft.Windows.CppWinRT.2.0.220912.1.nupkg"
6
+ URL_HASH "SHA256=d57e487b4e35d33ac7e808d4b63a664b99802047a8044eadf130e8048668252a"
7
+
8
+ CONFIGURE_COMMAND ""
9
+ BUILD_COMMAND
10
+ "<SOURCE_DIR>/bin/cppwinrt.exe"
11
+ -in "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} "
12
+ -output "<BINARY_DIR>/include"
13
+ INSTALL_COMMAND ""
14
+
15
+ EXCLUDE_FROM_ALL
16
+ )
17
+ message (STATUS "Windows target version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} " )
18
+
19
+ ExternalProject_Get_property(EP_CppWinRT SOURCE_DIR)
20
+ ExternalProject_Get_property(EP_CppWinRT BINARY_DIR)
21
+
22
+ add_library (ThirdParty-CppWinRT INTERFACE )
23
+ add_dependencies (ThirdParty-CppWinRT EP_CppWinRT)
24
+ target_link_libraries (ThirdParty-CppWinRT INTERFACE "WindowsApp" )
25
+ target_include_directories (ThirdParty-CppWinRT INTERFACE "${BINARY_DIR} /include" )
You can’t perform that action at this time.
0 commit comments