add_executable(opense4-datacheck datacheck.cpp)
target_link_libraries(opense4-datacheck PRIVATE opense4_ruleset opense4_warnings)
set_target_properties(opense4-datacheck PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
opense4_windows_manifest(opense4-datacheck)

# The original's saved games and OpenSE4's, both ways (docs/SETUP.md).
add_executable(opense4-convert convert.cpp)
target_link_libraries(opense4-convert PRIVATE opense4_game opense4_warnings)
set_target_properties(opense4-convert PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
opense4_windows_manifest(opense4-convert)

# The modding SDK's tool: new, check, dump, pack and info (docs/sdk/packages-and-data.md);
# test, run, arena, env-host, bot and python (docs/sdk/bots-and-arena.md). The arena and
# the training environment read the server's setup files.
add_executable(opense4-sdk sdk.cpp sdk_arena.cpp sdk_common.cpp sdk_env.cpp sdk_test.cpp
    ${CMAKE_SOURCE_DIR}/src/server/setup_file.cpp)
target_link_libraries(opense4-sdk PRIVATE opense4_sdk opense4_mods opense4_net opense4_assets tomlplusplus opense4_warnings)
set_target_properties(opense4-sdk PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# `opense4-sdk new --from-example` finds the example mods in sdk/examples beside the
# program, where a release has them (tools/package_release.sh), and a developer build
# also in the source tree. Release builds leave the source tree out, so that the build
# machine's paths stay out of the binary.
if(OPENSE4_DEV_PATHS)
    target_compile_definitions(opense4-sdk PRIVATE OPENSE4_EXAMPLES_SOURCE_DIR="${CMAKE_SOURCE_DIR}/mods/examples")
endif()
opense4_windows_manifest(opense4-sdk)

# Black-box observation of the original game under X11/XWayland (Linux dev tool).
find_package(X11 QUIET)
if(X11_FOUND AND X11_XTest_FOUND)
    add_executable(opense4-observe observe/observe.cpp)
    target_link_libraries(opense4-observe PRIVATE X11::X11 X11::Xtst)
    set_target_properties(opense4-observe PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif()
