CMake: Add ucontext on Mac/OSX
This commit is contained in:
@@ -50,6 +50,8 @@ if (APPLE)
|
|||||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||||
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
||||||
find_library(COCOA_LIBRARY Cocoa)
|
find_library(COCOA_LIBRARY Cocoa)
|
||||||
|
|
||||||
|
find_package(MacUcontext)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
23
cmake/FindMacUcontext.cmake
Normal file
23
cmake/FindMacUcontext.cmake
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <sys/ucontext.h>
|
||||||
|
int main() {
|
||||||
|
ucontext_t context;
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
void *ptr = (void *) context.uc_mcontext->__ss.__rip;
|
||||||
|
#elif defined(__i386)
|
||||||
|
void *ptr = (void *) context.uc_mcontext->__ss.__rip;
|
||||||
|
#else
|
||||||
|
#error Unknown arch
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
UCONTEXT_FOUND
|
||||||
|
)
|
||||||
|
|
||||||
|
if (UCONTEXT_FOUND)
|
||||||
|
add_compile_options(
|
||||||
|
-DWITH_UCONTEXT
|
||||||
|
)
|
||||||
|
endif (UCONTEXT_FOUND)
|
Reference in New Issue
Block a user