view CMakeLists.txt @ 27:523c45dfa8fb

- refactored arm calling conventions' callvm code, so that the code that keeps the caller from overwriting the return value on some platforms also works on OpenBSD (before we casted the function pointer to have long long as return type, to hint the caller that there is one, but that triggers an intentional SIGABRT on OpenBSD for security reasons; now the decl reflects this, directly)
author cslag
date Tue, 15 Sep 2015 12:48:52 +0200
parents af6c88d34af0
children 6e7b1b7ad9d3
line wrap: on
line source

# Package: dyncall
# File: CMakeLists.txt
# Description: DynCall Project cmake files
# License:
#
# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>
# 
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

cmake_minimum_required (VERSION 2.6)
project(DynCall)

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "dyncall enables dynamic invocation of machine-level function calls")
set(CPACK_PACKAGE_VENDOR "dyncall project")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/Description.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/License.txt")
if(APPLE)
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/doc/Description.txt")
endif(APPLE)
set(CPACK_PACKAGE_NAME "dyncall")
include(CPack)

# add cmake modules shipped with the package to cmake's module path.
# currently we have no use for this, but maybe later..
#set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildsys/cmake/Modules" "${CMAKE_MODULE_PATH}")


if(MSVC)
  enable_language(ASM_MASM)
  #if(CMAKE_SIZEOF_VOID_P MATCHES 8)
  #  set(CMAKE_ASM_COMPILER "ml64")
  #else()
  #  set(CMAKE_ASM_COMPILER "ml")
  #endif()
  #set(CMAKE_ASM_COMPILER_ARG1 "/c")
  #set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS asm)
  #set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
elseif(CMAKE_COMPILER_IS_GNUCC)
  # when used in shared libraries, -fPIC is required by several architectures
  # and platforms (observed on AMD64, Solaris/Sparc).
  # we enable it per default here.
  add_definitions("-fPIC")
  # enable gcc as front-end to assembler for .S files
  set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
  set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
  enable_language(ASM)
elseif(CMAKE_COMPILER_IS_CLANG)
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
  set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
  set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
  enable_language(ASM)
else()
  if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  add_definitions("-fPIC")
  # enable gcc as front-end to assembler for .S files
  set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
  set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
  enable_language(ASM)
  endif()
endif()

add_subdirectory(dynload)
add_subdirectory(dyncall)
add_subdirectory(dyncallback)
add_subdirectory(doc/manual EXCLUDE_FROM_ALL)
add_subdirectory(test EXCLUDE_FROM_ALL)

# install cmake Find scripts (disabled per default)

option(INSTALL_CMAKE_MODULES "install cmake modules to locate dyncall" "NO")

if(INSTALL_CMAKE_MODULES)
file(GLOB INSTALL_CMAKE_MODULES_FILES buildsys/cmake/Modules/Find*.cmake)
install(FILES ${INSTALL_CMAKE_MODULES_FILES} DESTINATION ${CMAKE_ROOT}/Modules)
endif(INSTALL_CMAKE_MODULES)