-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (68 loc) · 3 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Package: dyncall
# File: CMakeLists.txt
# Description: DynCall Project cmake files
# License:
#
# Copyright (c) 2010 Daniel Adler <[email protected]>
#
# 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_C_COMPILER_ID}" STREQUAL "SunPro")
set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
enable_language(ASM)
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)