Skip to content

Commit 67345b8

Browse files
committed
Merge branch 'devel'
2 parents b58794c + 244e256 commit 67345b8

44 files changed

Lines changed: 1098 additions & 1624 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ Features:
1919
- Optional Zenity support on Linux to avoid linking GTK.
2020
- Tested, works alongside [http://www.libsdl.org](SDL2) on all platforms, for the game developers out there.
2121

22-
**Note:** I am considering deprecating mingw support on Windows. Please contribute your thoughts at [this issue](https://github.com/mlabbe/nativefiledialog/issues/68).
23-
2422
# Example Usage #
2523

2624
```C
@@ -49,7 +47,7 @@ int main( void )
4947
}
5048
```
5149
52-
See [NFD.h](src/include/nfd.h) for more options.
50+
See self-documenting API [NFD.h](src/include/nfd.h) for more options.
5351
5452
# Screenshots #
5553
@@ -59,33 +57,40 @@ See [NFD.h](src/include/nfd.h) for more options.
5957
6058
## Changelog ##
6159
60+
- **Major** version increments denote API or ABI departure.
61+
- **Minor** version increments denote build or trivial departures.
62+
- **Micro** version increments just recompile and drop-in.
63+
6264
release | what's new | date
6365
--------|-----------------------------|---------
6466
1.0.0 | initial | oct 2014
6567
1.1.0 | premake5; scons deprecated | aug 2016
6668
1.1.1 | mingw support, build fixes | aug 2016
6769
1.1.2 | test_pickfolder() added | aug 2016
6870
1.1.3 | zenity linux backend added | nov 2017
69-
1.1.3 | fix char type in decls | nov 2017
71+
<i></i> | fix char type in decls | nov 2017
7072
1.1.4 | fix win32 memleaks | dec 2018
71-
1.1.4 | improve win32 errorhandling | dec 2018
72-
1.1.4 | macos fix focus bug | dec 2018
73+
<i></i> | improve win32 errorhandling | dec 2018
74+
<i></i> | macos fix focus bug | dec 2018
7375
1.1.5 | win32 fix com reinitialize | aug 2019
74-
76+
1.1.6 | fix osx filter bug | aug 2019
77+
<i></i> | remove deprecated scons | aug 2019
78+
<i></i> | fix mingw compilation | aug 2019
79+
<i></i> | -Wextra warning cleanup | aug 2019
7580
7681
## Building ##
7782
7883
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.
7984
8085
If you need to run Premake5 directly, further [build documentation](docs/build.md) is available.
8186
82-
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.
87+
Previously, NFD used SCons to build. As of 1.1.6, SCons support has been removed entirely.
8388
8489
`nfd.a` will be built for release builds, and `nfd_d.a` will be built for debug builds.
8590
8691
### Makefiles ###
8792
88-
The makefile offers five options, with `release_x64` as the default.
93+
The makefile offers up to four options, with `release_x64` as the default.
8994
9095
make config=release_x86
9196
make config=release_x64
@@ -99,6 +104,7 @@ The makefile offers five options, with `release_x64` as the default.
99104
3. Add `build/<debug|release>/<arch>` to the library search path.
100105
101106
#### Linux GTK ####
107+
102108
`apt-get libgtk-3-dev` installs the gtk dependency for library compilation.
103109
104110
On Linux, you have the option of compiling and linking against GTK. If you use it, the recommended way to compile is to include the arguments of `pkg-config --cflags --libs gtk+-3.0`.
@@ -108,16 +114,18 @@ On Linux, you have the option of compiling and linking against GTK. If you use
108114
Alternatively, you can use the Zenity backend by running the Makefile in `build/gmake_linux_zenity`. Zenity runs the dialog in its own address space, but requires the user to have Zenity correctly installed and configured on their system.
109115
110116
#### MacOS ####
117+
111118
On Mac OS, add `AppKit` to the list of frameworks.
112119
113120
#### Windows ####
114-
On Windows, ensure you are building against `comctl32.lib`.
121+
122+
On Windows, ensure you are linking against `comctl32.lib`.
115123
116124
## Usage ##
117125
118126
See `NFD.h` for API calls. See `tests/*.c` for example code.
119127
120-
After compiling, `build/bin` contains compiled test programs.
128+
After compiling, `build/bin` contains compiled test programs. The appropriate subdirectory under `build/lib` contains the built library.
121129
122130
## File Filter Syntax ##
123131
@@ -144,10 +152,12 @@ See [test_opendialogmultiple.c](test/test_opendialogmultiple.c).
144152
145153
# Known Limitations #
146154
147-
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.
155+
I accept quality code patches, or will resolve these and other matters through support. See [contributing](docs/contributing.md) for details.
148156
149157
- No support for Windows XP's legacy dialogs such as `GetOpenFileName`.
150158
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, however.
159+
- GTK Zenity implementation's process exec error handling does not gracefully handle numerous error cases, choosing to abort rather than cleanup and return.
160+
- GTK 3 spams one warning per dialog created.
151161
152162
# Copyright and Credit #
153163

build/gmake_linux/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ help:
9898
@echo " test_opendialogmultiple"
9999
@echo " test_savedialog"
100100
@echo ""
101-
@echo "For more information, see http://industriousone.com/premake/quick-start"
101+
@echo "For more information, see https://github.com/premake/premake-core/wiki"

build/gmake_linux/nfd.make

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ ifeq ($(config),release_x64)
1919
INCLUDES += -I../../src/include
2020
FORCE_INCLUDE +=
2121
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
22-
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fno-exceptions `pkg-config --cflags gtk+-3.0`
23-
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -fno-exceptions `pkg-config --cflags gtk+-3.0`
22+
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
23+
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
2424
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
2525
LIBS +=
2626
LDDEPS +=
@@ -46,8 +46,8 @@ ifeq ($(config),release_x86)
4646
INCLUDES += -I../../src/include
4747
FORCE_INCLUDE +=
4848
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
49-
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fno-exceptions `pkg-config --cflags gtk+-3.0`
50-
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -fno-exceptions `pkg-config --cflags gtk+-3.0`
49+
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
50+
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
5151
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
5252
LIBS +=
5353
LDDEPS +=
@@ -73,8 +73,8 @@ ifeq ($(config),debug_x64)
7373
INCLUDES += -I../../src/include
7474
FORCE_INCLUDE +=
7575
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
76-
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -fno-exceptions `pkg-config --cflags gtk+-3.0`
77-
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -fno-exceptions `pkg-config --cflags gtk+-3.0`
76+
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
77+
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
7878
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
7979
LIBS +=
8080
LDDEPS +=
@@ -100,8 +100,8 @@ ifeq ($(config),debug_x86)
100100
INCLUDES += -I../../src/include
101101
FORCE_INCLUDE +=
102102
ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES)
103-
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g -fno-exceptions `pkg-config --cflags gtk+-3.0`
104-
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g -fno-exceptions `pkg-config --cflags gtk+-3.0`
103+
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
104+
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g -Wall -Wextra -fno-exceptions `pkg-config --cflags gtk+-3.0`
105105
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
106106
LIBS +=
107107
LDDEPS +=
@@ -126,23 +126,33 @@ RESOURCES := \
126126

127127
CUSTOMFILES := \
128128

129-
SHELLTYPE := msdos
130-
ifeq (,$(ComSpec)$(COMSPEC))
131-
SHELLTYPE := posix
132-
endif
133-
ifeq (/bin,$(findstring /bin,$(SHELL)))
134-
SHELLTYPE := posix
129+
SHELLTYPE := posix
130+
ifeq (.exe,$(findstring .exe,$(ComSpec)))
131+
SHELLTYPE := msdos
135132
endif
136133

137-
$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES)
134+
$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR)
138135
@echo Linking nfd
136+
$(SILENT) $(LINKCMD)
137+
$(POSTBUILDCMDS)
138+
139+
$(CUSTOMFILES): | $(OBJDIR)
140+
141+
$(TARGETDIR):
142+
@echo Creating $(TARGETDIR)
139143
ifeq (posix,$(SHELLTYPE))
140144
$(SILENT) mkdir -p $(TARGETDIR)
141145
else
142146
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
143147
endif
144-
$(SILENT) $(LINKCMD)
145-
$(POSTBUILDCMDS)
148+
149+
$(OBJDIR):
150+
@echo Creating $(OBJDIR)
151+
ifeq (posix,$(SHELLTYPE))
152+
$(SILENT) mkdir -p $(OBJDIR)
153+
else
154+
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
155+
endif
146156

147157
clean:
148158
@echo Cleaning nfd
@@ -161,32 +171,19 @@ prelink:
161171
$(PRELINKCMDS)
162172

163173
ifneq (,$(PCH))
164-
$(OBJECTS): $(GCH) $(PCH)
165-
$(GCH): $(PCH)
174+
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
175+
$(GCH): $(PCH) | $(OBJDIR)
166176
@echo $(notdir $<)
167-
ifeq (posix,$(SHELLTYPE))
168-
$(SILENT) mkdir -p $(OBJDIR)
169-
else
170-
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
171-
endif
172177
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
178+
else
179+
$(OBJECTS): | $(OBJDIR)
173180
endif
174181

175182
$(OBJDIR)/nfd_common.o: ../../src/nfd_common.c
176183
@echo $(notdir $<)
177-
ifeq (posix,$(SHELLTYPE))
178-
$(SILENT) mkdir -p $(OBJDIR)
179-
else
180-
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
181-
endif
182184
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
183185
$(OBJDIR)/nfd_gtk.o: ../../src/nfd_gtk.c
184186
@echo $(notdir $<)
185-
ifeq (posix,$(SHELLTYPE))
186-
$(SILENT) mkdir -p $(OBJDIR)
187-
else
188-
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
189-
endif
190187
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
191188

192189
-include $(OBJECTS:%.o=%.d)

build/gmake_linux/test_opendialog.make

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ifeq ($(config),release_x64)
2424
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
2525
LIBS += ../lib/Release/x64/libnfd.a
2626
LDDEPS += ../lib/Release/x64/libnfd.a
27-
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../lib/Release/x64 -m64 -s -lnfd `pkg-config --libs gtk+-3.0`
27+
ALL_LDFLAGS += $(LDFLAGS) -L../lib/Release/x64 -L/usr/lib64 -m64 -s -lnfd `pkg-config --libs gtk+-3.0`
2828
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
2929
define PREBUILDCMDS
3030
endef
@@ -51,7 +51,7 @@ ifeq ($(config),release_x86)
5151
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
5252
LIBS += ../lib/Release/x86/libnfd.a
5353
LDDEPS += ../lib/Release/x86/libnfd.a
54-
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../lib/Release/x86 -m32 -s -lnfd `pkg-config --libs gtk+-3.0`
54+
ALL_LDFLAGS += $(LDFLAGS) -L../lib/Release/x86 -L/usr/lib32 -m32 -s -lnfd `pkg-config --libs gtk+-3.0`
5555
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
5656
define PREBUILDCMDS
5757
endef
@@ -78,7 +78,7 @@ ifeq ($(config),debug_x64)
7878
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
7979
LIBS += -lnfd_d
8080
LDDEPS +=
81-
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -L../lib/Debug/x64 -m64 -lnfd_d `pkg-config --libs gtk+-3.0`
81+
ALL_LDFLAGS += $(LDFLAGS) -L../lib/Debug/x64 -L/usr/lib64 -m64 -lnfd_d `pkg-config --libs gtk+-3.0`
8282
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
8383
define PREBUILDCMDS
8484
endef
@@ -105,7 +105,7 @@ ifeq ($(config),debug_x86)
105105
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
106106
LIBS += -lnfd_d
107107
LDDEPS +=
108-
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -L../lib/Debug/x86 -m32 -lnfd_d `pkg-config --libs gtk+-3.0`
108+
ALL_LDFLAGS += $(LDFLAGS) -L../lib/Debug/x86 -L/usr/lib32 -m32 -lnfd_d `pkg-config --libs gtk+-3.0`
109109
LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
110110
define PREBUILDCMDS
111111
endef
@@ -125,23 +125,33 @@ RESOURCES := \
125125

126126
CUSTOMFILES := \
127127

128-
SHELLTYPE := msdos
129-
ifeq (,$(ComSpec)$(COMSPEC))
130-
SHELLTYPE := posix
131-
endif
132-
ifeq (/bin,$(findstring /bin,$(SHELL)))
133-
SHELLTYPE := posix
128+
SHELLTYPE := posix
129+
ifeq (.exe,$(findstring .exe,$(ComSpec)))
130+
SHELLTYPE := msdos
134131
endif
135132

136-
$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES)
133+
$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR)
137134
@echo Linking test_opendialog
135+
$(SILENT) $(LINKCMD)
136+
$(POSTBUILDCMDS)
137+
138+
$(CUSTOMFILES): | $(OBJDIR)
139+
140+
$(TARGETDIR):
141+
@echo Creating $(TARGETDIR)
138142
ifeq (posix,$(SHELLTYPE))
139143
$(SILENT) mkdir -p $(TARGETDIR)
140144
else
141145
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
142146
endif
143-
$(SILENT) $(LINKCMD)
144-
$(POSTBUILDCMDS)
147+
148+
$(OBJDIR):
149+
@echo Creating $(OBJDIR)
150+
ifeq (posix,$(SHELLTYPE))
151+
$(SILENT) mkdir -p $(OBJDIR)
152+
else
153+
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
154+
endif
145155

146156
clean:
147157
@echo Cleaning test_opendialog
@@ -160,24 +170,16 @@ prelink:
160170
$(PRELINKCMDS)
161171

162172
ifneq (,$(PCH))
163-
$(OBJECTS): $(GCH) $(PCH)
164-
$(GCH): $(PCH)
173+
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
174+
$(GCH): $(PCH) | $(OBJDIR)
165175
@echo $(notdir $<)
166-
ifeq (posix,$(SHELLTYPE))
167-
$(SILENT) mkdir -p $(OBJDIR)
168-
else
169-
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
170-
endif
171176
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
177+
else
178+
$(OBJECTS): | $(OBJDIR)
172179
endif
173180

174181
$(OBJDIR)/test_opendialog.o: ../../test/test_opendialog.c
175182
@echo $(notdir $<)
176-
ifeq (posix,$(SHELLTYPE))
177-
$(SILENT) mkdir -p $(OBJDIR)
178-
else
179-
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
180-
endif
181183
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
182184

183185
-include $(OBJECTS:%.o=%.d)

0 commit comments

Comments
 (0)