-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(build): include lpeg as a library
- Loading branch information
Showing
16 changed files
with
373 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# TODO: these two from BuildLuv, deduplicate | ||
set(LPEG_INCLUDE_FLAGS | ||
"-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1") | ||
list(APPEND LPEG_CMAKE_ARGS | ||
"-DCMAKE_C_FLAGS:STRING=${LPEG_INCLUDE_FLAGS}") | ||
|
||
ExternalProject_Add(lpeg | ||
URL ${LPEG_URL} | ||
URL_HASH SHA256=${LPEG_SHA256} | ||
DOWNLOAD_NO_PROGRESS TRUE | ||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lpeg | ||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy | ||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LpegCMakeLists.txt | ||
${DEPS_BUILD_DIR}/src/lpeg/CMakeLists.txt | ||
CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${LPEG_CMAKE_ARGS} | ||
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) | ||
|
||
if(USE_BUNDLED_LUAJIT) | ||
add_dependencies(lpeg luajit) | ||
elseif(USE_BUNDLED_LUA) | ||
add_dependencies(lpeg lua) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project (lpeg C) | ||
|
||
include(GNUInstallDirs) | ||
|
||
file(GLOB LPEG_SOURCES ${CMAKE_SOURCE_DIR}/*.c) | ||
add_library(lpeg STATIC ${LPEG_SOURCES}) | ||
|
||
install(TARGETS lpeg ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
# vim: set ft=cmake: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
find_library(LPEG_LIBRARY NAMES lpeg_a lpeg liblpeg_a) | ||
|
||
# Ubuntu-specific workaround to find system paths | ||
function(ubuntu) | ||
set(CMAKE_FIND_LIBRARY_PREFIXES "") | ||
find_library(LPEG_LIBRARY NAMES lpeg PATH_SUFFIXES lua/5.1) | ||
endfunction() | ||
ubuntu() | ||
|
||
message(STATUS "KRARK") | ||
message(STATUS "${LPEG_LIBRARY}") | ||
|
||
find_package_handle_standard_args(Lpeg DEFAULT_MSG LPEG_LIBRARY ) | ||
mark_as_advanced(LPEG_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.