build: refresh toolchain and dependency wiring
This commit is contained in:
@@ -110,7 +110,6 @@ set(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory(src)
|
||||
|
||||
# Tools
|
||||
option(YAZE_BUILD_TOOLS "Build development utility tools" OFF)
|
||||
if(YAZE_BUILD_TOOLS)
|
||||
message(STATUS "Building development tools")
|
||||
add_subdirectory(tools)
|
||||
|
||||
@@ -4,17 +4,32 @@
|
||||
{
|
||||
"name": "dev-local",
|
||||
"inherits": "dev",
|
||||
"binaryDir": "$env{YAZE_BUILD_ROOT}/build"
|
||||
"binaryDir": "$env{YAZE_BUILD_ROOT}/build",
|
||||
"environment": {
|
||||
"CPM_SOURCE_CACHE": "$env{HOME}/.cpm-cache",
|
||||
"VCPKG_DOWNLOADS": "$env{HOME}/.cache/vcpkg/downloads",
|
||||
"VCPKG_BINARY_SOURCES": "clear;files,$env{HOME}/.cache/vcpkg/bincache,readwrite"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "wasm-debug-local",
|
||||
"inherits": "wasm-debug",
|
||||
"binaryDir": "$env{YAZE_BUILD_ROOT}/build-wasm"
|
||||
"binaryDir": "$env{YAZE_BUILD_ROOT}/build-wasm",
|
||||
"environment": {
|
||||
"CPM_SOURCE_CACHE": "$env{HOME}/.cpm-cache",
|
||||
"VCPKG_DOWNLOADS": "$env{HOME}/.cache/vcpkg/downloads",
|
||||
"VCPKG_BINARY_SOURCES": "clear;files,$env{HOME}/.cache/vcpkg/bincache,readwrite"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "wasm-release-local",
|
||||
"inherits": "wasm-release",
|
||||
"binaryDir": "$env{YAZE_BUILD_ROOT}/build-wasm"
|
||||
"binaryDir": "$env{YAZE_BUILD_ROOT}/build-wasm",
|
||||
"environment": {
|
||||
"CPM_SOURCE_CACHE": "$env{HOME}/.cpm-cache",
|
||||
"VCPKG_DOWNLOADS": "$env{HOME}/.cache/vcpkg/downloads",
|
||||
"VCPKG_BINARY_SOURCES": "clear;files,$env{HOME}/.cache/vcpkg/bincache,readwrite"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
|
||||
@@ -14,9 +14,24 @@ set(_YAZE_USE_SYSTEM_GTEST ${YAZE_USE_SYSTEM_DEPS})
|
||||
|
||||
# Detect Homebrew installation automatically (helps offline builds)
|
||||
if(APPLE AND NOT _YAZE_USE_SYSTEM_GTEST)
|
||||
set(_YAZE_GTEST_PREFIX_CANDIDATES
|
||||
/opt/homebrew/opt/googletest
|
||||
/usr/local/opt/googletest)
|
||||
set(_YAZE_GTEST_PREFIX_CANDIDATES)
|
||||
set(_YAZE_HOST_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
if(NOT _YAZE_HOST_ARCH)
|
||||
execute_process(
|
||||
COMMAND uname -m
|
||||
OUTPUT_VARIABLE _YAZE_HOST_ARCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
endif()
|
||||
|
||||
if(_YAZE_HOST_ARCH STREQUAL "arm64")
|
||||
list(APPEND _YAZE_GTEST_PREFIX_CANDIDATES
|
||||
/opt/homebrew/opt/googletest)
|
||||
else()
|
||||
list(APPEND _YAZE_GTEST_PREFIX_CANDIDATES
|
||||
/usr/local/opt/googletest
|
||||
/opt/homebrew/opt/googletest)
|
||||
endif()
|
||||
|
||||
foreach(_prefix IN LISTS _YAZE_GTEST_PREFIX_CANDIDATES)
|
||||
if(EXISTS "${_prefix}")
|
||||
@@ -37,6 +52,9 @@ if(APPLE AND NOT _YAZE_USE_SYSTEM_GTEST)
|
||||
RESULT_VARIABLE HOMEBREW_GTEST_RESULT
|
||||
ERROR_QUIET)
|
||||
if(HOMEBREW_GTEST_RESULT EQUAL 0 AND EXISTS "${HOMEBREW_GTEST_PREFIX}")
|
||||
if(_YAZE_HOST_ARCH STREQUAL "arm64" AND NOT HOMEBREW_GTEST_PREFIX MATCHES "^/opt/homebrew")
|
||||
message(STATUS "Skipping Homebrew googletest prefix on arm64: ${HOMEBREW_GTEST_PREFIX}")
|
||||
else()
|
||||
list(APPEND CMAKE_PREFIX_PATH "${HOMEBREW_GTEST_PREFIX}")
|
||||
message(STATUS "Added Homebrew googletest prefix: ${HOMEBREW_GTEST_PREFIX}")
|
||||
set(_YAZE_USE_SYSTEM_GTEST ON)
|
||||
@@ -44,6 +62,7 @@ if(APPLE AND NOT _YAZE_USE_SYSTEM_GTEST)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Try to use system packages first
|
||||
if(_YAZE_USE_SYSTEM_GTEST)
|
||||
|
||||
@@ -7,16 +7,39 @@
|
||||
# 1. Set the target system (macOS)
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
|
||||
# Ensure a non-empty system version for third-party CMake logic.
|
||||
if(NOT CMAKE_SYSTEM_VERSION)
|
||||
execute_process(
|
||||
COMMAND sw_vers -productVersion
|
||||
OUTPUT_VARIABLE _yaze_macos_version
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(_yaze_macos_version)
|
||||
set(CMAKE_SYSTEM_VERSION "${_yaze_macos_version}")
|
||||
else()
|
||||
set(CMAKE_SYSTEM_VERSION "0")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 2. Find the Homebrew LLVM installation path
|
||||
# We use execute_process to make this portable across machine architectures.
|
||||
set(_yaze_llvm_candidates llvm@21 llvm@20 llvm@19 llvm@18 llvm)
|
||||
foreach(_yaze_llvm_candidate IN LISTS _yaze_llvm_candidates)
|
||||
execute_process(
|
||||
COMMAND brew --prefix llvm@18
|
||||
OUTPUT_VARIABLE HOMEBREW_LLVM_PREFIX
|
||||
COMMAND brew --prefix ${_yaze_llvm_candidate}
|
||||
OUTPUT_VARIABLE _yaze_llvm_prefix
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE _yaze_llvm_result
|
||||
)
|
||||
if(_yaze_llvm_result EQUAL 0 AND EXISTS "${_yaze_llvm_prefix}")
|
||||
set(HOMEBREW_LLVM_PREFIX "${_yaze_llvm_prefix}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT EXISTS "${HOMEBREW_LLVM_PREFIX}")
|
||||
message(FATAL_ERROR "Homebrew LLVM not found. Please run 'brew install llvm'. Path: ${HOMEBREW_LLVM_PREFIX}")
|
||||
message(FATAL_ERROR "Homebrew LLVM not found. Please run 'brew install llvm'.")
|
||||
endif()
|
||||
|
||||
# Cache this variable so it's available in the main CMakeLists.txt
|
||||
@@ -52,18 +75,29 @@ execute_process(
|
||||
set(CMAKE_SYSROOT "${CMAKE_OSX_SYSROOT}")
|
||||
message(STATUS "Using macOS SDK at: ${CMAKE_SYSROOT}")
|
||||
|
||||
# 5. **[THE CRITICAL FIX]** Explicitly define the C++ standard library include directory.
|
||||
# This forces CMake to add Homebrew's libc++ headers to the search path *before*
|
||||
# any other system paths, resolving the header conflict for the main project
|
||||
# and all dependencies.
|
||||
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "${HOMEBREW_LLVM_PREFIX}/include/c++/v1")
|
||||
# 5. Ensure Homebrew libc++ + Clang resource headers are searched before SDK headers.
|
||||
execute_process(
|
||||
COMMAND "${HOMEBREW_LLVM_PREFIX}/bin/clang++" -print-resource-dir
|
||||
OUTPUT_VARIABLE HOMEBREW_LLVM_RESOURCE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(HOMEBREW_LLVM_RESOURCE_INCLUDE "${HOMEBREW_LLVM_RESOURCE_DIR}/include")
|
||||
|
||||
if(EXISTS "${HOMEBREW_LLVM_PREFIX}/include/c++/v1")
|
||||
set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
|
||||
include_directories(BEFORE SYSTEM "${HOMEBREW_LLVM_PREFIX}/include/c++/v1")
|
||||
endif()
|
||||
if(EXISTS "${HOMEBREW_LLVM_RESOURCE_INCLUDE}")
|
||||
include_directories(BEFORE SYSTEM "${HOMEBREW_LLVM_RESOURCE_INCLUDE}")
|
||||
endif()
|
||||
|
||||
# 5.5 Ensure Homebrew libc++ is linked to avoid mixing ABI with system libc++.
|
||||
set(_yaze_llvm_lib_dir "${HOMEBREW_LLVM_PREFIX}/lib")
|
||||
set(_yaze_llvm_libcxx_dir "${HOMEBREW_LLVM_PREFIX}/lib/c++")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} -stdlib=libc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} -L${_yaze_llvm_lib_dir} -Wl,-rpath,${_yaze_llvm_lib_dir}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} -L${_yaze_llvm_lib_dir} -Wl,-rpath,${_yaze_llvm_lib_dir}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} -L${_yaze_llvm_lib_dir} -Wl,-rpath,${_yaze_llvm_lib_dir}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} -L${_yaze_llvm_lib_dir} -Wl,-rpath,${_yaze_llvm_lib_dir} -L${_yaze_llvm_libcxx_dir} -Wl,-rpath,${_yaze_llvm_libcxx_dir}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} -L${_yaze_llvm_lib_dir} -Wl,-rpath,${_yaze_llvm_lib_dir} -L${_yaze_llvm_libcxx_dir} -Wl,-rpath,${_yaze_llvm_libcxx_dir}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} -L${_yaze_llvm_lib_dir} -Wl,-rpath,${_yaze_llvm_lib_dir} -L${_yaze_llvm_libcxx_dir} -Wl,-rpath,${_yaze_llvm_libcxx_dir}")
|
||||
|
||||
# 6. Set the default installation path for macOS frameworks
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
|
||||
@@ -8,6 +8,7 @@ option(YAZE_BUILD_Z3ED "Build z3ed CLI executable" ON)
|
||||
option(YAZE_BUILD_EMU "Build emulator components" ON)
|
||||
option(YAZE_BUILD_LIB "Build static library" ON)
|
||||
option(YAZE_BUILD_TESTS "Build test suite" ON)
|
||||
option(YAZE_BUILD_TOOLS "Build development utility tools" ${YAZE_BUILD_TESTS})
|
||||
|
||||
# Feature flags
|
||||
option(YAZE_ENABLE_GRPC "Enable gRPC agent support" ON)
|
||||
@@ -149,4 +150,3 @@ message(STATUS "Sanitizers: ${YAZE_ENABLE_SANITIZERS}")
|
||||
message(STATUS "Coverage: ${YAZE_ENABLE_COVERAGE}")
|
||||
message(STATUS "OpenCV Visual Analysis: ${YAZE_ENABLE_OPENCV}")
|
||||
message(STATUS "=================================")
|
||||
|
||||
|
||||
@@ -60,8 +60,6 @@ function Test-GitSubmodules {
|
||||
"src/lib/abseil-cpp",
|
||||
"ext/asar",
|
||||
"ext/imgui",
|
||||
"ext/json",
|
||||
"ext/httplib",
|
||||
"ext/imgui_test_engine",
|
||||
"ext/nativefiledialog-extended"
|
||||
)
|
||||
|
||||
@@ -94,8 +94,6 @@ function test_git_submodules() {
|
||||
"src/lib/abseil-cpp"
|
||||
"ext/asar"
|
||||
"ext/imgui"
|
||||
"ext/json"
|
||||
"ext/httplib"
|
||||
"ext/imgui_test_engine"
|
||||
"ext/nativefiledialog-extended"
|
||||
)
|
||||
@@ -275,16 +273,26 @@ function sync_git_submodules() {
|
||||
function test_dependency_compatibility() {
|
||||
write_status "Testing dependency configuration..." "Step"
|
||||
|
||||
# Check httplib configuration
|
||||
if [[ -f "ext/httplib/CMakeLists.txt" ]]; then
|
||||
write_status "httplib found in ext/" "Success"
|
||||
SUCCESS+=("httplib header-only library available")
|
||||
fi
|
||||
local deps_found=0
|
||||
local build_dirs=(
|
||||
"build"
|
||||
"build-wasm"
|
||||
"build-test"
|
||||
"build-grpc-test"
|
||||
"build_agent"
|
||||
"build_ci"
|
||||
)
|
||||
|
||||
# Check json library
|
||||
if [[ -d "ext/json/include" ]]; then
|
||||
write_status "nlohmann/json found in ext/" "Success"
|
||||
SUCCESS+=("nlohmann/json header-only library available")
|
||||
for dir in "${build_dirs[@]}"; do
|
||||
if [[ -d "$dir/_deps/nlohmann_json-src" ]] || [[ -d "$dir/_deps/httplib-src" ]]; then
|
||||
write_status "CPM dependencies present in $dir/_deps" "Success"
|
||||
SUCCESS+=("CPM dependencies available in $dir")
|
||||
deps_found=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $deps_found -eq 0 ]]; then
|
||||
write_status "cpp-httplib and nlohmann/json are fetched by CPM during configure" "Info"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -109,8 +109,9 @@ if(APPLE)
|
||||
)
|
||||
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_include_directories(yaze_app_objcxx PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
if(TARGET nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(yaze_app_objcxx PUBLIC nlohmann_json::nlohmann_json)
|
||||
endif()
|
||||
target_compile_definitions(yaze_app_objcxx PUBLIC YAZE_WITH_JSON)
|
||||
endif()
|
||||
|
||||
@@ -121,7 +122,7 @@ if(APPLE)
|
||||
if(NOT COCOA_LIBRARY)
|
||||
message(FATAL_ERROR "Cocoa not found")
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-framework ServiceManagement -framework Foundation -framework Cocoa")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework ServiceManagement -framework Foundation -framework Cocoa")
|
||||
endif()
|
||||
|
||||
# Create the application core library
|
||||
@@ -139,13 +140,13 @@ target_include_directories(yaze_app_core_lib PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/app
|
||||
${CMAKE_SOURCE_DIR}/ext
|
||||
${CMAKE_SOURCE_DIR}/ext/imgui
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_link_libraries(yaze_app_core_lib PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_compile_definitions(yaze_app_core_lib PUBLIC YAZE_WITH_JSON)
|
||||
endif()
|
||||
|
||||
@@ -174,8 +175,6 @@ endif()
|
||||
|
||||
# gRPC Services (Optional)
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_include_directories(yaze_app_core_lib PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
target_compile_definitions(yaze_app_core_lib PRIVATE YAZE_WITH_JSON)
|
||||
# Link to consolidated gRPC support library
|
||||
target_link_libraries(yaze_app_core_lib PUBLIC yaze_grpc_support)
|
||||
|
||||
@@ -112,6 +112,7 @@ set(
|
||||
app/editor/layout_designer/widget_code_generator.cc
|
||||
app/editor/layout_designer/theme_properties.cc
|
||||
app/editor/layout_designer/yaze_widgets.cc
|
||||
yaze.cc
|
||||
)
|
||||
|
||||
# Agent UI Theme is always needed (used by dungeon editor, etc.)
|
||||
@@ -193,9 +194,6 @@ endif()
|
||||
# Note: yaze_test_support linking is deferred to test.cmake to ensure proper ordering
|
||||
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_include_directories(yaze_editor PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
|
||||
if(TARGET nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(yaze_editor PUBLIC nlohmann_json::nlohmann_json)
|
||||
endif()
|
||||
|
||||
@@ -57,8 +57,6 @@ target_include_directories(yaze_net PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/ext
|
||||
${CMAKE_SOURCE_DIR}/ext/imgui
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include
|
||||
${CMAKE_SOURCE_DIR}/ext/httplib
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
@@ -69,6 +67,10 @@ target_link_libraries(yaze_net PUBLIC
|
||||
${YAZE_SDL2_TARGETS}
|
||||
)
|
||||
|
||||
if(NOT EMSCRIPTEN AND YAZE_HTTPLIB_TARGETS)
|
||||
target_link_libraries(yaze_net PUBLIC ${YAZE_HTTPLIB_TARGETS})
|
||||
endif()
|
||||
|
||||
# Add Emscripten-specific flags for WASM builds
|
||||
if(EMSCRIPTEN)
|
||||
# Enable Fetch API for HTTP requests
|
||||
@@ -87,7 +89,6 @@ endif()
|
||||
if(YAZE_ENABLE_JSON)
|
||||
# Link nlohmann_json which provides the include directories automatically
|
||||
target_link_libraries(yaze_net PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_include_directories(yaze_net PUBLIC ${CMAKE_SOURCE_DIR}/ext/httplib)
|
||||
target_compile_definitions(yaze_net PUBLIC YAZE_WITH_JSON)
|
||||
|
||||
# Add threading support (cross-platform)
|
||||
|
||||
@@ -58,8 +58,7 @@ target_link_libraries(yaze_grpc_support PUBLIC
|
||||
|
||||
# Add JSON support
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_include_directories(yaze_grpc_support PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
target_link_libraries(yaze_grpc_support PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_compile_definitions(yaze_grpc_support PUBLIC YAZE_WITH_JSON)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ target_link_libraries(yaze_test_support PUBLIC
|
||||
|
||||
# Add gRPC dependencies if test harness is enabled
|
||||
if(YAZE_WITH_GRPC)
|
||||
target_include_directories(yaze_test_support PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
target_compile_definitions(yaze_test_support PRIVATE YAZE_WITH_JSON)
|
||||
|
||||
# Link to consolidated gRPC support library
|
||||
|
||||
@@ -87,7 +87,6 @@ if(EMSCRIPTEN)
|
||||
|
||||
# Add JSON support for API communication
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_include_directories(yaze_agent PUBLIC ${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
target_link_libraries(yaze_agent PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_compile_definitions(yaze_agent PUBLIC YAZE_WITH_JSON)
|
||||
endif()
|
||||
@@ -288,6 +287,10 @@ endif()
|
||||
|
||||
target_link_libraries(yaze_agent PUBLIC ${_yaze_agent_link_targets})
|
||||
|
||||
if(NOT EMSCRIPTEN AND YAZE_HTTPLIB_TARGETS)
|
||||
target_link_libraries(yaze_agent PUBLIC ${YAZE_HTTPLIB_TARGETS})
|
||||
endif()
|
||||
|
||||
# Ensure yaml-cpp include paths propagate even when using system packages
|
||||
if(YAZE_ENABLE_AI_RUNTIME)
|
||||
set(_yaml_targets_to_check ${YAZE_YAML_TARGETS} yaml-cpp yaml-cpp::yaml-cpp)
|
||||
@@ -306,24 +309,21 @@ target_include_directories(yaze_agent
|
||||
PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${CMAKE_SOURCE_DIR}/ext/httplib
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/src/cli/handlers
|
||||
${CMAKE_BINARY_DIR}/gens
|
||||
)
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME AND YAZE_ENABLE_JSON)
|
||||
target_include_directories(yaze_agent PUBLIC ${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
endif()
|
||||
|
||||
if(SDL2_INCLUDE_DIR)
|
||||
target_include_directories(yaze_agent PUBLIC ${SDL2_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME AND YAZE_ENABLE_JSON)
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_link_libraries(yaze_agent PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_compile_definitions(yaze_agent PUBLIC YAZE_WITH_JSON)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME AND YAZE_ENABLE_JSON)
|
||||
# Only link OpenSSL if gRPC is NOT enabled (to avoid duplicate symbol errors)
|
||||
# When gRPC is enabled, it brings its own OpenSSL which we'll use instead
|
||||
if(NOT YAZE_ENABLE_REMOTE_AUTOMATION)
|
||||
|
||||
@@ -155,7 +155,7 @@ Access-Control-Allow-Origin: *
|
||||
### Architecture
|
||||
|
||||
The HTTP API is built using:
|
||||
- **cpp-httplib** - Header-only HTTP server library (`ext/httplib/`)
|
||||
- **cpp-httplib** - Header-only HTTP server library (fetched via CPM)
|
||||
- **nlohmann/json** - JSON serialization/deserialization
|
||||
- **ModelRegistry** - Unified model management across providers
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ target_link_libraries(yaze_core_lib PUBLIC
|
||||
# JSON support for project serialization
|
||||
if(TARGET nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(yaze_core_lib PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_include_directories(yaze_core_lib PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add Asar support (links asar-static and adds YAZE_ENABLE_ASAR definition)
|
||||
|
||||
@@ -76,7 +76,6 @@ target_include_directories(yaze_zelda3 PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ if(YAZE_BUILD_TESTS)
|
||||
endif()
|
||||
|
||||
target_include_directories(${suite_name} PUBLIC
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
${CMAKE_SOURCE_DIR}/test
|
||||
@@ -26,7 +27,6 @@ if(YAZE_BUILD_TESTS)
|
||||
${CMAKE_SOURCE_DIR}/ext/imgui/backends
|
||||
${CMAKE_SOURCE_DIR}/ext/imgui_test_engine
|
||||
${CMAKE_SOURCE_DIR}/ext/SDL/include
|
||||
${CMAKE_SOURCE_DIR}/ext/json/include
|
||||
${CMAKE_BINARY_DIR}/ext/SDL/include
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
@@ -42,6 +42,13 @@ if(YAZE_BUILD_TESTS)
|
||||
${YAZE_SDL2_TARGETS}
|
||||
)
|
||||
|
||||
if(YAZE_ENABLE_JSON AND TARGET nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(${suite_name} PRIVATE nlohmann_json::nlohmann_json)
|
||||
endif()
|
||||
if(TARGET httplib::httplib)
|
||||
target_link_libraries(${suite_name} PRIVATE httplib::httplib)
|
||||
endif()
|
||||
|
||||
# Link ImGui Test Engine for GUI tests (always available when tests are built)
|
||||
if(is_gui_test AND TARGET ImGuiTestEngine)
|
||||
target_link_libraries(${suite_name} PRIVATE ImGuiTestEngine)
|
||||
@@ -92,6 +99,7 @@ if(YAZE_BUILD_TESTS)
|
||||
# Unit Tests
|
||||
unit/core/asar_wrapper_test.cc
|
||||
unit/core/hex_test.cc
|
||||
unit/deps/dependency_smoke_test.cc
|
||||
unit/cli/resource_catalog_test.cc
|
||||
unit/rom/rom_test.cc
|
||||
unit/gfx/snes_tile_test.cc
|
||||
|
||||
21
test/unit/deps/dependency_smoke_test.cc
Normal file
21
test/unit/deps/dependency_smoke_test.cc
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "httplib.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "testing.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace test {
|
||||
|
||||
TEST(DependencySmokeTest, JsonAndHttpLibAvailable) {
|
||||
nlohmann::json payload = nlohmann::json::parse(R"({"ok":true})");
|
||||
EXPECT_TRUE(payload["ok"].get<bool>());
|
||||
|
||||
httplib::Client client("example.com");
|
||||
httplib::Headers headers{{"X-Test", "1"}};
|
||||
client.set_default_headers(headers);
|
||||
auto header_it = headers.find("X-Test");
|
||||
ASSERT_NE(header_it, headers.end());
|
||||
EXPECT_EQ(header_it->second, "1");
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace yaze
|
||||
Reference in New Issue
Block a user