summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/CMakeLists.txt135
-rw-r--r--src/Bindings/CheckBindingsDependencies.lua19
2 files changed, 16 insertions, 138 deletions
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
index f5896f02d..3e7101cbf 100644
--- a/src/Bindings/CMakeLists.txt
+++ b/src/Bindings/CMakeLists.txt
@@ -1,5 +1,6 @@
+target_sources(
+ ${CMAKE_PROJECT_NAME} PRIVATE
-SET (SRCS
Bindings.cpp
DeprecatedBindings.cpp
LuaChunkStay.cpp
@@ -19,9 +20,7 @@ SET (SRCS
Plugin.cpp
PluginLua.cpp
PluginManager.cpp
-)
-SET (HDRS
Bindings.h
DeprecatedBindings.h
LuaChunkStay.h
@@ -41,133 +40,3 @@ SET (HDRS
PluginManager.h
tolua++.h
)
-
-# List all the files that are generated as part of the Bindings build process
-set (BINDING_OUTPUTS
- ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h
- ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Declaration.inc
- ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Implementation.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Typedefs.inc
-)
-
-set(BINDING_DEPENDENCIES
- ../Bindings/AllToLua.pkg
- ../Bindings/BindingsProcessor.lua
- ../Bindings/LuaFunctions.h
- ../Bindings/LuaWindow.h
- ../Bindings/Plugin.h
- ../Bindings/PluginLua.h
- ../Bindings/PluginManager.h
- ../BiomeDef.h
- ../BlockArea.h
- ../BlockEntities/BeaconEntity.h
- ../BlockEntities/BedEntity.h
- ../BlockEntities/BlockEntity.h
- ../BlockEntities/BlockEntityWithItems.h
- ../BlockEntities/BrewingstandEntity.h
- ../BlockEntities/ChestEntity.h
- ../BlockEntities/CommandBlockEntity.h
- ../BlockEntities/DispenserEntity.h
- ../BlockEntities/DropSpenserEntity.h
- ../BlockEntities/DropperEntity.h
- ../BlockEntities/FurnaceEntity.h
- ../BlockEntities/HopperEntity.h
- ../BlockEntities/JukeboxEntity.h
- ../BlockEntities/MobSpawnerEntity.h
- ../BlockEntities/NoteEntity.h
- ../BlockEntities/SignEntity.h
- ../BlockEntities/MobHeadEntity.h
- ../BlockEntities/FlowerPotEntity.h
- ../BlockType.h
- ../BlockInfo.h
- ../BoundingBox.h
- ../ChatColor.h
- ../ChunkDef.h
- ../ClientHandle.h
- ../Color.h
- ../CompositeChat.h
- ../CraftingRecipes.h
- ../Cuboid.h
- ../Defines.h
- ../EffectID.h
- ../Enchantments.h
- ../Entities/Boat.h
- ../Entities/ArrowEntity.h
- ../Entities/Entity.h
- ../Entities/ExpOrb.h
- ../Entities/EntityEffect.h
- ../Entities/ExpBottleEntity.h
- ../Entities/FallingBlock.h
- ../Entities/FireChargeEntity.h
- ../Entities/FireworkEntity.h
- ../Entities/Floater.h
- ../Entities/GhastFireballEntity.h
- ../Entities/HangingEntity.h
- ../Entities/ItemFrame.h
- ../Entities/LeashKnot.h
- ../Entities/Pawn.h
- ../Entities/Player.h
- ../Entities/Painting.h
- ../Entities/Pickup.h
- ../Entities/ProjectileEntity.h
- ../Entities/SplashPotionEntity.h
- ../Entities/ThrownEggEntity.h
- ../Entities/ThrownEnderPearlEntity.h
- ../Entities/ThrownSnowballEntity.h
- ../Entities/TNTEntity.h
- ../Entities/WitherSkullEntity.h
- ../Generating/ChunkDesc.h
- ../IniFile.h
- ../Inventory.h
- ../Item.h
- ../ItemGrid.h
- ../Map.h
- ../MapManager.h
- ../Mobs/Monster.h
- ../Mobs/MonsterTypes.h
- ../OSSupport/File.h
- ../Protocol/MojangAPI.h
- ../Root.h
- ../Scoreboard.h
- ../Server.h
- ../Statistics.h
- ../StringUtils.h
- ../UI/Window.h
- ../UUID.h
- ../Vector3.h
- ../WebAdmin.h
- ../World.h
-)
-
-if (NOT MSVC)
- if (USE_SYSTEM_LUA)
- ADD_CUSTOM_COMMAND(
- OUTPUT ${BINDING_OUTPUTS}
- COMMAND lua BindingsProcessor.lua
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${BINDING_DEPENDENCIES}
- )
- else()
- ADD_CUSTOM_COMMAND(
- OUTPUT ${BINDING_OUTPUTS}
- COMMAND luaexe BindingsProcessor.lua
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${BINDING_DEPENDENCIES} luaexe
- )
- endif()
-endif ()
-
-set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE)
-
-set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS -Wno-error)
-
-if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- set_source_files_properties(Bindings.cpp PROPERTIES COMPILE_FLAGS
- "-Wno-old-style-cast -Wno-missing-prototypes -Wno-deprecated-declarations")
-endif()
-
-if(NOT MSVC)
- add_library(Bindings ${SRCS} ${HDRS})
- target_link_libraries(Bindings fmt::fmt lua lsqlite tolualib mbedtls HTTPServer SQLiteCpp)
-endif()
diff --git a/src/Bindings/CheckBindingsDependencies.lua b/src/Bindings/CheckBindingsDependencies.lua
index c0565ead8..50e915311 100644
--- a/src/Bindings/CheckBindingsDependencies.lua
+++ b/src/Bindings/CheckBindingsDependencies.lua
@@ -19,8 +19,8 @@ local g_ShouldIgnorePkg =
local g_ShouldIgnoreCMake =
{
["tolua"] = true,
- ["../Bindings/AllToLua.pkg"] = true,
- ["../Bindings/BindingsProcessor.lua"] = true,
+ ["Bindings/AllToLua.pkg"] = true,
+ ["Bindings/BindingsProcessor.lua"] = true,
}
@@ -37,7 +37,17 @@ local function getAllToLuaPkgFiles()
if (g_ShouldIgnorePkg[a_FileName]) then
return
end
- a_FileName = a_FileName:gsub("../Bindings/", "") -- Normalize the path
+
+ -- Normalize the path: AllToLua is relative to src\Bindings
+ -- but the CMake dependencies list is relative to src\
+ a_FileName, cnt = a_FileName:gsub("%.%./", "")
+
+ -- If no replacements were done, this entry must point to a file
+ -- inside the Bindings folder; normalize it
+ if cnt == 0 then
+ a_FileName = "Bindings/" .. a_FileName
+ end
+
table.insert(res, a_FileName)
res[a_FileName] = true
end
@@ -54,7 +64,7 @@ end
--- Returns a sorted list of all files listed as dependencies in CMakeLists.txt
-- The returned table has both an array part (list of files) and a dictionary part ("filename" -> true)
local function getCMakeListsFiles()
- local f = assert(io.open("CMakeLists.txt", "r"))
+ local f = assert(io.open("../../CMake/GenerateBindings.cmake", "r"))
local contents = f:read("*all")
f:close()
local res = {}
@@ -69,7 +79,6 @@ local function getCMakeListsFiles()
if (g_ShouldIgnoreCMake[a_FileName]) then
return
end
- a_FileName = a_FileName:gsub("../Bindings/", "") -- Normalize the path
table.insert(res, a_FileName)
res[a_FileName] = true
end