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 1818compile
1919config.guess
2020config.h
21- config.h.in
2221config.log
2322config.status
2423config.sub
Original file line number Diff line number Diff line change @@ -16,22 +16,28 @@ SET(PACKAGE_NAME "libnfc")
1616SET (PACKAGE_VERSION ${VERSION} )
1717SET (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION} " )
1818
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+
2029IF (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)
2330 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} " )
2732ELSE (WIN32 )
2833 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)
3134ENDIF (WIN32 )
32- INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR} )
3335
36+ # config.h
37+ SET (LIBNFC_CONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR} /nfc" CACHE STRING "libnfc configuration directory" )
3438ADD_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} )
3541
3642INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} /include )
3743
Original file line number Diff line number Diff line change @@ -2,8 +2,7 @@ SUBDIRS = modules
22
33EXTRA_DIST = \
44 FixBundle.cmake.in \
5- config_posix.h.cmake \
6- config_windows.h.cmake \
5+ config.h.in \
76 LibNFCConfig.cmake.in \
87 LibNFCConfigVersion.cmake.in \
98 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)
6060 LINK_DIRECTORIES (${LIBUSB_LIBRARY_DIRS} )
6161ENDIF (LIBUSB_FOUND)
6262
63+ IF (LIBNFC_CONFFILES_MODE)
64+ SET (CONF_SOURCES conf.c)
65+ ENDIF (LIBNFC_CONFFILES_MODE)
66+
6367# 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 } )
6569INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} )
6670
6771IF (LIBNFC_LOG)
Original file line number Diff line number Diff line change 3030
3131#include "conf.h"
3232
33- #ifdef CONFFILES
3433#include <stdio.h>
3534#include <stdlib.h>
3635#include <ctype.h>
4544#define LOG_CATEGORY "libnfc.config"
4645#define LOG_GROUP NFC_LOG_GROUP_CONFIG
4746
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"
5849
5950static int
6051escaped_value (const char line [BUFSIZ ], int i , char * * value )
@@ -298,6 +289,3 @@ conf_load(nfc_context *context)
298289 conf_parse_file (LIBNFC_CONFFILE , conf_keyvalue_context , context );
299290 conf_devices_load (LIBNFC_DEVICECONFDIR , context );
300291}
301-
302- #endif // CONFFILES
303-
You can’t perform that action at this time.
0 commit comments