msink / kotlin-libui

Kotlin/Native interop to libui: a portable GUI library
MIT License
648 stars 49 forks source link

Can we have a OpenFolderDialog()? #18

Closed SimonSchubert closed 5 years ago

SimonSchubert commented 5 years ago

I found OpenFileDialog very useful and would like to have the same for folders. If you don't have time for it I can try to dig into it.

msink commented 5 years ago

It have to be implemented in upstream C libui See andlabs/libui#190

SimonSchubert commented 5 years ago

Ok that doesn't look too promising. Thanks for the quick reply.

msink commented 5 years ago

Well, we can switch to building libui.a from sources on Travis/Appveyor, then it will be possible to implement things like this. Not sure that it's good idea, but as upsteam development seems to be frozen...

But then we will need to test it on all supported platforms - and I currently do not know how.

SimonSchubert commented 5 years ago

Any news?

To be honest I have zero experience with Travis/Appveyor yet. But I would like to have look into it if you could give me a hint where to start.

I can do testing on Osx and Linux.

msink commented 5 years ago

Will try to do something, but only after New Year, I'm afraid.

msink commented 5 years ago

Ok, please test that it works in "controlgallery" sample on Linus and Mac, on Windows I tested myself. If works as expected - will switch to that version. https://github.com/msink/libui/releases/tag/alpha4.1-openfolder

SimonSchubert commented 5 years ago

Great news! I will test and report tomorrow morning(beeing on a day trip today).

SimonSchubert commented 5 years ago

Update: I could get it building by setting "SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)" inside the CMakeLists.txt before "project(libui)". How to proceed now?

I failed to build the project on osx.

Software: cmake 3.12.3 xcode 10.1 OS X 10.9 command line developer tool: 2354 (xcode-select --install)

What I did: mkdir build cd build cmake .. (cmake VERBOSE=1 -std=libc++ ..)

CMakeError.log:

Determining if the CXX compiler works failed with the following output: Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_157ab/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_157ab.dir/build.make CMakeFiles/cmTC_157ab.dir/build Building CXX object CMakeFiles/cmTC_157ab.dir/testCXXCompiler.cxx.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -o CMakeFiles/cmTC_157ab.dir/testCXXCompiler.cxx.o -c /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] 1 warning generated. Linking CXX executable cmTC_157ab /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_157ab.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_157ab.dir/testCXXCompiler.cxx.o -o cmTC_157ab clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated] ld: library not found for -lstdc++ clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [cmTC_157ab] Error 1 make: [cmTC_157ab/fast] Error 2

CMakeOutput.log:

The system is: Darwin - 18.2.0 - x86_64 Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc Build flags: Id flags:

The output was: 0

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is AppleClang, found in "/Users/simon/projects/libui/build/CMakeFiles/3.12.3/CompilerIdC/a.out"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ Build flags: Id flags:

The output was: 0

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is AppleClang, found in "/Users/simon/projects/libui/build/CMakeFiles/3.12.3/CompilerIdCXX/a.out"

Determining if the C compiler works passed with the following output: Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_aa08c/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_aa08c.dir/build.make CMakeFiles/cmTC_aa08c.dir/build Building C object CMakeFiles/cmTC_aa08c.dir/testCCompiler.c.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -o CMakeFiles/cmTC_aa08c.dir/testCCompiler.c.o -c /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTC_aa08c /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_aa08c.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_aa08c.dir/testCCompiler.c.o -o cmTC_aa08c

Detecting C compiler ABI info compiled with the following output: Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_66f2f/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_66f2f.dir/build.make CMakeFiles/cmTC_66f2f.dir/build Building C object CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -o CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o -c /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/CMakeCCompilerABI.c Linking C executable cmTC_66f2f /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_66f2f.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -v -Wl,-v CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o -o cmTC_66f2f Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.8.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -o cmTC_66f2f -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a @(#)PROGRAM:ld PROJECT:ld64-409.12 BUILD 17:47:51 Sep 25 2018 configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32 Library search paths: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib Framework search paths: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/

Parsed C implicit link information from above output: link line regex: [^( |.[/])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/]+-)?ld|collect2)[^/]*( |$)] ignore line: [Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp] ignore line: [] ignore line: [Run Build Command:"/usr/bin/make" "cmTC_66f2f/fast"] ignore line: [/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_66f2f.dir/build.make CMakeFiles/cmTC_66f2f.dir/build] ignore line: [Building C object CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o] ignore line: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -o CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o -c /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/CMakeCCompilerABI.c] ignore line: [Linking C executable cmTC_66f2f] ignore line: [/usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_66f2f.dir/link.txt --verbose=1] ignore line: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -v -Wl,-v CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o -o cmTC_66f2f ] ignore line: [Apple LLVM version 10.0.0 (clang-1000.11.45.5)] ignore line: [Target: x86_64-apple-darwin18.2.0] ignore line: [Thread model: posix] ignore line: [InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin] link line: [ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.8.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -o cmTC_66f2f -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a] arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld] ==> ignore arg [-demangle] ==> ignore arg [-lto_library] ==> ignore, skip following value arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib] ==> skip value of -lto_library arg [-dynamic] ==> ignore arg [-arch] ==> ignore arg [x86_64] ==> ignore arg [-macosx_version_min] ==> ignore arg [10.8.0] ==> ignore arg [-syslibroot] ==> ignore arg [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk] ==> ignore arg [-o] ==> ignore arg [cmTC_66f2f] ==> ignore arg [-search_paths_first] ==> ignore arg [-headerpad_max_install_names] ==> ignore arg [-v] ==> ignore arg [CMakeFiles/cmTC_66f2f.dir/CMakeCCompilerABI.c.o] ==> ignore arg [-lSystem] ==> lib [System] arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a] ==> lib [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a] Library search paths: [;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib] Framework search paths: [;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/] remove lib [System] remove lib [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a] collapse library dir [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib] ==> [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib] collapse framework dir [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/] ==> [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks] implicit libs: [] implicit dirs: [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib] implicit fwks: [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks]

Detecting C [-std=c11] compiler features compiled with the following output: Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_4b2a8/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_4b2a8.dir/build.make CMakeFiles/cmTC_4b2a8.dir/build Building C object CMakeFiles/cmTC_4b2a8.dir/feature_tests.c.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -std=c11 -o CMakeFiles/cmTC_4b2a8.dir/feature_tests.c.o -c /Users/simon/projects/libui/build/CMakeFiles/feature_tests.c Linking C executable cmTC_4b2a8 /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4b2a8.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_4b2a8.dir/feature_tests.c.o -o cmTC_4b2a8

Feature record: C_FEATURE:1c_function_prototypes
Feature record: C_FEATURE:1c_restrict
Feature record: C_FEATURE:1c_static_assert
Feature record: C_FEATURE:1c_variadic_macros

Detecting C [-std=c99] compiler features compiled with the following output: Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_a6506/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_a6506.dir/build.make CMakeFiles/cmTC_a6506.dir/build Building C object CMakeFiles/cmTC_a6506.dir/feature_tests.c.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -std=c99 -o CMakeFiles/cmTC_a6506.dir/feature_tests.c.o -c /Users/simon/projects/libui/build/CMakeFiles/feature_tests.c Linking C executable cmTC_a6506 /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a6506.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_a6506.dir/feature_tests.c.o -o cmTC_a6506

Feature record: C_FEATURE:1c_function_prototypes
Feature record: C_FEATURE:1c_restrict
Feature record: C_FEATURE:0c_static_assert
Feature record: C_FEATURE:1c_variadic_macros

Detecting C [-std=c90] compiler features compiled with the following output: Change Dir: /Users/simon/projects/libui/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_30d46/fast" /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_30d46.dir/build.make CMakeFiles/cmTC_30d46.dir/build Building C object CMakeFiles/cmTC_30d46.dir/feature_tests.c.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -std=c90 -o CMakeFiles/cmTC_30d46.dir/feature_tests.c.o -c /Users/simon/projects/libui/build/CMakeFiles/feature_tests.c Linking C executable cmTC_30d46 /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_30d46.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_30d46.dir/feature_tests.c.o -o cmTC_30d46

Feature record: C_FEATURE:1c_function_prototypes
Feature record: C_FEATURE:0c_restrict
Feature record: C_FEATURE:0c_static_assert
Feature record: C_FEATURE:0c_variadic_macros

Do you have any hint how to succeed? I keep trying but I still have a lot to learn in this area.

msink commented 5 years ago

You do not have to build it - it was built on Travis CI. Just download examples-alpha4.1+openfolder-darwin-amd64-static.tgz on Mac or examples-alpha4.1+openfolder-linux-amd64-static.tgz on Linux, unpack it and check that controlgallery works as expected.

SimonSchubert commented 5 years ago

Of course Travis CI did the build, I should have known better.

Awesome, it works like a charm on OS X 10.9 and Linux Manjaro Gnome 18.0.1 64Bit. Tested: Open File/Open Folder/Save File

msink commented 5 years ago

Done, version 0.1.1 published to jcenter.

SimonSchubert commented 5 years ago

Thanks, I could succesfully use it in a private project. I'm also working on another kotlin native + libui project which I will make public on github soon. I will let you know.

Also: I'm happy to add screenshots for Linux+Mac examples next week.