also build shared libraries of vendored lua

This commit is contained in:
Tim Felgentreff 2022-05-22 14:30:39 +02:00
parent 9a00345e72
commit 987e3cb1bf
3 changed files with 11 additions and 0 deletions

View file

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1)
project(lua) project(lua)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(src/) add_subdirectory(src/)
add_subdirectory(toluapp-simple/) add_subdirectory(toluapp-simple/)

View file

@ -43,6 +43,9 @@ set(LUA_SRC "lua.c")
add_library(lua51_static STATIC "${LUA_LIB_SRC}") add_library(lua51_static STATIC "${LUA_LIB_SRC}")
set_target_properties(lua51_static PROPERTIES OUTPUT_NAME "lua51") 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}") add_executable(lua51 "${LUA_SRC}" "${LUA_LIB_SRC}")
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
@ -54,12 +57,15 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O2")
if(UNIX) if(UNIX)
target_compile_definitions(lua51_static PUBLIC "LUA_USE_DLOPEN" "LUA_USE_MKSTEMP") 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_compile_definitions(lua51 PUBLIC "LUA_USE_DLOPEN" "LUA_USE_MKSTEMP")
target_link_libraries(lua51 PUBLIC ${CMAKE_DL_LIBS}) target_link_libraries(lua51 PUBLIC ${CMAKE_DL_LIBS})
target_link_libraries(lua51_static PUBLIC ${CMAKE_DL_LIBS}) target_link_libraries(lua51_static PUBLIC ${CMAKE_DL_LIBS})
target_link_libraries(lua51_shared PUBLIC ${CMAKE_DL_LIBS})
endif() endif()
set_target_properties(lua51_static PROPERTIES LINKER_LANGUAGE CXX) 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 LINKER_LANGUAGE CXX)
set_target_properties(lua51 PROPERTIES set_target_properties(lua51 PROPERTIES

View file

@ -21,9 +21,12 @@ tolua_to.c
add_library(toluapp51 STATIC "${TOLUA_LIB_SRC}") 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}") 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 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}) 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 PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(toluapp51_shared PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(toluapp PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(toluapp PROPERTIES LINKER_LANGUAGE CXX)
include_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) include_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})