-
Notifications
You must be signed in to change notification settings - Fork 737
Add cmake configuration files #535
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
base: master
Are you sure you want to change the base?
Conversation
Fixed win32 and win64 builds with msvc. Problem was: -#cmakedefine01 HAVE_AS_CFI_PSEUDO_OP
+#cmakedefine HAVE_AS_CFI_PSEUDO_OP also made it so that emitted .vcxproj gets |
This check:
breaks cross-compilation from intel mac to arm ("apple silicon"). Is there a better way? Perhaps assuming it's true based on the target? |
It breaks as in $ clang -xc -isysroot $(xcrun -sdk macosx --show-sdk-path) -arch arm64 - <<EOF
#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
int main(void) {
int devzero = open("/dev/zero", O_RDWR);
return devzero == -1 || mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, devzero, 0) == (void *)-1 ? 1 : 0;
}
EOF
$ ./a.out
$ echo $? # should be 0 or 1 (at least on Mojave without -arch arm64, I get 1) |
CMake aborts because that check requires running the output. Which is not possible when you are cross-compiling from x86_64 to arm64 (or just cross-compiling in general). |
Ah right, I will add cross compile check, cmake has the prior art for it. |
I simply added |
Well, we can avoid running that test when cross-compiling, we can dial into tryrun.cmake mechanics etc. but if you are unblocked, great! |
Yeah, I'm good, thanks! |
Fails with ninja Running
'C:/CraftRoot/dev-utils/bin/ninja.exe' '-C' 'C:/CraftRoot/build/_/3446fad4/build' '-t' 'cleandead'
failed with:
ninja: error: build.ninja:208: multiple rules generate ffi.lib [-w dupbuild=err]
CMake Error:
Running
'C:/CraftRoot/dev-utils/bin/ninja.exe' '-C' 'C:/CraftRoot/build/_/3446fad4/build' '-t' 'recompact'
failed with:
ninja: error: build.ninja:208: multiple rules generate ffi.lib [-w dupbuild=err]
CMake Warning: |
Fails as the the static import lib and the static lib have the same name.
|
@TheOneRing, I did not try with ninja, but does the following patch help ninja build: --- CMakeLists.txt
+++ CMakeLists.txt
- set_target_properties(ffi_static PROPERTIES OUTPUT_NAME ffi)
+ set_target_properties(ffi_static PROPERTIES) |
Yes. |
Feature/cmake build configs
Hi team, any chance we can revisit this as it's been a few years? Having support for CMake will allow us to do cross compilation more easily. Thanks |
This delta adds cmake configuration files, and targets various platforms and architectures.
Usage
Unix/MinGW environments:
Visual Studio:
Minimal supported version of cmake is 2.8.8 (release APR 2012), where
add_library(..OBJECT..)
was introduced. That is used to prevent it for recompiling sources for static and shared targets (i.e. a negligible optimization). If need be, it can be reworked to support older version.Introspection cases are written for x86_64, i386, aarch64 and arm ISAs. More cases can be added in future, I do not have access to SPARC and MIPS etc. right now.
Few symbols were dropped in (newly added)
:/include/fficonfig.h.in
, which are not used in the code and require unnecessary introspection cases; (most prominentlyLIBFFI_GNU_SYMBOL_VERSIONING
).Tested combinations:
×✓MASM assembler does not like syntax of generated asm. see #275 (comment)×✓MASM assembler does not like syntax of generated asm. see #275 (comment)