view doc/README.CMake @ 533:71c884e610f0

- integration of patches from Raphael Luba, Thekla, Inc.: * integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv) * windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.) * see Changelog for details - new calling convention modes for thiscalls (platform agnostic, was specific before) * new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL) - dcCallF(), dcVCallF(), dcArgF() and dcVArgF(): * added support for aggregates-by-value (wasn't part of patch) * change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change) - added macros to feature test implementation for aggregate-by-value and syscall support - changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order - doc: * man page updates to describe aggregate interface * manual overview changes to highlight platforms with aggregate-by-value support - test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author Tassilo Philipp
date Thu, 21 Apr 2022 13:35:47 +0200
parents 3e629dc19168
children
line wrap: on
line source

Notes on building DynCall with CMake
====================================


Build with CMake (in-source)
----------------------------

cd <dyncall-source-dir>

On Unix:
  cmake .
  make

On Windows:
  cmake . -G "NMake Makefiles"
  nmake /f Makefile

  NOTE: Assembly Support is broken for Visual Studio Generators in CMake
        So we support NMake for now only.

Install in a specific location
------------------------------
cmake -DCMAKE_INSTALL_PREFIX=<absolute-path>


Tested settings
---------------
- CMake Unix Makefile generators on Mac OS X and Linux.


Using from other CMake-based projects
-------------------------------------
Under buildsys/cmake/Modules you find some Find*() scripts
which you might find useful.


Make Universal Binary
---------------------
cmake -DCMAKE_OSX_ARCHITECTURES="i386;x86_64;ppc"


CMake Framework
---------------
The project name is "DynCall".
Each library in the source tree represents a target (not a sub-project!).
Support scripts for 'find_package' are at buildsys/cmake/Modules.

find_package( [DynLoad | DynCall | DynCallback] ) 

will set the variables:

	Dyn*_INCLUDE_DIRS
	Dyn*_LIBRARIES


Using dyncall libraries in other CMake projects
-----------------------------------------------
find_package(DynLoad REQUIRED)
add_includes(${DynLoad_INCLUDE_DIRS})
target_link_libraries( ... ${DynLoad_LIBRARIES})


Use as sub-project within CMake top-level project
-------------------------------------------------

add_subdirectory(path/to/dyncall/project/tree)
set(DynLoad_DIR ${DynCall_SOURCE_DIR}/dynload)
set(DynCall_DIR ${DynCall_SOURCE_DIR}/dyncall)
set(DynCallback_DIR ${DynCall_SOURCE_DIR}/dyncallback)

has the effect, that the 'find_package' works from within the project source 
tree.


Building for SPARC64 Architectures
----------------------------------

Supported Compilers: GCC, SunPro
Add -m64 to C, C++ and ASM flags, e.g.

$ cmake -DCMAKE_C_FLAGS=-m64 -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_ASM_CXX_FLAGS=-m64