From 9371d67b0085fbfeac7f59ef66c1bbc109a927b1 Mon Sep 17 00:00:00 2001 From: DevWiki Date: Thu, 26 Sep 2024 16:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BE=93=E5=87=BA=E7=9B=AE?= =?UTF-8?q?=E5=BD=95,=20=E5=A2=9E=E5=8A=A0=E6=9E=84=E5=BB=BA=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinDevice/CMakeLists.txt | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/WinDevice/CMakeLists.txt b/WinDevice/CMakeLists.txt index 57c3577..79b4f18 100644 --- a/WinDevice/CMakeLists.txt +++ b/WinDevice/CMakeLists.txt @@ -86,15 +86,23 @@ target_link_libraries(WinDevice PRIVATE ${DirectX_LIBS}) # 创建 output 目录 set(OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/output) -file(MAKE_DIRECTORY ${OUTPUT_DIR}) -set_target_properties(WinDevice PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/debug" - LIBRARY_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/debug" - RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/debug" +# 获取架构信息 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ARCH_DIR "x64") +else() + set(ARCH_DIR "x86") +endif() - ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/release" - LIBRARY_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/release" - RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/release" +# 创建架构特定的输出目录 +file(MAKE_DIRECTORY ${OUTPUT_DIR}/${ARCH_DIR}) +set_target_properties(WinDevice PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/${ARCH_DIR}/debug" + LIBRARY_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/${ARCH_DIR}/debug" + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIR}/${ARCH_DIR}/debug" + + ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/${ARCH_DIR}/release" + LIBRARY_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/${ARCH_DIR}/release" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIR}/${ARCH_DIR}/release" ) if (CMAKE_BUILD_TYPE STREQUAL "Debug")