Skip to content

Commit 24cf44d

Browse files
fix: Windows Compile Session Issye
1 parent 9c2d6b8 commit 24cf44d

12 files changed

Lines changed: 34 additions & 15 deletions

File tree

base/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ add_subdirectory(device)
2121
# Create the unified static library
2222
add_library(cfbase STATIC)
2323

24+
# Define that we are building a static library (disables dllimport/dllexport)
25+
target_compile_definitions(cfbase PUBLIC CFBASE_STATIC_BUILD)
26+
2427
# Link static libraries from sub-modules
2528
target_link_libraries(cfbase PUBLIC
2629
cfbase_cpu

base/include/base/export.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
*/
3030

3131
#if defined(_WIN32) || defined(_MSC_VER)
32-
# ifdef CFBASE_EXPORTS
32+
# ifdef CFBASE_STATIC_BUILD
33+
# define CF_BASE_EXPORT
34+
# elif defined(CFBASE_EXPORTS)
3335
# define CF_BASE_EXPORT __declspec(dllexport)
3436
# else
3537
# define CF_BASE_EXPORT __declspec(dllimport)

desktop/main/early_session/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ target_include_directories(CFDesktopEarlySession PUBLIC ${CMAKE_CURRENT_SOURCE_D
1515

1616
# Link against cfbase to access device headers and other base utilities
1717
# Link against cflogger to access cflog.h
18+
# Link against CFDesktopLog for log_helper functions
1819
target_link_libraries(CFDesktopEarlySession PUBLIC
19-
cfbase cflogger cfasciiart cffilesystem
20+
cfbase cflogger cfasciiart cffilesystem CFDesktopLog
2021
Qt6::Core
2122
Qt6::Gui
2223
Qt6::Widgets)

scripts/lib/powershell/LibBuild.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ function Clean-BuildDir {
3636
}
3737

3838
# 安全检查:路径不能是根目录
39-
$normalizedPath = (Resolve-Path -LiteralPath $BuildPath -ErrorAction SilentlyContinue)?.Path ?? $BuildPath
39+
$resolvedPath = Resolve-Path -LiteralPath $BuildPath -ErrorAction SilentlyContinue
40+
if ($resolvedPath) {
41+
$normalizedPath = $resolvedPath.Path
42+
} else {
43+
$normalizedPath = $BuildPath
44+
}
4045
if ($normalizedPath -eq "" -or $normalizedPath -eq "/" -or $normalizedPath -eq "\") {
4146
Write-LogError "ERROR: Refusing to clean root directory!"
4247
return $false

ui/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ add_subdirectory(models)
2424

2525
add_library(cfui STATIC)
2626

27+
# Define that we are building a static library (disables dllimport/dllexport)
28+
target_compile_definitions(cfui PUBLIC CFUI_STATIC_BUILD)
29+
2730
# Link against STATIC libraries from sub-modules
2831
# Order: dependencies first (left), then dependents (right)
2932
# Static libraries are linked left-to-right, so dependents must come after their dependencies

ui/base/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ add_library(cf_ui_base STATIC
1212
easing.cpp
1313
)
1414

15-
# Define CFUI_EXPORTS so symbols are marked as dllexport when compiling for the DLL
16-
target_compile_definitions(cf_ui_base PRIVATE CFUI_EXPORTS)
15+
# Define CFUI_STATIC_BUILD so symbols are NOT marked as dllexport when compiling for static library
16+
target_compile_definitions(cf_ui_base PUBLIC CFUI_STATIC_BUILD)
1717

1818
# Add include directories so headers can be found with ui/base/ prefix
1919
# We need to add the ui parent directory so that ui/base/math_helper.h works

ui/components/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ add_library(cf_ui_components STATIC
1313
timing_animation.cpp
1414
)
1515

16+
# Define CFUI_STATIC_BUILD so symbols are NOT marked as dllexport when compiling for static library
17+
target_compile_definitions(cf_ui_components PUBLIC CFUI_STATIC_BUILD)
18+
1619
# Add include directories
1720
target_include_directories(cf_ui_components PUBLIC
1821
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

ui/components/material/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ add_library(cf_ui_components_material STATIC
1212
cfmaterial_animation_strategy.cpp
1313
)
1414

15-
# Define CFUI_EXPORTS so symbols are marked as dllexport when compiling for the DLL
16-
target_compile_definitions(cf_ui_components_material PRIVATE CFUI_EXPORTS)
15+
# Define CFUI_STATIC_BUILD so symbols are NOT marked as dllexport when compiling for static library
16+
target_compile_definitions(cf_ui_components_material PUBLIC CFUI_STATIC_BUILD)
1717

1818
# Add include directories
1919
target_include_directories(cf_ui_components_material PUBLIC

ui/core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ add_library(cf_ui_core STATIC
1515
theme_manager.cpp
1616
)
1717

18-
# Define CFUI_EXPORTS so symbols are marked as dllexport when compiling for the DLL
19-
target_compile_definitions(cf_ui_core PRIVATE CFUI_EXPORTS)
18+
# Define CFUI_STATIC_BUILD so symbols are NOT marked as dllexport when compiling for static library
19+
target_compile_definitions(cf_ui_core PUBLIC CFUI_STATIC_BUILD)
2020

2121
# Link against material sub-module and base
2222
target_link_libraries(cf_ui_core PUBLIC

ui/core/material/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ add_library(cf_ui_core_material STATIC
1212
material_factory.cpp
1313
)
1414

15-
# Define CFUI_EXPORTS so symbols are marked as dllexport when compiling for the DLL
16-
target_compile_definitions(cf_ui_core_material PRIVATE CFUI_EXPORTS)
15+
# Define CFUI_STATIC_BUILD so symbols are NOT marked as dllexport when compiling for static library
16+
target_compile_definitions(cf_ui_core_material PUBLIC CFUI_STATIC_BUILD)
1717

1818
# Add include directories
1919
target_include_directories(cf_ui_core_material PUBLIC

0 commit comments

Comments
 (0)