xref: /aosp_15_r20/external/bcc/cmake/FindLuaJIT.cmake (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1*387f9dfdSAndroid Build Coastguard Worker# Locate Lua library
2*387f9dfdSAndroid Build Coastguard Worker# This module defines
3*387f9dfdSAndroid Build Coastguard Worker#  LUAJIT_FOUND, if false, do not try to link to Lua
4*387f9dfdSAndroid Build Coastguard Worker#  LUAJIT_LIBRARIES
5*387f9dfdSAndroid Build Coastguard Worker#  LUAJIT_INCLUDE_DIR, where to find lua.h
6*387f9dfdSAndroid Build Coastguard Worker#
7*387f9dfdSAndroid Build Coastguard Worker# Note that the expected include convention is
8*387f9dfdSAndroid Build Coastguard Worker#  #include "lua.h"
9*387f9dfdSAndroid Build Coastguard Worker# and not
10*387f9dfdSAndroid Build Coastguard Worker#  #include <lua/lua.h>
11*387f9dfdSAndroid Build Coastguard Worker# This is because, the lua location is not standardized and may exist
12*387f9dfdSAndroid Build Coastguard Worker# in locations other than lua/
13*387f9dfdSAndroid Build Coastguard Worker
14*387f9dfdSAndroid Build Coastguard Worker#=============================================================================
15*387f9dfdSAndroid Build Coastguard Worker# Copyright 2007-2009 Kitware, Inc.
16*387f9dfdSAndroid Build Coastguard Worker#
17*387f9dfdSAndroid Build Coastguard Worker# Distributed under the OSI-approved BSD License (the "License");
18*387f9dfdSAndroid Build Coastguard Worker# see accompanying file Copyright.txt for details.
19*387f9dfdSAndroid Build Coastguard Worker#
20*387f9dfdSAndroid Build Coastguard Worker# This software is distributed WITHOUT ANY WARRANTY; without even the
21*387f9dfdSAndroid Build Coastguard Worker# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22*387f9dfdSAndroid Build Coastguard Worker# See the License for more information.
23*387f9dfdSAndroid Build Coastguard Worker#=============================================================================
24*387f9dfdSAndroid Build Coastguard Worker# (To distributed this file outside of CMake, substitute the full
25*387f9dfdSAndroid Build Coastguard Worker#  License text for the above reference.)
26*387f9dfdSAndroid Build Coastguard Worker#
27*387f9dfdSAndroid Build Coastguard Worker# ################
28*387f9dfdSAndroid Build Coastguard Worker# 2010 - modified for cronkite to find luajit instead of lua, as it was before.
29*387f9dfdSAndroid Build Coastguard Worker#
30*387f9dfdSAndroid Build Coastguard Worker
31*387f9dfdSAndroid Build Coastguard WorkerFIND_PATH(LUAJIT_INCLUDE_DIR lua.h
32*387f9dfdSAndroid Build Coastguard Worker  HINTS
33*387f9dfdSAndroid Build Coastguard Worker  $ENV{LUAJIT_DIR}
34*387f9dfdSAndroid Build Coastguard Worker  PATH_SUFFIXES luajit-2.0 luajit2.0 luajit luajit-2.1
35*387f9dfdSAndroid Build Coastguard Worker  PATHS
36*387f9dfdSAndroid Build Coastguard Worker  ~/Library/Frameworks
37*387f9dfdSAndroid Build Coastguard Worker  /Library/Frameworks
38*387f9dfdSAndroid Build Coastguard Worker  /usr/local
39*387f9dfdSAndroid Build Coastguard Worker  /usr
40*387f9dfdSAndroid Build Coastguard Worker  /sw # Fink
41*387f9dfdSAndroid Build Coastguard Worker  /opt/local # DarwinPorts
42*387f9dfdSAndroid Build Coastguard Worker  /opt/csw # Blastwave
43*387f9dfdSAndroid Build Coastguard Worker  /opt
44*387f9dfdSAndroid Build Coastguard Worker)
45*387f9dfdSAndroid Build Coastguard Worker
46*387f9dfdSAndroid Build Coastguard WorkerFIND_LIBRARY(LUAJIT_LIBRARY
47*387f9dfdSAndroid Build Coastguard Worker  NAMES libluajit-51.a libluajit-5.1.a libluajit.a libluajit-5.1.so
48*387f9dfdSAndroid Build Coastguard Worker  HINTS
49*387f9dfdSAndroid Build Coastguard Worker  $ENV{LUAJIT_DIR}
50*387f9dfdSAndroid Build Coastguard Worker  PATH_SUFFIXES lib64 lib
51*387f9dfdSAndroid Build Coastguard Worker  PATHS
52*387f9dfdSAndroid Build Coastguard Worker  ~/Library/Frameworks
53*387f9dfdSAndroid Build Coastguard Worker  /Library/Frameworks
54*387f9dfdSAndroid Build Coastguard Worker  /usr/local
55*387f9dfdSAndroid Build Coastguard Worker  /usr
56*387f9dfdSAndroid Build Coastguard Worker  /sw
57*387f9dfdSAndroid Build Coastguard Worker  /opt/local
58*387f9dfdSAndroid Build Coastguard Worker  /opt/csw
59*387f9dfdSAndroid Build Coastguard Worker  /opt
60*387f9dfdSAndroid Build Coastguard Worker)
61*387f9dfdSAndroid Build Coastguard Worker
62*387f9dfdSAndroid Build Coastguard WorkerIF(LUAJIT_LIBRARY)
63*387f9dfdSAndroid Build Coastguard Worker  IF(UNIX AND NOT APPLE)
64*387f9dfdSAndroid Build Coastguard Worker    FIND_LIBRARY(LUAJIT_MATH_LIBRARY m)
65*387f9dfdSAndroid Build Coastguard Worker	FIND_LIBRARY(LUAJIT_DL_LIBRARY dl)
66*387f9dfdSAndroid Build Coastguard Worker	SET( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_DL_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
67*387f9dfdSAndroid Build Coastguard Worker  ELSE(UNIX AND NOT APPLE)
68*387f9dfdSAndroid Build Coastguard Worker    SET( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
69*387f9dfdSAndroid Build Coastguard Worker  ENDIF(UNIX AND NOT APPLE)
70*387f9dfdSAndroid Build Coastguard WorkerENDIF(LUAJIT_LIBRARY)
71*387f9dfdSAndroid Build Coastguard Worker
72*387f9dfdSAndroid Build Coastguard WorkerINCLUDE(FindPackageHandleStandardArgs)
73*387f9dfdSAndroid Build Coastguard Worker# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
74*387f9dfdSAndroid Build Coastguard Worker# all listed variables are TRUE
75*387f9dfdSAndroid Build Coastguard WorkerFIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT  DEFAULT_MSG  LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR)
76*387f9dfdSAndroid Build Coastguard Worker
77*387f9dfdSAndroid Build Coastguard WorkerMARK_AS_ADVANCED(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
78