File tree Expand file tree Collapse file tree 8 files changed +31
-38
lines changed Expand file tree Collapse file tree 8 files changed +31
-38
lines changed Original file line number Diff line number Diff line change 18
18
compile
19
19
config.guess
20
20
config.h
21
- config.h.in
22
21
config.log
23
22
config.status
24
23
config.sub
Original file line number Diff line number Diff line change @@ -16,22 +16,28 @@ SET(PACKAGE_NAME "libnfc")
16
16
SET (PACKAGE_VERSION ${VERSION} )
17
17
SET (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION} " )
18
18
19
- # config.h
19
+ FIND_PACKAGE (Git)
20
+ IF (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR} /.git" )
21
+ EXECUTE_PROCESS (
22
+ COMMAND ${GIT_EXECUTABLE} describe
23
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
24
+ OUTPUT_VARIABLE GIT_REVISION
25
+ )
26
+ STRING (REGEX REPLACE "\n $" "" GIT_REVISION "${GIT_REVISION} " )
27
+ ENDIF (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR} /.git" )
28
+
20
29
IF (WIN32 )
21
- SET (LIBNFC_SYSCONFDIR "./config" CACHE PATH "libnfc configuration directory" )
22
- CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR} /cmake/config_windows.h.cmake ${CMAKE_CURRENT_BINARY_DIR} /config.h)
23
30
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} /contrib/win32 )
24
- IF (NOT MINGW)
25
- SET (CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE ${CMAKE_C_FLAGS} " )
26
- ENDIF (NOT MINGW)
31
+ SET (CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE ${CMAKE_C_FLAGS} " )
27
32
ELSE (WIN32 )
28
33
SET (_XOPEN_SOURCE 600)
29
- SET (SYSCONFDIR "/etc" CACHE PATH "System configuration directory" )
30
- CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR} /cmake/config_posix.h.cmake ${CMAKE_CURRENT_BINARY_DIR} /config.h)
31
34
ENDIF (WIN32 )
32
- INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR} )
33
35
36
+ # config.h
37
+ SET (LIBNFC_CONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR} /nfc" CACHE STRING "libnfc configuration directory" )
34
38
ADD_DEFINITIONS ("-DHAVE_CONFIG_H" )
39
+ CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR} /cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR} /config.h)
40
+ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR} )
35
41
36
42
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} /include )
37
43
Original file line number Diff line number Diff line change @@ -2,8 +2,7 @@ SUBDIRS = modules
2
2
3
3
EXTRA_DIST = \
4
4
FixBundle.cmake.in \
5
- config_posix.h.cmake \
6
- config_windows.h.cmake \
5
+ config.h.in \
7
6
LibNFCConfig.cmake.in \
8
7
LibNFCConfigVersion.cmake.in \
9
8
UseLibNFC.cmake
Original file line number Diff line number Diff line change
1
+ #ifdef _WIN32
2
+ #include "contrib/windows.h"
3
+ #endif
4
+
5
+ #cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
6
+ #cmakedefine GIT_REVISION "@GIT_REVISION@"
7
+ #cmakedefine _XOPEN_SOURCE @_XOPEN_SOURCE@
8
+ #cmakedefine LIBNFC_CONFDIR "@LIBNFC_CONFDIR@"
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -60,8 +60,12 @@ IF(LIBUSB_FOUND)
60
60
LINK_DIRECTORIES (${LIBUSB_LIBRARY_DIRS} )
61
61
ENDIF (LIBUSB_FOUND)
62
62
63
+ IF (LIBNFC_CONFFILES_MODE)
64
+ SET (CONF_SOURCES conf.c)
65
+ ENDIF (LIBNFC_CONFFILES_MODE)
66
+
63
67
# Library
64
- SET (LIBRARY_SOURCES nfc.c nfc-device.c nfc-emulation.c nfc-internal .c conf.c iso14443-subr.c mirror-subr.c target -subr.c ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES} ${WINDOWS_SOURCES} )
68
+ SET (LIBRARY_SOURCES nfc.c nfc-device.c nfc-emulation.c nfc-internal .c iso14443-subr.c mirror-subr.c target -subr.c ${DRIVERS_SOURCES} ${BUSES_SOURCES} ${CHIPS_SOURCES} ${WINDOWS_SOURCES} ${CONF_SOURCES } )
65
69
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} )
66
70
67
71
IF (LIBNFC_LOG)
Original file line number Diff line number Diff line change 30
30
31
31
#include "conf.h"
32
32
33
- #ifdef CONFFILES
34
33
#include <stdio.h>
35
34
#include <stdlib.h>
36
35
#include <ctype.h>
45
44
#define LOG_CATEGORY "libnfc.config"
46
45
#define LOG_GROUP NFC_LOG_GROUP_CONFIG
47
46
48
- #ifndef LIBNFC_SYSCONFDIR
49
- // If this define does not already exists, we build it using SYSCONFDIR
50
- #ifndef SYSCONFDIR
51
- #error "SYSCONFDIR is not defined but required."
52
- #endif // SYSCONFDIR
53
- #define LIBNFC_SYSCONFDIR SYSCONFDIR"/nfc"
54
- #endif // LIBNFC_SYSCONFDIR
55
-
56
- #define LIBNFC_CONFFILE LIBNFC_SYSCONFDIR"/libnfc.conf"
57
- #define LIBNFC_DEVICECONFDIR LIBNFC_SYSCONFDIR"/devices.d"
47
+ #define LIBNFC_CONFFILE LIBNFC_CONFDIR "/libnfc.conf"
48
+ #define LIBNFC_DEVICECONFDIR LIBNFC_CONFDIR "/devices.d"
58
49
59
50
static int
60
51
escaped_value (const char line [BUFSIZ ], int i , char * * value )
@@ -298,6 +289,3 @@ conf_load(nfc_context *context)
298
289
conf_parse_file (LIBNFC_CONFFILE , conf_keyvalue_context , context );
299
290
conf_devices_load (LIBNFC_DEVICECONFDIR , context );
300
291
}
301
-
302
- #endif // CONFFILES
303
-
You can’t perform that action at this time.
0 commit comments