Skip to content

Commit b4f4778

Browse files
committed
Fix zlayout_shared target build configuration
- Remove circular dependency between zlayout and zlayout_shared targets - Add proper include directories and compiler flags to zlayout_shared - Update CI workflow to build targets sequentially for better error handling - Fix 'invalid argument: zlayout_shared' error in CI builds
1 parent 08bd68a commit b4f4778

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

.github/workflows/docs.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,27 @@ jobs:
157157
- name: Build C++ library
158158
run: |
159159
Write-Host "Building C++ library..."
160-
xmake build zlayout zlayout_shared basic_example
160+
# Build core library first
161+
xmake build zlayout
161162
if (-not $?) {
162-
Write-Host "C++ library build failed"
163+
Write-Host "Static library build failed"
163164
exit 1
164165
}
166+
167+
# Build shared library
168+
xmake build zlayout_shared
169+
if (-not $?) {
170+
Write-Host "Shared library build failed"
171+
exit 1
172+
}
173+
174+
# Build examples
175+
xmake build basic_example
176+
if (-not $?) {
177+
Write-Host "Examples build failed"
178+
exit 1
179+
}
180+
165181
Write-Host "C++ library build completed successfully"
166182
167183
- name: Run C++ tests

xmake.lua

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,28 @@ target("zlayout")
9999
-- Shared library version
100100
target("zlayout_shared")
101101
set_kind("shared")
102-
add_deps("zlayout")
103102
add_files("src/zlayout.cpp")
104103
add_files("src/geometry/*.cpp")
105104
add_files("src/spatial/*.cpp")
106-
add_defines("ZLAYOUT_SHARED")
105+
add_headerfiles("include/zlayout/**.hpp")
106+
107+
-- Add include directories
108+
add_includedirs("include")
109+
add_includedirs("include/zlayout")
110+
111+
-- Math optimization (Linux/Unix only)
112+
if is_plat("linux", "macosx") then
113+
add_links("m") -- Link math library
114+
end
115+
116+
-- Optional OpenMP support for parallel processing
117+
if has_config("openmp") then
118+
add_packages("openmp")
119+
add_defines("ZLAYOUT_OPENMP")
120+
end
121+
122+
-- Export symbols for shared library
123+
add_defines("ZLAYOUT_EXPORTS", "ZLAYOUT_SHARED")
107124

108125
-- Visualization library (optional)
109126
if has_config("with-visualization") then

0 commit comments

Comments
 (0)