minecraft-pi-reborn/symbols/CMakeLists.txt
2024-01-21 18:24:06 -05:00

188 lines
6.0 KiB
CMake

project(symbols)
# Definition Files
set(SRC
src/game/options/Options_Option.def
src/game/options/OptionsFile.def
src/game/options/Options.def
src/game/Minecraft.def
src/game/mode/GameMode.def
src/game/mode/CreatorMode.def
src/game/mode/SurvivalMode.def
src/game/NinecraftApp.def
src/game/GameRenderer.def
src/network/RakNetInstance.def
src/network/PingedCompatibleServer.def
src/network/NetEventCallback.def
src/network/raknet/RakNet_RakString_SharedString.def
src/network/raknet/RakNet_RakString.def
src/network/raknet/RakNet_SystemAddress.def
src/network/raknet/RakNet_StartupResult.h
src/network/raknet/RakNet_RakNetGUID.def
src/network/raknet/RakNet_RakPeer.def
src/network/ServerSideNetworkHandler.def
src/network/packet/LoginPacket.def
src/network/packet/PlayerEquipmentPacket.def
src/network/packet/Packet.def
src/network/packet/StartGamePacket.def
src/network/packet/ChatPacket.def
src/entity/EntityFactory.def
src/entity/PrimedTnt.def
src/entity/EntityRenderer.def
src/entity/Sheep.def
src/entity/PathfinderMob.def
src/entity/HumanoidModel.def
src/entity/TripodCameraRenderer.def
src/entity/MobFactory.def
src/entity/EntityRenderDispatcher.def
src/entity/MobRenderer.def
src/entity/AgableMob.def
src/entity/Animal.def
src/entity/Mob.def
src/entity/player/ServerPlayer.def
src/entity/player/Player.def
src/entity/player/PlayerRenderer.def
src/entity/player/RemotePlayer.def
src/entity/player/LocalPlayer.def
src/entity/HumanoidMobRenderer.def
src/entity/Entity.def
src/entity/ItemEntity.def
src/entity/Arrow.def
src/level/container/FillingContainer.def
src/level/container/Container.def
src/level/container/ContainerMenu.def
src/level/container/Inventory.def
src/level/feature/LargeFeature.def
src/level/feature/LargeCaveFeature.def
src/level/Material.def
src/level/LevelSource.def
src/level/ExternalFileLevelStorageSource.def
src/level/Biome.def
src/level/ChunkSource.def
src/level/Level.def
src/level/LevelRenderer.def
src/level/LevelStorageSource.def
src/level/ParticleEngine.def
src/level/RandomLevelSource.def
src/level/LevelData.def
src/level/LevelSettings.def
src/level/ServerLevel.def
src/item/ItemRenderer.def
src/item/ItemInHandRenderer.def
src/item/AuxDataTileItem.def
src/item/ItemInstance.def
src/item/Item.def
src/item/TileItem.def
src/api/OffsetPosTranslator.def
src/api/CommandServer.def
src/api/ConnectedClient.def
src/gui/screens/InBedScreen.def
src/gui/screens/SimpleChooseLevelScreen.def
src/gui/screens/PauseScreen.def
src/gui/screens/FurnaceScreen.def
src/gui/screens/WorkbenchScreen.def
src/gui/screens/SelectWorldScreen.def
src/gui/screens/Touch_IngameBlockSelectionScreen.def
src/gui/screens/Screen.def
src/gui/screens/OptionsScreen.def
src/gui/screens/TextEditScreen.def
src/gui/screens/StartMenuScreen.def
src/gui/screens/ProgressScreen.def
src/gui/screens/Touch_SelectWorldScreen.def
src/gui/Font.def
src/gui/components/ImageButton.def
src/gui/components/OptionButton.def
src/gui/components/OptionsPane.def
src/gui/components/GuiComponent.def
src/gui/components/Button.def
src/gui/components/Gui.def
src/app-platform/AppPlatform.def
src/app-platform/AppPlatform_linux.def
src/app-platform/AppPlatform_readAssetFile_return_value.def
src/tile/LeafTile.def
src/tile/Tile.def
src/tile/LiquidTile.def
src/tile/TallGrass.def
src/tile/entity/ChestTileEntity.def
src/tile/entity/TileEntity.def
src/tile/entity/FurnaceTileEntity.def
src/tile/entity/SignTileEntity.def
src/tile/StemTile.def
src/tile/Tile_SoundType.def
src/tile/TileRenderer.def
src/tile/GrassTile.def
src/tile/HeavyTile.def
src/misc/Strings.def
src/entity/ModelPart.def
src/misc/Tesselator.def
src/misc/AABB.def
src/misc/Vec3.def
src/misc/HitResult.def
src/misc/PerfRenderer.def
src/misc/Texture.def
src/misc/Textures.def
src/misc/SoundEngine.def
src/misc/Common.def
src/misc/Config.def
src/input/IBuildInput.def
src/input/MouseBuildInput.def
src/input/Mouse.def
src/recipes/FurnaceRecipes.def
src/recipes/Recipes.def
src/recipes/Recipes_Type.def
)
# Resolve Definition Files
set(RESOLVED_SRC "")
foreach(FILE IN LISTS SRC)
list(APPEND RESOLVED_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
endforeach()
# Directories
function(set_and_mkdir name dir)
set("${name}" "${dir}" PARENT_SCOPE)
file(MAKE_DIRECTORY "${dir}")
endfunction()
set_and_mkdir(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
set_and_mkdir(INCLUDE_OUTPUT_DIR "${GENERATED_DIR}/include")
set_and_mkdir(HEADER_OUTPUT_DIR "${INCLUDE_OUTPUT_DIR}/symbols")
set_and_mkdir(SRC_OUTPUT_DIR "${GENERATED_DIR}/src")
# Files
set(HEADER_OUTPUT_FILE "${HEADER_OUTPUT_DIR}/minecraft.h")
set(SRC_OUTPUT_FILE "${SRC_OUTPUT_DIR}/minecraft.cpp")
# Generate
add_custom_command(
OUTPUT "${SRC_OUTPUT_FILE}" "${HEADER_OUTPUT_FILE}"
DEPENDS ${RESOLVED_SRC}
COMMAND npm start --silent -- "${SRC_OUTPUT_FILE}" "${HEADER_OUTPUT_FILE}" ${RESOLVED_SRC}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/symbol-processor/src"
VERBATIM
)
# Build
add_library(symbols SHARED "${SRC_OUTPUT_FILE}" "${HEADER_OUTPUT_FILE}")
# Show In IDE
add_custom_target(symbols-src
DEPENDS "${SRC_OUTPUT_FILE}" "${HEADER_OUTPUT_FILE}"
SOURCES ${RESOLVED_SRC}
)
# Include Directory
target_include_directories(
symbols
PUBLIC
"$<BUILD_INTERFACE:${INCLUDE_OUTPUT_DIR}>"
"$<INSTALL_INTERFACE:${MCPI_SDK_INCLUDE_DIR}/symbols>"
)
# Disable C++11 String ABI
target_compile_definitions(symbols PUBLIC -D_GLIBCXX_USE_CXX11_ABI=0)
# Install
install(TARGETS symbols DESTINATION "${MCPI_LIB_DIR}")
# SDK
install(TARGETS symbols EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
install(DIRECTORY "${INCLUDE_OUTPUT_DIR}/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/symbols")