Skip to content

Commit 05fa4f8

Browse files
fix: ship Debug and Release libs in Windows package (#1298) (#1301)
Install libs to lib/<config>/ on multi-config generators so both runtimes (/MD and /MDd) coexist in the same package. CI now builds both configurations before running cpack.
1 parent 9519806 commit 05fa4f8

2 files changed

Lines changed: 54 additions & 8 deletions

File tree

.github/workflows/release.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ jobs:
5959
- name: "Install cmake"
6060
uses: lukka/get-cmake@latest
6161

62-
- name: "Build packages"
62+
- name: "Build packages (Linux / macOS)"
63+
if: runner.os != 'Windows'
6364
run: >
6465
mkdir build;
6566
cd build;
@@ -74,6 +75,24 @@ jobs:
7475
-DFTXUI_DEV_WARNINGS=ON ;
7576
cmake --build . --target package;
7677
78+
- name: "Build packages (Windows — Debug + Release)"
79+
if: runner.os == 'Windows'
80+
shell: pwsh
81+
run: |
82+
mkdir build
83+
cd build
84+
cmake .. `
85+
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }} `
86+
-DFTXUI_BUILD_DOCS=OFF `
87+
-DFTXUI_BUILD_EXAMPLES=OFF `
88+
-DFTXUI_BUILD_TESTS=OFF `
89+
-DFTXUI_BUILD_TESTS_FUZZER=OFF `
90+
-DFTXUI_ENABLE_INSTALL=ON `
91+
-DFTXUI_DEV_WARNINGS=OFF
92+
cmake --build . --config Debug
93+
cmake --build . --config Release
94+
cpack -C "Debug;Release"
95+
7796
- uses: shogo82148/actions-upload-release-asset@v1
7897
with:
7998
upload_url: ${{ needs.release.outputs.upload_url }}

cmake/ftxui_install.cmake

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,42 @@ include(GNUInstallDirs)
66
include(CMakePackageConfigHelpers)
77

88
# ------------------------------------------------------------------------------
9-
# Install the library and its public headers into the standard subdirectories
9+
# Install the library and its public headers into the standard subdirectories.
10+
# On multi-config generators (e.g. Visual Studio) both Debug and Release are
11+
# installed into separate lib/<config>/ subdirectories so they can coexist in
12+
# the same package without overwriting each other. Single-config generators
13+
# (Ninja, Make) keep the traditional flat lib/ layout.
14+
# Generator expressions in DESTINATION require CMake 3.20.
1015
# ------------------------------------------------------------------------------
11-
install(
12-
TARGETS screen dom component ftxui
13-
EXPORT ftxui-targets
14-
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
15-
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
16-
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
16+
get_property(_ftxui_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
17+
if(_ftxui_isMultiConfig)
18+
if(CMAKE_VERSION VERSION_LESS "3.20")
19+
message(WARNING
20+
"FTXUI: CMake >= 3.20 is required to install Debug and Release "
21+
"libraries into separate subdirectories on multi-config generators. "
22+
"Falling back to a flat lib/ layout (the two configurations will "
23+
"overwrite each other). Please upgrade CMake.")
24+
set(_ftxui_isMultiConfig FALSE)
25+
endif()
26+
endif()
27+
28+
if(_ftxui_isMultiConfig)
29+
install(
30+
TARGETS screen dom component ftxui
31+
EXPORT ftxui-targets
32+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/$<CONFIG>"
33+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/$<CONFIG>"
34+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/$<CONFIG>"
35+
)
36+
else()
37+
install(
38+
TARGETS screen dom component ftxui
39+
EXPORT ftxui-targets
40+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
41+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
42+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
1743
)
44+
endif()
1845

1946
install(
2047
DIRECTORY include/ftxui

0 commit comments

Comments
 (0)