annotate CMakeLists.txt @ 357:d982a00c2177

- PPC64 asm syntax fix, specifying explicitly comparison mode for cmpi (newer toolchains complain, older ones took optional field of instruction which happened to be same value)
author Tassilo Philipp
date Tue, 25 Feb 2020 18:16:13 +0100
parents dc8bbffc39e6
children 451299d50c1a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 # Package: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 # File: CMakeLists.txt
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 # Description: DynCall Project cmake files
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 # License:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 #
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 # Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 #
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 # Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 # purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 # copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 #
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 #
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 cmake_minimum_required (VERSION 2.6)
149
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
22 project(DynCall C)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "dyncall enables dynamic invocation of machine-level function calls")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 set(CPACK_PACKAGE_VENDOR "dyncall project")
316
dc8bbffc39e6 - fix for some cmake/cpack doc paths (fixup for files that were removed by r303)
Tassilo Philipp
parents: 150
diff changeset
26 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
dc8bbffc39e6 - fix for some cmake/cpack doc paths (fixup for files that were removed by r303)
Tassilo Philipp
parents: 150
diff changeset
27 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 if(APPLE)
316
dc8bbffc39e6 - fix for some cmake/cpack doc paths (fixup for files that were removed by r303)
Tassilo Philipp
parents: 150
diff changeset
29 set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 endif(APPLE)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 set(CPACK_PACKAGE_NAME "dyncall")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 include(CPack)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 # add cmake modules shipped with the package to cmake's module path.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 # currently we have no use for this, but maybe later..
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 #set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildsys/cmake/Modules" "${CMAKE_MODULE_PATH}")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37
149
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
38 option(LANG_CXX "Enable and build C++ tests" ON)
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
39
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
40 if(LANG_CXX)
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
41 enable_language(CXX)
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
42 endif()
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
150
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
44 include(CheckCCompilerFlag)
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
45 check_c_compiler_flag("-fPIC -Werror" COMPILER_HAS_FPIC)
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
46
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 if(MSVC)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 enable_language(ASM_MASM)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 #if(CMAKE_SIZEOF_VOID_P MATCHES 8)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 # set(CMAKE_ASM_COMPILER "ml64")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 #else()
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 # set(CMAKE_ASM_COMPILER "ml")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 #endif()
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 #set(CMAKE_ASM_COMPILER_ARG1 "/c")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 #set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS asm)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 #set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
31
6e7b1b7ad9d3 Fixed failing builds when the compiler is ICC/ICPC
Snaipe <franklinmathieu@gmail.com>
parents: 3
diff changeset
57 elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
150
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
58 if(COMPILER_HAS_FPIC)
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
59 # when used in shared libraries, -fPIC is required by several architectures
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
60 # and platforms (observed on AMD64, Solaris/Sparc).
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
61 # we enable it per default here.
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
62 add_definitions("-fPIC")
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
63 endif()
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 # enable gcc as front-end to assembler for .S files
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 enable_language(ASM)
3
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
68 elseif(CMAKE_COMPILER_IS_CLANG)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 enable_language(ASM)
3
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
73 else()
149
c12120a1fbc0 - make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents: 31
diff changeset
74 if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
150
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
75 if(COMPILER_HAS_FPIC)
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
76 add_definitions("-fPIC")
3cb226f48495 - make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents: 149
diff changeset
77 endif()
3
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
78 # enable gcc as front-end to assembler for .S files
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
79 set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}")
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
80 set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c")
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
81 enable_language(ASM)
af6c88d34af0 freebsd: bugfix for cmake build
Daniel Adler
parents: 0
diff changeset
82 endif()
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 endif()
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 add_subdirectory(dynload)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 add_subdirectory(dyncall)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 add_subdirectory(dyncallback)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 add_subdirectory(doc/manual EXCLUDE_FROM_ALL)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 add_subdirectory(test EXCLUDE_FROM_ALL)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 # install cmake Find scripts (disabled per default)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 option(INSTALL_CMAKE_MODULES "install cmake modules to locate dyncall" "NO")
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 if(INSTALL_CMAKE_MODULES)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 file(GLOB INSTALL_CMAKE_MODULES_FILES buildsys/cmake/Modules/Find*.cmake)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 install(FILES ${INSTALL_CMAKE_MODULES_FILES} DESTINATION ${CMAKE_ROOT}/Modules)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 endif(INSTALL_CMAKE_MODULES)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99