Skip to content

Commit

Permalink
Merge branch 'devel' of https://github.com/mlabbe/nativefiledialog in…
Browse files Browse the repository at this point in the history
…to devel
  • Loading branch information
mlabbe committed Aug 15, 2016
2 parents 6527087 + 7801362 commit 9784f06
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 93 deletions.
44 changes: 21 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Features:
- Paid support available.
- Multiple file selection support.
- 64-bit and 32-bit friendly.
- GCC, Clang and Visual Studio supported.
- GCC, Clang, Mingw and Visual Studio supported.
- No third party dependencies.
- Support for Vista's modern `IFileDialog` on Windows.
- Support for non-deprecated Cocoa APIs on OS X.
Expand Down Expand Up @@ -54,44 +54,39 @@ See [NFD.h](src/include/nfd.h) for more options.
![GTK3 on Linux](screens/open_gtk3.png?raw=true)
![Cocoa on Yosemite](screens/open_cocoa.png?raw=true)
## Changelog ##
The current version is 1.1.
release | what's new | date
--------|-----------------------------|---------
1.0 | initial | oct 2014
1.1 | premake5; scons deprecated | aug 2016
## Building ##
NFD uses [Premake5](https://premake.github.io/download.html) to generate Makefiles and IDE project files. The generated project files are checked in under `build/` so you don't have to download and use Premake in most cases.
NFD uses [Premake5](https://premake.github.io/download.html) generated Makefiles and IDE project files. The generated project files are checked in under `build/` so you don't have to download and use Premake in most cases.
If you need to run Premake5 directly, further [build documentation](docs/build.md) is available.
Previously, NFD used SCons to build. It still works, but is now deprecated; updates to it are discouraged. Opt to use the native build system where possible.
`nfd.a` will be built for release builds, and `nfd_d.a` will be built for debug builds.
### Makefiles ###
The makefile offers four options:
The makefile offers four options, with `release_x64` as the default.
make config=release_x86
make config=release_x64
make config=debug_x86
make config=debug_x64
### SCons build (deprecated) ###
NFD uses [SCons](http://www.scons.org) for cross-platform builds. After installing SCons, build it with:
cd src
scons debug=[0,1]
Alternatively, you can avoid Scons by just including NFD files to your existing project:
1. Add all header files in `src/` and `src/include` to your project.
2. Add `src/include` to your include search path or copy it into your existing search path.
3. Add `src/nfd_common.c` to your project.
4. Add `src/nfd_<platform>` to your project, where `<platform>` is the NFD backend for the platform you are fixing to build.
5. On Visual Studio, define `_CRT_SECURE_NO_WARNINGS` to avoid warnings.
### Compiling Your Programs ###
1. Add `src/include` to your include search path.
2. Add `nfd.lib` to the list of list of static libraries to link against.
3. Add `src/` to the library search path.
2. Add `nfd.lib` or `nfd_d.lib` to the list of list of static libraries to link against (for release or debug, respectively).
3. Add `build/<debug|release>/<arch>` to the library search path.
On Linux, you must compile and link against GTK+. Recommend use of `pkg-config --cflags --libs gtk+-3.0`.
Expand All @@ -103,11 +98,11 @@ On Windows, ensure you are building against `comctl32.lib`.
See `NFD.h` for API calls. See `tests/*.c` for example code.
See `tests/SConstruct` for a working build script that compiles on all platforms.
After compiling, `build/bin` contains compiled test programs.
## File Filter Syntax ##
There is a form of file filtering in every file dialog, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.
There is a form of file filtering in every file dialog API, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.
A wildcard filter is always added to every dialog.
Expand All @@ -130,12 +125,13 @@ See [test_opendialogmultiple.c](test/test_opendialogmultiple.c).
# Known Limitations #
I accept quality code patches, or will resolve these and other matters through support.
I accept quality code patches, or will resolve these and other matters through support. See [submitting pull requests](docs/submitting_pull_requests.md) for details.
- No support for Windows XP's legacy dialogs such as `GetOpenFileName`.
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, though.
- No support for selecting folders instead of files.
- On Linux, GTK+ cannot be uninitialized to save memory. Launching a file dialog costs memory. I am open to accepting an alternative `nfd_zenity.c` implementation which uses Zenity and pipes.
- No support for mingw building. Open to pull requests that support the new Premake build system AND contain build instructions that include how to install the toolchain from scratch.
# Copyright and Credit #
Expand All @@ -147,6 +143,8 @@ Native File Dialog by Michael Labbe
Tomasz Konojacki for [microutf8](http://puszcza.gnu.org.ua/software/microutf8/)
[Denis Kolodin](https://github.com/DenisKolodin) for mingw support.
## Support ##
Directed support for this work is available from the original author under a paid agreement.
Expand Down
1 change: 1 addition & 0 deletions build/dont_run_premake.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Premake-generated build systems are already checked in, in build subdirectories. Use one of them before attempting to run premake. See docs/build.md for more.
16 changes: 8 additions & 8 deletions build/gmake_windows/nfd.make
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ endif

ifeq ($(config),release_x64)
RESCOMP = windres
TARGETDIR = ../lib/Release/x64
TARGETDIR = ../../build/lib/Release/x64
TARGET = $(TARGETDIR)/nfd.lib
OBJDIR = ../obj/x64/Release/nfd
OBJDIR = ../../build/obj/x64/Release/nfd
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
Expand All @@ -39,9 +39,9 @@ endif

ifeq ($(config),release_x86)
RESCOMP = windres
TARGETDIR = ../lib/Release/x86
TARGETDIR = ../../build/lib/Release/x86
TARGET = $(TARGETDIR)/nfd.lib
OBJDIR = ../obj/x86/Release/nfd
OBJDIR = ../../build/obj/x86/Release/nfd
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
Expand All @@ -66,9 +66,9 @@ endif

ifeq ($(config),debug_x64)
RESCOMP = windres
TARGETDIR = ../lib/Debug/x64
TARGETDIR = ../../build/lib/Debug/x64
TARGET = $(TARGETDIR)/nfd_d.lib
OBJDIR = ../obj/x64/Debug/nfd
OBJDIR = ../../build/obj/x64/Debug/nfd
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
Expand All @@ -93,9 +93,9 @@ endif

ifeq ($(config),debug_x86)
RESCOMP = windres
TARGETDIR = ../lib/Debug/x86
TARGETDIR = ../../build/lib/Debug/x86
TARGET = $(TARGETDIR)/nfd_d.lib
OBJDIR = ../obj/x86/Debug/nfd
OBJDIR = ../../build/obj/x86/Debug/nfd
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
Expand Down
36 changes: 18 additions & 18 deletions build/gmake_windows/test_opendialog.make
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ endif

ifeq ($(config),release_x64)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialog.exe
OBJDIR = ../obj/x64/Release/test_opendialog
OBJDIR = ../../build/obj/x64/Release/test_opendialog
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += ../lib/Release/x64/nfd.lib
LDDEPS += ../lib/Release/x64/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../lib/Release/x64 -m64 -s
LIBS += ../../build/lib/Release/x64/nfd.lib -lole32 -luuid
LDDEPS += ../../build/lib/Release/x64/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../../build/lib/Release/x64 -m64 -s
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -39,19 +39,19 @@ endif

ifeq ($(config),release_x86)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialog.exe
OBJDIR = ../obj/x86/Release/test_opendialog
OBJDIR = ../../build/obj/x86/Release/test_opendialog
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += ../lib/Release/x86/nfd.lib
LDDEPS += ../lib/Release/x86/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../lib/Release/x86 -m32 -s
LIBS += ../../build/lib/Release/x86/nfd.lib -lole32 -luuid
LDDEPS += ../../build/lib/Release/x86/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../../build/lib/Release/x86 -m32 -s
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -66,19 +66,19 @@ endif

ifeq ($(config),debug_x64)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialog_d.exe
OBJDIR = ../obj/x64/Debug/test_opendialog
OBJDIR = ../../build/obj/x64/Debug/test_opendialog
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lnfd_d
LIBS += -lnfd_d -lole32 -luuid
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../lib/Debug/x64 -m64
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../../build/lib/Debug/x64 -m64
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -93,19 +93,19 @@ endif

ifeq ($(config),debug_x86)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialog_d.exe
OBJDIR = ../obj/x86/Debug/test_opendialog
OBJDIR = ../../build/obj/x86/Debug/test_opendialog
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lnfd_d
LIBS += -lnfd_d -lole32 -luuid
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../lib/Debug/x86 -m32
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../../build/lib/Debug/x86 -m32
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand Down
36 changes: 18 additions & 18 deletions build/gmake_windows/test_opendialogmultiple.make
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ endif

ifeq ($(config),release_x64)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialogmultiple.exe
OBJDIR = ../obj/x64/Release/test_opendialogmultiple
OBJDIR = ../../build/obj/x64/Release/test_opendialogmultiple
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += ../lib/Release/x64/nfd.lib
LDDEPS += ../lib/Release/x64/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../lib/Release/x64 -m64 -s
LIBS += ../../build/lib/Release/x64/nfd.lib -lole32 -luuid
LDDEPS += ../../build/lib/Release/x64/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../../build/lib/Release/x64 -m64 -s
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -39,19 +39,19 @@ endif

ifeq ($(config),release_x86)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialogmultiple.exe
OBJDIR = ../obj/x86/Release/test_opendialogmultiple
OBJDIR = ../../build/obj/x86/Release/test_opendialogmultiple
DEFINES += -DNDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += ../lib/Release/x86/nfd.lib
LDDEPS += ../lib/Release/x86/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../lib/Release/x86 -m32 -s
LIBS += ../../build/lib/Release/x86/nfd.lib -lole32 -luuid
LDDEPS += ../../build/lib/Release/x86/nfd.lib
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../../build/lib/Release/x86 -m32 -s
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -66,19 +66,19 @@ endif

ifeq ($(config),debug_x64)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialogmultiple_d.exe
OBJDIR = ../obj/x64/Debug/test_opendialogmultiple
OBJDIR = ../../build/obj/x64/Debug/test_opendialogmultiple
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lnfd_d
LIBS += -lnfd_d -lole32 -luuid
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../lib/Debug/x64 -m64
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../../build/lib/Debug/x64 -m64
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -93,19 +93,19 @@ endif

ifeq ($(config),debug_x86)
RESCOMP = windres
TARGETDIR = ../bin
TARGETDIR = ../../build/bin
TARGET = $(TARGETDIR)/test_opendialogmultiple_d.exe
OBJDIR = ../obj/x86/Debug/test_opendialogmultiple
OBJDIR = ../../build/obj/x86/Debug/test_opendialogmultiple
DEFINES += -DDEBUG
INCLUDES += -I../../src/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += -lnfd_d
LIBS += -lnfd_d -lole32 -luuid
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../lib/Debug/x86 -m32
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../../build/lib/Debug/x86 -m32
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand Down
Loading

0 comments on commit 9784f06

Please sign in to comment.