fix(build/lua): Remove lualib_static from build. (#272)

This commit is contained in:
Anton Popovichenko
2025-04-26 21:49:00 +02:00
committed by GitHub
parent 1ebb51f7c5
commit 6f9da64fd4

View File

@@ -75,55 +75,41 @@ else()
add_library(lualib SHARED ${LOCAL_SOURCES_H} ${LOCAL_SOURCES_C}) add_library(lualib SHARED ${LOCAL_SOURCES_H} ${LOCAL_SOURCES_C})
set_property(TARGET lualib PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET lualib PROPERTY POSITION_INDEPENDENT_CODE ON)
endif() endif()
add_library(lualib_static STATIC ${LOCAL_SOURCES_H} ${LOCAL_SOURCES_C})
set_target_properties(lualib PROPERTIES LINKER_LANGUAGE C) set_target_properties(lualib PROPERTIES LINKER_LANGUAGE C)
set_target_properties(lualib_static PROPERTIES LINKER_LANGUAGE C)
target_include_directories(lualib PUBLIC "${LUA_SOURCE_FOLDER}" "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(lualib PUBLIC "${LUA_SOURCE_FOLDER}" "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(lualib_static PUBLIC "${LUA_SOURCE_FOLDER}" "${CMAKE_CURRENT_SOURCE_DIR}")
if (WIN32) if (WIN32)
set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION}) set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION})
install(TARGETS lualib DESTINATION "${CMAKE_INSTALL_PREFIX}") install(TARGETS lualib DESTINATION "${CMAKE_INSTALL_PREFIX}")
if (NOT LUA_STATIC) if (NOT LUA_STATIC)
install(FILES $<TARGET_PDB_FILE:lualib> DESTINATION "${CMAKE_INSTALL_PREFIX}" OPTIONAL) install(FILES $<TARGET_PDB_FILE:lualib> DESTINATION "${CMAKE_INSTALL_PREFIX}" OPTIONAL)
endif() endif()
# set_target_properties(lualib PROPERTIES PUBLIC_HEADER "${LOCAL_SOURCES_H};${CMAKE_CURRENT_SOURCE_DIR}/lua.hpp")
# install(TARGETS lualib PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
# set_target_properties(lualib_static PROPERTIES OUTPUT_NAME ${LUA_VERSION}_static)
# install(TARGETS lualib_static DESTINATION "${CMAKE_INSTALL_PREFIX}")
else() else()
set_target_properties(lualib PROPERTIES PUBLIC_HEADER "${LOCAL_SOURCES_H};${CMAKE_CURRENT_SOURCE_DIR}/lua.hpp") set_target_properties(lualib PROPERTIES PUBLIC_HEADER "${LOCAL_SOURCES_H};${CMAKE_CURRENT_SOURCE_DIR}/lua.hpp")
install(TARGETS lualib install(TARGETS lualib
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include" PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
) )
install(TARGETS lualib_static DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
endif() endif()
if (WIN32) if (WIN32)
target_compile_definitions(lualib PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_definitions(lualib PRIVATE _CRT_SECURE_NO_WARNINGS)
target_compile_definitions(lualib_static PRIVATE _CRT_SECURE_NO_WARNINGS)
if (NOT LUA_STATIC) if (NOT LUA_STATIC)
target_compile_definitions(lualib PRIVATE LUA_BUILD_AS_DLL) target_compile_definitions(lualib PRIVATE LUA_BUILD_AS_DLL)
endif() endif()
elseif (APPLE) elseif (APPLE)
target_compile_definitions(lualib PUBLIC LUA_USE_MACOSX) target_compile_definitions(lualib PUBLIC LUA_USE_MACOSX)
target_compile_definitions(lualib_static PUBLIC LUA_USE_MACOSX)
target_compile_options(lualib PRIVATE -Wno-deprecated-declarations -Wno-empty-body) target_compile_options(lualib PRIVATE -Wno-deprecated-declarations -Wno-empty-body)
target_compile_options(lualib_static PRIVATE -Wno-deprecated-declarations -Wno-empty-body)
target_link_libraries(lualib readline) target_link_libraries(lualib readline)
target_link_libraries(lualib_static readline)
# set_target_properties(lualib PROPERTIES COMPILE_FLAGS -undefined dynamic_lookup)
# set_target_properties(lualib_static PROPERTIES COMPILE_FLAGS -undefined dynamic_lookup)
elseif (UNIX) elseif (UNIX)
target_compile_definitions(lualib PUBLIC LUA_USE_LINUX) target_compile_definitions(lualib PUBLIC LUA_USE_LINUX)
target_link_libraries(lualib ${CMAKE_DL_LIBS} m readline) target_link_libraries(lualib ${CMAKE_DL_LIBS} m readline)
target_compile_definitions(lualib_static PUBLIC LUA_USE_LINUX)
target_link_libraries(lualib_static ${CMAKE_DL_LIBS} m readline)
set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION}) set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION})
set_target_properties(lualib_static PROPERTIES OUTPUT_NAME ${LUA_VERSION})
endif() endif()
add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c) add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c)
target_link_libraries(lua_interpreter lualib_static) target_link_libraries(lua_interpreter lualib)
target_compile_definitions(lua_interpreter PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_definitions(lua_interpreter PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(lua_interpreter PROPERTIES OUTPUT_NAME ${LUA_VERSION}_interpreter) set_target_properties(lua_interpreter PROPERTIES OUTPUT_NAME ${LUA_VERSION}_interpreter)
if (WIN32) if (WIN32)
@@ -132,15 +118,9 @@ if (WIN32)
else() else()
install(TARGETS lua_interpreter DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS lua_interpreter DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif() endif()
#install(TARGETS lualib
# DESTINATION "${CMAKE_INSTALL_PREFIX}"
# LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lua/lib"
# RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/lua/lib"
# ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lua/lib"
#)
add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c) add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c)
target_link_libraries(lua_compiler lualib_static) target_link_libraries(lua_compiler lualib)
target_compile_definitions(lua_compiler PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_definitions(lua_compiler PRIVATE _CRT_SECURE_NO_WARNINGS)
set_target_properties(lua_compiler PROPERTIES OUTPUT_NAME ${LUA_VERSION}_compiler) set_target_properties(lua_compiler PROPERTIES OUTPUT_NAME ${LUA_VERSION}_compiler)
if (WIN32) if (WIN32)
@@ -148,5 +128,4 @@ if (WIN32)
install(FILES $<TARGET_PDB_FILE:lua_compiler> DESTINATION "${CMAKE_INSTALL_PREFIX}" OPTIONAL) install(FILES $<TARGET_PDB_FILE:lua_compiler> DESTINATION "${CMAKE_INSTALL_PREFIX}" OPTIONAL)
else() else()
install(TARGETS lua_compiler DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") install(TARGETS lua_compiler DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif() endif()