From 987e3cb1bf3a1711a4bfd2cd4b588cbcc92a0d25 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sun, 22 May 2022 14:30:39 +0200 Subject: [PATCH] also build shared libraries of vendored lua --- third-party/lua-5.1.5/CMakeLists.txt | 1 + third-party/lua-5.1.5/src/CMakeLists.txt | 6 ++++++ third-party/lua-5.1.5/toluapp-simple/CMakeLists.txt | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/third-party/lua-5.1.5/CMakeLists.txt b/third-party/lua-5.1.5/CMakeLists.txt index fca34eee3..70a02e7e6 100644 --- a/third-party/lua-5.1.5/CMakeLists.txt +++ b/third-party/lua-5.1.5/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(lua) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_subdirectory(src/) add_subdirectory(toluapp-simple/) diff --git a/third-party/lua-5.1.5/src/CMakeLists.txt b/third-party/lua-5.1.5/src/CMakeLists.txt index 766f09a0a..b26ca2cc2 100644 --- a/third-party/lua-5.1.5/src/CMakeLists.txt +++ b/third-party/lua-5.1.5/src/CMakeLists.txt @@ -43,6 +43,9 @@ set(LUA_SRC "lua.c") add_library(lua51_static STATIC "${LUA_LIB_SRC}") set_target_properties(lua51_static PROPERTIES OUTPUT_NAME "lua51") +add_library(lua51_shared SHARED "${LUA_LIB_SRC}") +set_target_properties(lua51_shared PROPERTIES OUTPUT_NAME "lua51") + add_executable(lua51 "${LUA_SRC}" "${LUA_LIB_SRC}") if(NOT CMAKE_BUILD_TYPE) @@ -54,12 +57,15 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O2") if(UNIX) target_compile_definitions(lua51_static PUBLIC "LUA_USE_DLOPEN" "LUA_USE_MKSTEMP") +target_compile_definitions(lua51_shared PUBLIC "LUA_USE_DLOPEN" "LUA_USE_MKSTEMP") target_compile_definitions(lua51 PUBLIC "LUA_USE_DLOPEN" "LUA_USE_MKSTEMP") target_link_libraries(lua51 PUBLIC ${CMAKE_DL_LIBS}) target_link_libraries(lua51_static PUBLIC ${CMAKE_DL_LIBS}) +target_link_libraries(lua51_shared PUBLIC ${CMAKE_DL_LIBS}) endif() set_target_properties(lua51_static PROPERTIES LINKER_LANGUAGE CXX) +set_target_properties(lua51_shared PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(lua51 PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(lua51 PROPERTIES diff --git a/third-party/lua-5.1.5/toluapp-simple/CMakeLists.txt b/third-party/lua-5.1.5/toluapp-simple/CMakeLists.txt index 81fdb979e..d3f2aea69 100644 --- a/third-party/lua-5.1.5/toluapp-simple/CMakeLists.txt +++ b/third-party/lua-5.1.5/toluapp-simple/CMakeLists.txt @@ -21,9 +21,12 @@ tolua_to.c add_library(toluapp51 STATIC "${TOLUA_LIB_SRC}") +add_library(toluapp51_shared SHARED "${TOLUA_LIB_SRC}") +set_target_properties(toluapp51_shared PROPERTIES OUTPUT_NAME "toluapp51") add_executable(toluapp "${TOLUA_BIN_SRC}" "${TOLUA_LIB_SRC}") target_link_libraries(toluapp51 PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS}) +target_link_libraries(toluapp51_shared PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS}) target_link_libraries(toluapp PUBLIC "${PROJECT_BINARY_DIR}/liblua51.a" ${CMAKE_DL_LIBS}) @@ -34,6 +37,7 @@ set_target_properties(toluapp PROPERTIES ) set_target_properties(toluapp51 PROPERTIES LINKER_LANGUAGE CXX) +set_target_properties(toluapp51_shared PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(toluapp PROPERTIES LINKER_LANGUAGE CXX) include_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})