Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with CMake #58

Merged
merged 1 commit into from
Apr 24, 2017
Merged

Fix build with CMake #58

merged 1 commit into from
Apr 24, 2017

Conversation

swalkner
Copy link

As discussed in #57
Please review my changes.
Thanks, stefan

@smortex smortex mentioned this pull request Apr 15, 2017
@smortex smortex self-requested a review April 15, 2017 10:48
Copy link
Contributor

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has some suspect aspects I summed-up in this comment in issue #57.

Copy link
Contributor

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent ❤️ 💚 💙 💛 💜!

There is still minor issues (commented inline, I could build successfully after working around them).


/* to get htobe16, le16toh, etc */
#define _BSD_SOURCE
#include <endian.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this fails on my computer (running FreeBSD):

nfc-tools/libfreefare/build % make
Scanning dependencies of target freefare
[  2%] Building C object libfreefare/CMakeFiles/freefare.dir/felica.c.o
In file included from /home/romain/Projects/nfc-tools/libfreefare/libfreefare/felica.c:28:
/home/romain/Projects/nfc-tools/libfreefare/config.h:9:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^~~~~~~~~~
1 error generated.
*** Error code 1

I guess it will fail on Mac OS too… Can't we detect sys/endian.h, endian.h, CoreFoundation/CoreFoundation.h and byteswap.h and define HAVE_SYS_ENDIAN_H, HAVE_ENDIAN_H, HAVE_COREFOUNDATION_COREFOUNDATION_H and HAVE_BYTESWAP_H accordingly?

CMakeLists.txt Outdated
@@ -13,8 +13,13 @@ IF(WIN32)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/contrib/win32)
find_library(WINSOCK_LIB libws2_32.a)
set(LIBS ${LIBS} ${WINSOCK_LIB})
ELSE(WIN32)
set(_XOPEN_SOURCE 600)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_posix.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${CMAKE_CURRENT_SOURCE_DIR}/config.h sould be ${CMAKE_BINARY_DIR}/config.h. This is wrong on line 12 too (we are not supposed to touch the source directory), please adjust both 😉

@smortex
Copy link
Contributor

smortex commented Apr 24, 2017

Squashing commits in your branch in order to keep author information (I am not sure about who would be credited if I use the GitHub "squash" button)…

- Fix library finding ('nfc' instead of 'libnfc');
- Generate config.h from template on non-win32 platforms;
- While here, include protection for config.h in several files.
@smortex smortex changed the title CMake LIBNFC Library Finding and GNU99 Fix build with CMake Apr 24, 2017
@smortex smortex merged commit 5e5a082 into nfc-tools:master Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants