Skip to content

Commit c218f3c

Browse files
Merge pull request #1923 from miguelpruivo/fix/linux_build
refactor: remove `main_desktop.dart` and add Clang `stdlib=libc++`
2 parents 33476e1 + 3cd77ce commit c218f3c

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
if: matrix.os == 'ubuntu-latest'
7575
run: |
7676
sudo apt-get update
77-
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
77+
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libc++-dev libc++abi-dev
7878
7979
- name: Enable Linux desktop
8080
if: matrix.os == 'ubuntu-latest'

example/lib/main_desktop.dart

Lines changed: 0 additions & 8 deletions
This file was deleted.

example/lib/src/file_picker_demo.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class _FilePickerDemoState extends State<FilePickerDemo> {
7979
_resetState();
8080

8181
try {
82-
pickedFiles = (await FilePicker.platform.pickFiles(
82+
final result = await FilePicker.platform.pickFiles(
8383
type: _pickingType,
8484
allowMultiple: _multiPick,
8585
onFileLoading: (FilePickerStatus status) => setState(() {
@@ -92,8 +92,9 @@ class _FilePickerDemoState extends State<FilePickerDemo> {
9292
initialDirectory: _initialDirectoryController.text,
9393
lockParentWindow: _lockParentWindow,
9494
withData: true,
95-
))
96-
?.files;
95+
);
96+
printInDebug("pickedFiles: $result");
97+
pickedFiles = result?.files;
9798
hasUserAborted = pickedFiles == null;
9899
} on PlatformException catch (e) {
99100
_logException('Unsupported operation: $e');

example/linux/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ function(APPLY_STANDARD_SETTINGS TARGET)
4444
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
4545
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
4646
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
47+
48+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
49+
target_compile_options(${TARGET} PRIVATE -stdlib=libc++)
50+
target_link_options(${TARGET} PRIVATE -stdlib=libc++)
51+
endif()
4752
endfunction()
4853

4954
# Flutter library and tool build rules.

0 commit comments

Comments
 (0)