-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2942aba
commit c3cb3a4
Showing
16 changed files
with
761 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
cmake_minimum_required(VERSION 2.8.8) | ||
project(libffi C) | ||
|
||
set(LIBFFI_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../libffi) | ||
set(LIBFFI_SRC ${LIBFFI_ROOT}/src) | ||
set(LIBFFI_INCLUDE ${LIBFFI_ROOT}/include) | ||
|
||
set(SOURCES_LIST | ||
${LIBFFI_SRC}/closures.c | ||
${LIBFFI_SRC}/java_raw_api | ||
${LIBFFI_SRC}/prep_cif.c | ||
${LIBFFI_SRC}/raw_api.c | ||
${LIBFFI_SRC}/tramp.c | ||
${LIBFFI_SRC}/types.c) | ||
|
||
if(CMAKE_BUILD_TYPE MATCHES DEBUG) | ||
list(APPEND SOURCES_LIST ${LIBFFI_SRC}/debug.c) | ||
add_definitions(-DFFI_DEBUG) | ||
endif() | ||
|
||
include(configure_platform.cmake) | ||
include(configure_options.cmake) | ||
|
||
file(COPY ${FFI_CONFIG_FILE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
file(COPY ${LIBFFI_SRC}/${TARGETDIR}/ffitarget.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include) | ||
|
||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) | ||
include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
include_directories(${LIBFFI_INCLUDE}) | ||
include_directories(include) | ||
|
||
add_definitions(-DFFI_BUILDING) | ||
|
||
add_library(objlib OBJECT ${SOURCES_LIST}) | ||
set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) | ||
|
||
add_library(ffi_static STATIC $<TARGET_OBJECTS:objlib>) | ||
|
||
if(MSVC) | ||
add_definitions(-DFFI_BUILDING_DLL) | ||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
elseif(CMAKE_SYSTEM_NAME MATCHES Darwin) | ||
set(CMAKE_MACOSX_RPATH 1) | ||
endif() | ||
# add_library(ffi_shared SHARED $<TARGET_OBJECTS:objlib> ${OBJECTS_LIST}) | ||
|
||
set_target_properties(ffi_static PROPERTIES OUTPUT_NAME ffi) | ||
# set_target_properties(ffi_shared PROPERTIES OUTPUT_NAME ffi) | ||
|
||
install(TARGETS ffi_static # ffi_shared | ||
EXPORT ${PROJECT_NAME}Targets | ||
RUNTIME DESTINATION bin | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib) | ||
|
||
install(EXPORT ${PROJECT_NAME}Targets | ||
DESTINATION share/${PROJECT_NAME}) | ||
|
||
install(FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/include/ffi.h | ||
${CMAKE_CURRENT_BINARY_DIR}/include/ffitarget.h | ||
DESTINATION include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
following files are based on build scripts from am11's PR | ||
which can be found at https://github.com/libffi/libffi/pull/535 | ||
- include/fficonfig.h.in | ||
- CMakeLists.txt | ||
- configure_options.cmake | ||
- configure_platform.cmake | ||
|
||
LICENSE | ||
======= | ||
|
||
libffi - Copyright (c) 1996-2019 Anthony Green, Red Hat, Inc and others. | ||
See source files for details. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
``Software''), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <lua.hh> | ||
#include <cffi.h> | ||
|
||
void ffi_module_open(lua_State *L); | ||
|
||
void register_ffi_object(lua_State *L) { | ||
ffi_module_open(L); | ||
lua_pushvalue(L, -1); | ||
lua_setglobal(L, "ffi"); | ||
lua_pop(L, 1); | ||
} |
Oops, something went wrong.