From 2f2eede82f3d75b3a554ee3fc7dbdded7dbeb836 Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 17:06:08 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E3=80=90#15=E3=80=91CMakeList=20should=20a?= =?UTF-8?q?dapt=20to=20linux=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 116 +++++++++++++++--- Demos/DemoDependencyPlugin/CMakeLists.txt | 43 ++++--- Demos/DemoPlugin/CMakeLists.txt | 43 ++++--- Designer/APP/CMakeLists.txt | 38 +++--- Designer/DB/SolidDesignerModel/CMakeLists.txt | 43 ++++--- .../SolidDesignerInteraction/CMakeLists.txt | 42 ++++--- .../UI/SolidDesignerCommand/CMakeLists.txt | 42 ++++--- Designer/UI/SolidDesignerUI/CMakeLists.txt | 42 ++++--- Externals/pugixml/CMakeLists.txt | 43 ++++--- 9 files changed, 286 insertions(+), 166 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cd2298c..d49b7380 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,25 +111,31 @@ endif() #----------------------------------------------------------------------------- # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- -set(CMAKE_GENERATOR_PLATFORM x64) -if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - endif() +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - endif() +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() +if(SOLIDRENDER_WIN) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) @@ -252,4 +258,78 @@ endif() + + + +#----------------------------------------------------------------------------- +# Installation +#----------------------------------------------------------------------------- + + +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() + +# 测试target的存在性: +if(TARGET AliceCommandSystem) + message(STATUS "AliceCommandSystem exists in APP scope") +else() + message(STATUS "AliceCommandSystem NOT exists in APP scope") +endif() + + +# 建议:统一一个安装目的地根目录(你现在是 INSTALL_DIR/INSTALL) +set(SD_INSTALL_DST "${INSTALL_DIR}/INSTALL") +message("SD_INSTALL_DST = ${SD_INSTALL_DST}") +# 需要安装的目标列表 +set(SD_INSTALL_TARGETS + AliceCommandSystem + AlicePropertyBrowser + AliceRibbon + AliceThemeSupport + AliceUiBasicTools + AliceUiFrameWork + XRibbonBar + XToolbar +) + +# 可选:提前检查 target 是否存在(更容易定位问题) +foreach(_t IN LISTS SD_INSTALL_TARGETS) + if(NOT TARGET ${_t}) + message(FATAL_ERROR "Install target not found: ${_t}") + endif() +endforeach() + +# Windows:必须加 WIN32,避免 Linux/Makefiles 被污染 +if(WIN32 AND SOLIDRENDER_WIN) + install(TARGETS ${SD_INSTALL_TARGETS} + RUNTIME DESTINATION "${SD_INSTALL_DST}" # .exe / .dll + ARCHIVE DESTINATION "${SD_INSTALL_DST}" # .lib(静态库或 import lib) + LIBRARY DESTINATION "${SD_INSTALL_DST}" # MinGW: .dll.a;MSVC 通常为空 + ) + +# Linux:同样用 TARGETS,CMake 会把 .so 走到 LIBRARY +elseif(UNIX AND NOT APPLE AND SOLIDRENDER_LINUX) + install(TARGETS ${SD_INSTALL_TARGETS} + RUNTIME DESTINATION "${SD_INSTALL_DST}" # 通常为空(除非是可执行文件) + LIBRARY DESTINATION "${SD_INSTALL_DST}" # .so + ARCHIVE DESTINATION "${SD_INSTALL_DST}" # .a + ) +endif() + message("*--*--*--*--*--*--*--*--*--*--*--End Top Level CmakeList--*--*--*--*--*--*--*--*--*--*--*--*--*") \ No newline at end of file diff --git a/Demos/DemoDependencyPlugin/CMakeLists.txt b/Demos/DemoDependencyPlugin/CMakeLists.txt index a8be9261..ff26e004 100644 --- a/Demos/DemoDependencyPlugin/CMakeLists.txt +++ b/Demos/DemoDependencyPlugin/CMakeLists.txt @@ -52,26 +52,31 @@ include_directories(${PROJECT_SOURCE_DIR}/Demos/DemoDependencyPlugin/Public) # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- message("${CMAKE_BINARY_DIR}") -set(CMAKE_GENERATOR_PLATFORM x64) +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() if(SOLIDRENDER_WIN) - message("It is configuring the dir of output") - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug/Plugins) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release/Plugins) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug/Plugins) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release/Plugins) - endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug/Plugins) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release/Plugins) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/Demos/DemoPlugin/CMakeLists.txt b/Demos/DemoPlugin/CMakeLists.txt index 1eabc838..a01451b2 100644 --- a/Demos/DemoPlugin/CMakeLists.txt +++ b/Demos/DemoPlugin/CMakeLists.txt @@ -52,26 +52,31 @@ include_directories(${PROJECT_SOURCE_DIR}/Demos/DemoPlugin/Public) # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- message("${CMAKE_BINARY_DIR}") -set(CMAKE_GENERATOR_PLATFORM x64) +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() if(SOLIDRENDER_WIN) - message("It is configuring the dir of output") - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug/Plugins) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release/Plugins) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug/Plugins) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release/Plugins) - endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug/Plugins) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release/Plugins) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/Designer/APP/CMakeLists.txt b/Designer/APP/CMakeLists.txt index 12623409..d8bac3e5 100644 --- a/Designer/APP/CMakeLists.txt +++ b/Designer/APP/CMakeLists.txt @@ -199,23 +199,25 @@ install(DIRECTORY "${CMAKE_SOURCE_DIR}/source/resource/data" DESTINATION "${INST install(DIRECTORY "${CMAKE_SOURCE_DIR}/source/resource/Script" DESTINATION "${INSTALL_DIR}/INSTALL") -set(CMAKE_GENERATOR_PLATFORM x64) -if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - #install(DIRECTORY "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}" DESTINATION "${INSTALL_DIR}/INSTALL" FILES_MATCHING PATTERN "*.dll" PATTERN "${CMAKE_BUILD_TYPE}" EXCLUDE) - install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/CommandSystem.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) - install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/AlicePropertyBrowser.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) - install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/XFrameWork.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) - install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/XRibbonBar.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) - install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/XToolbar.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - install(DIRECTORY "${CMAKE_BINARY_DIR}/x86/${CMAKE_BUILD_TYPE}" DESTINATION "${INSTALL_DIR}/INSTALL") - endif() - -elseif(SOLIDRENDER_LINUX) - install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" DESTINATION "${INSTALL_DIR}/INSTALL") -endif() + + +# if(SOLIDRENDER_WIN) + # if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") + # #install(DIRECTORY "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}" DESTINATION "${INSTALL_DIR}/INSTALL" FILES_MATCHING PATTERN "*.dll" PATTERN "${CMAKE_BUILD_TYPE}" EXCLUDE) + # install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/CommandSystem.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) + # install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/AlicePropertyBrowser.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) + # install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/XFrameWork.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) + # install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/XRibbonBar.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) + # install(FILES "${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/XToolbar.dll" DESTINATION "${INSTALL_DIR}/INSTALL" ) + # endif() + + # if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") + # install(DIRECTORY "${CMAKE_BINARY_DIR}/x86/${CMAKE_BUILD_TYPE}" DESTINATION "${INSTALL_DIR}/INSTALL") + # endif() + +# elseif(SOLIDRENDER_LINUX) + # install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" DESTINATION "${INSTALL_DIR}/INSTALL") +# endif() + message(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>End Designer APP<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") \ No newline at end of file diff --git a/Designer/DB/SolidDesignerModel/CMakeLists.txt b/Designer/DB/SolidDesignerModel/CMakeLists.txt index 1721928a..0aec20a4 100644 --- a/Designer/DB/SolidDesignerModel/CMakeLists.txt +++ b/Designer/DB/SolidDesignerModel/CMakeLists.txt @@ -63,26 +63,31 @@ endif() # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- message("${CMAKE_BINARY_DIR}") -set(CMAKE_GENERATOR_PLATFORM x64) -if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - endif() +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() +if(SOLIDRENDER_WIN) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt b/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt index f26ae3c0..abc51ea8 100644 --- a/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt +++ b/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt @@ -63,25 +63,31 @@ endif() # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- message("${CMAKE_BINARY_DIR}") -set(CMAKE_GENERATOR_PLATFORM x64) +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/Designer/UI/SolidDesignerCommand/CMakeLists.txt b/Designer/UI/SolidDesignerCommand/CMakeLists.txt index 372e412e..59568cf5 100644 --- a/Designer/UI/SolidDesignerCommand/CMakeLists.txt +++ b/Designer/UI/SolidDesignerCommand/CMakeLists.txt @@ -83,25 +83,31 @@ endif() # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- message("${CMAKE_BINARY_DIR}") -set(CMAKE_GENERATOR_PLATFORM x64) +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/Designer/UI/SolidDesignerUI/CMakeLists.txt b/Designer/UI/SolidDesignerUI/CMakeLists.txt index 78d51f9d..1566458f 100644 --- a/Designer/UI/SolidDesignerUI/CMakeLists.txt +++ b/Designer/UI/SolidDesignerUI/CMakeLists.txt @@ -75,25 +75,31 @@ endif() # 定义项目构建中间文件的生成目录 #----------------------------------------------------------------------------- message("${CMAKE_BINARY_DIR}") -set(CMAKE_GENERATOR_PLATFORM x64) +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) diff --git a/Externals/pugixml/CMakeLists.txt b/Externals/pugixml/CMakeLists.txt index 44ee492d..5e75f177 100644 --- a/Externals/pugixml/CMakeLists.txt +++ b/Externals/pugixml/CMakeLists.txt @@ -20,27 +20,32 @@ source_group("Source Files" FILES ${SOURCE_CPP_FILES}) # @ 定义项目构建中间文件的生成目录 # @ 必须放在add_library之前,否则无效 #----------------------------------------------------------------------------- -#set(SOLIDRENDER_WIN true) -set(CMAKE_GENERATOR_PLATFORM x64) +# 用指针位数决定输出目录:x64 / x86 +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SD_ARCH "x64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(SD_ARCH "x86") +else() + message(FATAL_ERROR "Unknown pointer size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +# Linux 侧需要 GNUInstallDirs 提供 CMAKE_INSTALL_LIBDIR/BINDIR +if(UNIX AND NOT APPLE) + include(GNUInstallDirs) +endif() + +# 防止误开关:Linux 下不允许走 SOLIDRENDER_WIN 分支 +if(SOLIDRENDER_WIN AND NOT WIN32) + message(FATAL_ERROR "SOLIDRENDER_WIN=ON but WIN32=OFF. Disable SOLIDRENDER_WIN on Linux.") +endif() if(SOLIDRENDER_WIN) - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x64/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x64/Release) - endif() - - if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/x86/Debug) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/x86/Release) - endif() + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${SD_ARCH}/Debug) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${SD_ARCH}/Release) elseif(SOLIDRENDER_LINUX) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}) From c8168a291eb103fadedd9b2eb6c2ffca511698fa Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 17:15:09 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E3=80=90#15=E3=80=91CMakeList=20should=20a?= =?UTF-8?q?dapt=20to=20linux=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Alice | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Alice b/Alice index 932a156d..ffa46c86 160000 --- a/Alice +++ b/Alice @@ -1 +1 @@ -Subproject commit 932a156d4e18709f42cc0aeb8e949129039114b0 +Subproject commit ffa46c86c11a6e8ed635b24f3658c5e954f613ec From 6c1824a815a385487e7fc7ad7441d55f57c475f6 Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 17:20:33 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E3=80=90#15=E3=80=91CMakeList=20should=20a?= =?UTF-8?q?dapt=20to=20linux=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d49b7380..c2871a58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,7 +243,7 @@ endif() add_subdirectory(Alice) # 外部项目(包括第三方库) -add_subdirectory(externals) +add_subdirectory(Externals) # 单元测试 add_subdirectory(UnitTest) From f13f1c5885c16c239495fba12b412eb705847ef5 Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 17:37:40 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E3=80=90#15=E3=80=91=20CMakeList=20should?= =?UTF-8?q?=20adapt=20to=20linux=20environment=20#90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 - Demos/DemoDependencyPlugin/CMakeLists.txt | 2 -- Demos/DemoPlugin/CMakeLists.txt | 2 -- Designer/DB/SolidDesignerModel/CMakeLists.txt | 2 -- Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt | 2 -- Designer/UI/SolidDesignerCommand/CMakeLists.txt | 2 -- Designer/UI/SolidDesignerUI/CMakeLists.txt | 2 -- Externals/pugixml/CMakeLists.txt | 2 -- 8 files changed, 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2871a58..b4d5c312 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif() -set(CMAKE_EXE_LINKER_FLAGS "/machine:x64") if(MSVC) add_definitions(-DUNICODE -D_UNICODE) diff --git a/Demos/DemoDependencyPlugin/CMakeLists.txt b/Demos/DemoDependencyPlugin/CMakeLists.txt index ff26e004..00f39de4 100644 --- a/Demos/DemoDependencyPlugin/CMakeLists.txt +++ b/Demos/DemoDependencyPlugin/CMakeLists.txt @@ -98,8 +98,6 @@ set_target_properties(SolidDemoDependencyPlugin PROPERTIES FOLDER "Demos") # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) diff --git a/Demos/DemoPlugin/CMakeLists.txt b/Demos/DemoPlugin/CMakeLists.txt index a01451b2..7d01c44f 100644 --- a/Demos/DemoPlugin/CMakeLists.txt +++ b/Demos/DemoPlugin/CMakeLists.txt @@ -98,8 +98,6 @@ set_target_properties(SolidDemoPlugin PROPERTIES FOLDER "Demos") # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) diff --git a/Designer/DB/SolidDesignerModel/CMakeLists.txt b/Designer/DB/SolidDesignerModel/CMakeLists.txt index 0aec20a4..d8389867 100644 --- a/Designer/DB/SolidDesignerModel/CMakeLists.txt +++ b/Designer/DB/SolidDesignerModel/CMakeLists.txt @@ -42,8 +42,6 @@ set_target_properties(SolidDesignerModel PROPERTIES FOLDER "Designer/DB") # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) diff --git a/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt b/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt index abc51ea8..a59693de 100644 --- a/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt +++ b/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt @@ -42,8 +42,6 @@ set_target_properties(SolidDesignerInteraction PROPERTIES FOLDER "Designer/Inter # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) diff --git a/Designer/UI/SolidDesignerCommand/CMakeLists.txt b/Designer/UI/SolidDesignerCommand/CMakeLists.txt index 59568cf5..2f01c807 100644 --- a/Designer/UI/SolidDesignerCommand/CMakeLists.txt +++ b/Designer/UI/SolidDesignerCommand/CMakeLists.txt @@ -62,8 +62,6 @@ set_target_properties(SolidDesignerCommand PROPERTIES FOLDER "Designer/UI") # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) diff --git a/Designer/UI/SolidDesignerUI/CMakeLists.txt b/Designer/UI/SolidDesignerUI/CMakeLists.txt index 1566458f..1244dd53 100644 --- a/Designer/UI/SolidDesignerUI/CMakeLists.txt +++ b/Designer/UI/SolidDesignerUI/CMakeLists.txt @@ -54,8 +54,6 @@ set_target_properties(SolidDesignerUI PROPERTIES FOLDER "Designer/UI") # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) diff --git a/Externals/pugixml/CMakeLists.txt b/Externals/pugixml/CMakeLists.txt index 5e75f177..527e1baf 100644 --- a/Externals/pugixml/CMakeLists.txt +++ b/Externals/pugixml/CMakeLists.txt @@ -70,8 +70,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # 根据系统及机器位数设置链接的位数 # 必须放在link之后,否则设置无效 #----------------------------------------------------------------------------- -set(CMAKE_SHARED_LINKER_FLAGS "/machine:x64") - if(WIN32) # include the major version number in Windows shared library names (but not import library names) From 282782f6029c0c0f95c25f3c4f10d419aff21799 Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 17:45:50 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E3=80=90#15=E3=80=91=20CMakeList=20should?= =?UTF-8?q?=20adapt=20to=20linux=20environment=20#90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Alice | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Alice b/Alice index ffa46c86..9783dd36 160000 --- a/Alice +++ b/Alice @@ -1 +1 @@ -Subproject commit ffa46c86c11a6e8ed635b24f3658c5e954f613ec +Subproject commit 9783dd363cddb0cdaaba5ef71138a63925c195ba From 9c77ad73034f8813bd30d4098fad1179acc22aac Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 21:12:16 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E3=80=90#15=E3=80=91=20CMakeList=20should?= =?UTF-8?q?=20adapt=20to=20linux=20environment=20#90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Public/SolidDemoDependencyPlugin.h | 6 ++- Demos/DemoPlugin/Public/SolidDemoPlugin.h | 6 ++- Designer/APP/CMakeLists.txt | 39 ++++++++++--------- Designer/DB/SolidDesignerModel/CMakeLists.txt | 2 +- .../SolidDesignerModel/SolidDesignerModel.h | 5 ++- .../SolidDesignerInteraction/CMakeLists.txt | 2 +- .../SolidDesignerInteraction.h | 6 ++- .../UI/SolidDesignerCommand/CMakeLists.txt | 2 +- .../GeneralCommands/SolidFileSaveCommand.cpp | 8 ++-- .../SolidDesignerCommand.h | 5 +++ Designer/UI/SolidDesignerUI/CMakeLists.txt | 2 +- Designer/UI/SolidDesignerUI/SolidDesignerUI.h | 6 ++- Externals/pugixml/CMakeLists.txt | 4 +- 13 files changed, 58 insertions(+), 35 deletions(-) diff --git a/Demos/DemoDependencyPlugin/Public/SolidDemoDependencyPlugin.h b/Demos/DemoDependencyPlugin/Public/SolidDemoDependencyPlugin.h index 33b8ce58..cc1d1643 100644 --- a/Demos/DemoDependencyPlugin/Public/SolidDemoDependencyPlugin.h +++ b/Demos/DemoDependencyPlugin/Public/SolidDemoDependencyPlugin.h @@ -1,10 +1,12 @@ #pragma once #include "AliceMacroDefinitions.h" - +#if defined(_WIN32) #ifdef ALICE_DEMO_DEPEND_PLUGIN_HOME #define ALICE_DEMO_DEPEND_PLUGIN_EXPORT DLL_EXPORT #else #define ALICE_DEMO_DEPEND_PLUGIN_EXPORT DLL_IMPORT #endif - +#else +#define ALICE_DEMO_DEPEND_PLUGIN_EXPORT __attribute__((visibility("default"))) +#endif diff --git a/Demos/DemoPlugin/Public/SolidDemoPlugin.h b/Demos/DemoPlugin/Public/SolidDemoPlugin.h index de2a0118..5d932fc0 100644 --- a/Demos/DemoPlugin/Public/SolidDemoPlugin.h +++ b/Demos/DemoPlugin/Public/SolidDemoPlugin.h @@ -1,10 +1,12 @@ #pragma once #include "AliceMacroDefinitions.h" - +#if defined(_WIN32) #ifdef ALICE_DEMO_PLUGIN_HOME #define ALICE_DEMO_PLUGIN_EXPORT DLL_EXPORT #else #define ALICE_DEMO_PLUGIN_EXPORT DLL_IMPORT #endif - +#else +#define ALICE_DEMO_PLUGIN_EXPORT __attribute__((visibility("default"))) +#endif diff --git a/Designer/APP/CMakeLists.txt b/Designer/APP/CMakeLists.txt index d8bac3e5..6d1d3b28 100644 --- a/Designer/APP/CMakeLists.txt +++ b/Designer/APP/CMakeLists.txt @@ -112,21 +112,6 @@ message("CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}") link_directories(${CMAKE_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}) -#----------------------------------------------------------------------------- -# 库文件链接路径 -# link_libraries 不会为每个目标生成链接路径。而是直接添加库的名称。 -#----------------------------------------------------------------------------- -message("PROJECT_NAME = ${PROJECT_NAME}") -link_libraries(glu32.lib) -link_libraries(glew32.lib) -link_libraries(opengl32.lib) -link_libraries(freeimage.lib) -link_libraries(log4cplusU.lib) -link_libraries(AliceCoreApplicationInterface.lib) -link_libraries(AliceUiFrameWork.lib) -link_libraries(AliceBasicTool.lib) -link_libraries(AliceComponentSystem.lib) -link_libraries(AliceLaunchInterface.lib) #----------------------------------------------------------------------------- # QRC文件打包及前处理命令 #----------------------------------------------------------------------------- @@ -139,10 +124,6 @@ set(SD_RCC_FILE "${SD_RCC_DIR}/SolidDesignerRes.rcc") file(GLOB_RECURSE SD_QRCS "${GEN_RCC_WD}/*.qrc") - - - - #----------------------------------------------------------------------------- # 添加可执行程序目标 #----------------------------------------------------------------------------- @@ -220,4 +201,24 @@ install(DIRECTORY "${CMAKE_SOURCE_DIR}/source/resource/Script" DESTINATION "${IN # endif() +#----------------------------------------------------------------------------- +# 链接第三方的库 +# @1、链接的动作需要放到add_library之后 +#----------------------------------------------------------------------------- +message("PROJECT_NAME = ${PROJECT_NAME}") +target_link_libraries(${PROJECT_NAME} + glu32 + glew32 + opengl32 + freeimage + log4cplusU + AliceCoreApplicationInterface + AliceUiFrameWork + AliceBasicTool + AliceComponentSystem + AliceLaunchInterface +) + + + message(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>End Designer APP<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") \ No newline at end of file diff --git a/Designer/DB/SolidDesignerModel/CMakeLists.txt b/Designer/DB/SolidDesignerModel/CMakeLists.txt index d8389867..f4e3d217 100644 --- a/Designer/DB/SolidDesignerModel/CMakeLists.txt +++ b/Designer/DB/SolidDesignerModel/CMakeLists.txt @@ -97,7 +97,7 @@ endif() # 链接第三方的库 # @1、链接的动作需要放到add_library之后 #----------------------------------------------------------------------------- -target_link_libraries(SolidDesignerModel +target_link_libraries(SolidDesignerModel PRIVATE AliceBasicTool AliceFoundation AliceDatabaseInterface diff --git a/Designer/DB/SolidDesignerModel/SolidDesignerModel.h b/Designer/DB/SolidDesignerModel/SolidDesignerModel.h index abfce434..8bb79e4e 100644 --- a/Designer/DB/SolidDesignerModel/SolidDesignerModel.h +++ b/Designer/DB/SolidDesignerModel/SolidDesignerModel.h @@ -2,12 +2,15 @@ // 此头文件包含DLL导出的宏 #include "AliceMacroDefinitions.h" #include +#if defined(_WIN32) #ifdef SOLID_DESIGNER_MODEL_HOME #define SOLIDDESIGNER_MODEL_EXPORT DLL_EXPORT #else #define SOLIDDESIGNER_MODEL_EXPORT DLL_IMPORT #endif - +#else +#define SOLIDDESIGNER_MODEL_EXPORT __attribute__((visibility("default"))) +#endif namespace { diff --git a/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt b/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt index a59693de..dc358c65 100644 --- a/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt +++ b/Designer/Interaction/SolidDesignerInteraction/CMakeLists.txt @@ -99,7 +99,7 @@ endif() # @1、链接的动作需要放到add_library之后 #----------------------------------------------------------------------------- -target_link_libraries(SolidDesignerInteraction +target_link_libraries(SolidDesignerInteraction PRIVATE AliceBasicTool ) diff --git a/Designer/Interaction/SolidDesignerInteraction/SolidDesignerInteraction.h b/Designer/Interaction/SolidDesignerInteraction/SolidDesignerInteraction.h index 9faf216b..fb8701a5 100644 --- a/Designer/Interaction/SolidDesignerInteraction/SolidDesignerInteraction.h +++ b/Designer/Interaction/SolidDesignerInteraction/SolidDesignerInteraction.h @@ -2,12 +2,16 @@ // 此头文件包含DLL导出的宏 #include "AliceMacroDefinitions.h" #include + +#if defined(_WIN32) #ifdef SOLID_DESIGNER_INTERACTION_HOME #define SOLID_DESIGNER_INTERACTION_EXPORT DLL_EXPORT #else #define SOLID_DESIGNER_INTERACTION_EXPORT DLL_IMPORT #endif - +#else +#define SOLID_DESIGNER_INTERACTION_EXPORT __attribute__((visibility("default"))) +#endif namespace { diff --git a/Designer/UI/SolidDesignerCommand/CMakeLists.txt b/Designer/UI/SolidDesignerCommand/CMakeLists.txt index 2f01c807..8321434d 100644 --- a/Designer/UI/SolidDesignerCommand/CMakeLists.txt +++ b/Designer/UI/SolidDesignerCommand/CMakeLists.txt @@ -149,7 +149,7 @@ set_target_properties(SolidDesignerCommandsId PROPERTIES FOLDER "Designer/UI") # 链接第三方的库 # @1、链接的动作需要放到add_library之后 #----------------------------------------------------------------------------- -target_link_libraries(SolidDesignerCommand +target_link_libraries(SolidDesignerCommand PRIVATE AliceFoundation AliceBasicTool AliceCommandInterface diff --git a/Designer/UI/SolidDesignerCommand/GeneralCommands/SolidFileSaveCommand.cpp b/Designer/UI/SolidDesignerCommand/GeneralCommands/SolidFileSaveCommand.cpp index 7b4e8cb5..1683bad0 100644 --- a/Designer/UI/SolidDesignerCommand/GeneralCommands/SolidFileSaveCommand.cpp +++ b/Designer/UI/SolidDesignerCommand/GeneralCommands/SolidFileSaveCommand.cpp @@ -1,4 +1,4 @@ -#include "SolidFileSaveCommand.h" +#include "SolidFileSaveCommand.h" #include "AliceIMainWindow.h" #include "AliceIDocumentManager.h" @@ -66,7 +66,7 @@ std::unique_ptr SolidFileSaveCommand::Execute(const CommandParameter bool isSaveAs = false; if (hasFilePath_(*doc)) { - // ·ֱӱ + // 已有路径:直接保存 path = getFilePath_(*doc); isSaveAs = false; } @@ -84,7 +84,7 @@ std::unique_ptr SolidFileSaveCommand::Execute(const CommandParameter } - // ļͨ Undo/Redo + // 保存文件通常不进 Undo/Redo return nullptr; } @@ -143,7 +143,7 @@ bool SolidFileSaveCommand::saveDocument_(IDocument& doc, const std::wstring& pat //if (isSaveAs) //{ - // return m_docManager->SaveAs(doc, path); // TODO: API + // return m_docManager->SaveAs(doc, path); // TODO: 对齐你的 API //} //else //{ diff --git a/Designer/UI/SolidDesignerCommand/SolidDesignerCommand.h b/Designer/UI/SolidDesignerCommand/SolidDesignerCommand.h index d42fa738..9f133884 100644 --- a/Designer/UI/SolidDesignerCommand/SolidDesignerCommand.h +++ b/Designer/UI/SolidDesignerCommand/SolidDesignerCommand.h @@ -1,11 +1,16 @@ #pragma once #include "AliceMacroDefinitions.h" #include + +#if defined(_WIN32) #ifdef SOLID_DESIGNER_COMMAND_HOME #define SOLID_DESIGNER_COMMAND_EXPORT DLL_EXPORT #else #define SOLID_DESIGNER_COMMAND_EXPORT DLL_IMPORT #endif +#else +#define SOLID_DESIGNER_COMMAND_EXPORT __attribute__((visibility("default"))) +#endif #include "AliceGuidUtils.h" namespace soliddesignercommand diff --git a/Designer/UI/SolidDesignerUI/CMakeLists.txt b/Designer/UI/SolidDesignerUI/CMakeLists.txt index 1244dd53..e00d269e 100644 --- a/Designer/UI/SolidDesignerUI/CMakeLists.txt +++ b/Designer/UI/SolidDesignerUI/CMakeLists.txt @@ -111,7 +111,7 @@ endif() # 链接第三方的库 # @1、链接的动作需要放到add_library之后 #----------------------------------------------------------------------------- -target_link_libraries(SolidDesignerUI +target_link_libraries(SolidDesignerUI PRIVATE AliceBasicTool ) diff --git a/Designer/UI/SolidDesignerUI/SolidDesignerUI.h b/Designer/UI/SolidDesignerUI/SolidDesignerUI.h index 48702be4..60f06d24 100644 --- a/Designer/UI/SolidDesignerUI/SolidDesignerUI.h +++ b/Designer/UI/SolidDesignerUI/SolidDesignerUI.h @@ -2,12 +2,16 @@ // 此头文件包含DLL导出的宏 #include "AliceMacroDefinitions.h" #include + +#if defined(_WIN32) #ifdef ALICE_UI_ROBOT_HOME #define ALICE_UI_ROBOT_EXPORT DLL_EXPORT #else #define ALICE_UI_ROBOT_EXPORT DLL_IMPORT #endif - +#else +#define ALICE_UI_ROBOT_EXPORT __attribute__((visibility("default"))) +#endif namespace { diff --git a/Externals/pugixml/CMakeLists.txt b/Externals/pugixml/CMakeLists.txt index 527e1baf..9651c5b4 100644 --- a/Externals/pugixml/CMakeLists.txt +++ b/Externals/pugixml/CMakeLists.txt @@ -6,7 +6,9 @@ message("=====================================Start pugixml=======================================") message("${PROJECT_SOURCE_DIR}") -add_definitions(-D_WINDOWS) +if(WIN32) + add_definitions(-D_WINDOWS) +endif() FILE(GLOB SOURCE_CPP_FILES "${PROJECT_SOURCE_DIR}/Externals/pugixml/*.cpp") FILE(GLOB HEADER_H_FILES "${PROJECT_SOURCE_DIR}/Externals/pugixml/*.hpp") From 209a4c6736c9b58e7d918582facc9e2bd477412a Mon Sep 17 00:00:00 2001 From: Hubery Hsu Date: Sat, 20 Dec 2025 21:26:14 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E3=80=90#15=E3=80=91=20CMakeList=20should?= =?UTF-8?q?=20adapt=20to=20linux=20environment=20#90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Alice | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Alice b/Alice index 9783dd36..2c0fa708 160000 --- a/Alice +++ b/Alice @@ -1 +1 @@ -Subproject commit 9783dd363cddb0cdaaba5ef71138a63925c195ba +Subproject commit 2c0fa70860ddee7de179b531bf28a18758b14131