11 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
181 lines
9.8 KiB
CMake
181 lines
9.8 KiB
CMake
# Opt-in native Windows counterpart of the maintained direct-login Bridge/Wire.
|
|
# The source lists follow ops/native_pe_bridge.py and ops/build_wine_wire.py.
|
|
# This target is a build closure; packaging and native acceptance remain separate.
|
|
option(GW_WINDOWS_NOHELPER_PROFILE5 "Build the maintained direct-login Bridge and Wire on Windows" OFF)
|
|
if(NOT GW_WINDOWS_NOHELPER_PROFILE5)
|
|
return()
|
|
endif()
|
|
|
|
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang)$" OR
|
|
CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
|
message(FATAL_ERROR "Windows profile5 requires a GNU-style Windows C/ASM toolchain")
|
|
endif()
|
|
if(NOT GW_WINDOWS_CODEC_IMPORT_LIBRARY OR NOT EXISTS "${GW_WINDOWS_CODEC_IMPORT_LIBRARY}")
|
|
message(FATAL_ERROR "Windows profile5 requires the current native codec import library")
|
|
endif()
|
|
# The owner build always uses the established immutable Octo profile. Local
|
|
# endpoints are permitted only in an explicitly selected test build, including
|
|
# when a previous CMake cache still holds local endpoint values.
|
|
set(GW_WINDOWS_SOURCE_ENDPOINT "OCTO" CACHE STRING "Source endpoint: OCTO owner build or LOCAL test fixture")
|
|
set_property(CACHE GW_WINDOWS_SOURCE_ENDPOINT PROPERTY STRINGS OCTO LOCAL)
|
|
if(NOT GW_WINDOWS_SOURCE_ENDPOINT MATCHES "^(OCTO|LOCAL)$")
|
|
message(FATAL_ERROR "GW_WINDOWS_SOURCE_ENDPOINT must be OCTO or LOCAL")
|
|
endif()
|
|
set(GW_WINDOWS_PROFILE5_AUTH_IPV4 "" CACHE STRING "Pinned local Source auth IPv4")
|
|
set(GW_WINDOWS_PROFILE5_AUTH_PORT "" CACHE STRING "Pinned local Source auth port")
|
|
set(GW_WINDOWS_PROFILE5_REALM_IPV4 "" CACHE STRING "Pinned local Source realm IPv4")
|
|
set(GW_WINDOWS_PROFILE5_REALM_PORT "" CACHE STRING "Pinned local Source realm port")
|
|
if(GW_WINDOWS_SOURCE_ENDPOINT STREQUAL "LOCAL")
|
|
foreach(_gw_input IN ITEMS AUTH_IPV4 AUTH_PORT REALM_IPV4 REALM_PORT)
|
|
if("${GW_WINDOWS_PROFILE5_${_gw_input}}" STREQUAL "")
|
|
message(FATAL_ERROR "LOCAL test build requires GW_WINDOWS_PROFILE5_${_gw_input}")
|
|
endif()
|
|
endforeach()
|
|
foreach(_gw_port IN ITEMS AUTH_PORT REALM_PORT)
|
|
if(NOT GW_WINDOWS_PROFILE5_${_gw_port} MATCHES "^[0-9]+$" OR
|
|
GW_WINDOWS_PROFILE5_${_gw_port} LESS 1 OR
|
|
GW_WINDOWS_PROFILE5_${_gw_port} GREATER 65535)
|
|
message(FATAL_ERROR "Invalid Windows profile5 ${_gw_port}")
|
|
endif()
|
|
endforeach()
|
|
set(_gw_bridge_endpoint_definitions
|
|
GW_DIRECT_PROFILE5_AUTH_IPV4="${GW_WINDOWS_PROFILE5_AUTH_IPV4}"
|
|
GW_DIRECT_PROFILE5_AUTH_PORT=${GW_WINDOWS_PROFILE5_AUTH_PORT})
|
|
set(_gw_wire_endpoint_definitions
|
|
GW_SOURCE_ONLY_PROFILE=5
|
|
GW_SOURCE_LOCAL_AUTH_IPV4="${GW_WINDOWS_PROFILE5_AUTH_IPV4}"
|
|
GW_SOURCE_LOCAL_AUTH_PORT=${GW_WINDOWS_PROFILE5_AUTH_PORT}
|
|
GW_SOURCE_LOCAL_REALM_IPV4="${GW_WINDOWS_PROFILE5_REALM_IPV4}"
|
|
GW_SOURCE_LOCAL_REALM_PORT=${GW_WINDOWS_PROFILE5_REALM_PORT})
|
|
else()
|
|
foreach(_gw_input IN ITEMS AUTH_IPV4 AUTH_PORT REALM_IPV4 REALM_PORT)
|
|
if(NOT "${GW_WINDOWS_PROFILE5_${_gw_input}}" STREQUAL "")
|
|
message(FATAL_ERROR "Local endpoint values require GW_WINDOWS_SOURCE_ENDPOINT=LOCAL; clear them for an OCTO owner build")
|
|
endif()
|
|
endforeach()
|
|
set(_gw_bridge_endpoint_definitions GW_DIRECT_PUBLIC_PROFILE=2)
|
|
set(_gw_wire_endpoint_definitions GW_SOURCE_ONLY_PROFILE=2)
|
|
endif()
|
|
|
|
enable_language(ASM)
|
|
set(_gw_profile5_native "${CMAKE_CURRENT_SOURCE_DIR}/native")
|
|
set(_gw_profile5_direct "${_gw_profile5_native}/nohelper")
|
|
set(_gw_profile5_include "${_gw_profile5_native}" "${_gw_profile5_direct}")
|
|
set(_gw_profile5_bridge_core
|
|
"${_gw_profile5_native}/engine_pe_bridge.c"
|
|
"${_gw_profile5_native}/engine_registration.c"
|
|
"${_gw_profile5_direct}/clogin_realm_rows.c"
|
|
"${_gw_profile5_direct}/clogin_register_thunk.S"
|
|
"${_gw_profile5_native}/engine_poll_host.c"
|
|
"${_gw_profile5_native}/engine_packet_host.c"
|
|
"${_gw_profile5_native}/source_login_registration.c"
|
|
"${_gw_profile5_direct}/bridge_coordinator.c"
|
|
"${_gw_profile5_direct}/original_c49_capture.c"
|
|
"${_gw_profile5_direct}/original_connect_export_hook.c"
|
|
"${_gw_profile5_direct}/original_connect_export_thunk.S"
|
|
"${_gw_profile5_direct}/owner_poll_self.c"
|
|
"${_gw_profile5_direct}/poll_coordinator.c"
|
|
"${_gw_profile5_direct}/startup_windows_transaction.c"
|
|
"${_gw_profile5_direct}/direct_login_patch_plan.c"
|
|
"${_gw_profile5_direct}/direct_near_relays.c"
|
|
"${_gw_profile5_direct}/direct_login_thunk.S"
|
|
"${_gw_profile5_direct}/direct_two_site_transaction.c"
|
|
"${_gw_profile5_direct}/direct_two_site_install.c"
|
|
"${_gw_profile5_direct}/direct_profile5_prepare.c"
|
|
"${_gw_profile5_direct}/direct_login_capture.c"
|
|
"${_gw_profile5_direct}/direct_login_dr0_observer.c"
|
|
"${_gw_profile5_direct}/pipe_admission_snapshot.c"
|
|
"${_gw_profile5_direct}/pipe_return_callback.c"
|
|
"${_gw_profile5_direct}/pipe_return_thunk.S"
|
|
"${_gw_profile5_direct}/openrealm_return_plan.c"
|
|
"${_gw_profile5_direct}/pipe_atomic.c"
|
|
"${_gw_profile5_direct}/pipe_live_input.c"
|
|
"${_gw_profile5_direct}/constructor_seam_plan.c"
|
|
"${_gw_profile5_direct}/realm_seam_page.c"
|
|
"${_gw_profile5_direct}/login_site_pages.c"
|
|
"${_gw_profile5_direct}/bridge_marker.c")
|
|
# Both endpoint profiles expose the maintained C_Login snapshot/request
|
|
# callbacks. The local creation UI also uses this provider to stage its genuine
|
|
# Source request; endpoint selection still controls the actual realm snapshot.
|
|
add_library(GWNativeBridgeProfile5Core OBJECT ${_gw_profile5_bridge_core})
|
|
add_library(GWNativeBridgeProfile5Startup OBJECT
|
|
"${_gw_profile5_direct}/startup_nohelper.c")
|
|
foreach(_gw_target IN ITEMS GWNativeBridgeProfile5Core GWNativeBridgeProfile5Startup)
|
|
target_include_directories(${_gw_target} PRIVATE ${_gw_profile5_include})
|
|
target_compile_definitions(${_gw_target} PRIVATE NOMINMAX _WIN32_WINNT=0x0A00)
|
|
target_compile_options(${_gw_target} PRIVATE
|
|
$<$<COMPILE_LANGUAGE:C>:-O2;-Wall;-Wextra;-Werror;-Wno-missing-field-initializers;-ffreestanding;-fno-builtin;-fno-stack-protector;-funwind-tables>)
|
|
endforeach()
|
|
# Preserve the accepted split: the startup owner is profile2; other Bridge
|
|
# sources retain profile3 while exporting the maintained profile5 entry route.
|
|
target_compile_definitions(GWNativeBridgeProfile5Core PRIVATE
|
|
GW_SOURCE_ONLY_PROFILE=3 ${_gw_bridge_endpoint_definitions})
|
|
target_compile_definitions(GWNativeBridgeProfile5Startup PRIVATE
|
|
GW_SOURCE_ONLY_PROFILE=2 GW_WINDOWS_NATIVE_D3D11=1)
|
|
option(GW_DIRECT_LOGIN_DR0_CANDIDATE "Use the private one-shot Login DR0 observer" OFF)
|
|
option(GW_DIRECT_LOGIN_DR0_DIAG "Numeric first-C49 DR0 diagnostic" OFF)
|
|
if(GW_DIRECT_LOGIN_DR0_CANDIDATE OR GW_DIRECT_LOGIN_DR0_DIAG)
|
|
message(FATAL_ERROR "The DR0 Login experiment is archived under runtime; maintained profile5 uses the accepted first-login E9/C49 route")
|
|
endif()
|
|
add_library(GWNativeBridgeProfile5 SHARED
|
|
$<TARGET_OBJECTS:GWNativeBridgeProfile5Core>
|
|
$<TARGET_OBJECTS:GWNativeBridgeProfile5Startup>
|
|
"${_gw_profile5_direct}/exports.def")
|
|
target_link_options(GWNativeBridgeProfile5 PRIVATE
|
|
-nostartfiles -Wl,-e,0 -Wl,--no-undefined)
|
|
target_link_libraries(GWNativeBridgeProfile5 PRIVATE kernel32 user32 msvcrt)
|
|
set_target_properties(GWNativeBridgeProfile5 PROPERTIES
|
|
PREFIX "" OUTPUT_NAME "GWNativeBridge"
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/windows-profile5"
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/windows-profile5")
|
|
|
|
# App-local native D3D11 carrier. The original Windows DLL remains in
|
|
# System32; Bridge resolves its creation exports by absolute system path.
|
|
add_library(GWNativeD3D11Profile5 SHARED
|
|
"${_gw_profile5_direct}/windows_d3d11_proxy.c"
|
|
"${_gw_profile5_direct}/windows_d3d11_proxy.def")
|
|
target_compile_definitions(GWNativeD3D11Profile5 PRIVATE NOMINMAX _WIN32_WINNT=0x0A00)
|
|
target_compile_options(GWNativeD3D11Profile5 PRIVATE
|
|
$<$<COMPILE_LANGUAGE:C>:-O2;-Wall;-Wextra;-Werror;-ffreestanding;-fno-builtin;-fno-stack-protector;-funwind-tables>)
|
|
target_link_options(GWNativeD3D11Profile5 PRIVATE
|
|
-nostartfiles -Wl,-e,0 -Wl,--no-undefined)
|
|
target_link_libraries(GWNativeD3D11Profile5 PRIVATE GWNativeBridgeProfile5 kernel32)
|
|
set_target_properties(GWNativeD3D11Profile5 PROPERTIES
|
|
PREFIX "" OUTPUT_NAME "d3d11"
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/windows-profile5")
|
|
|
|
add_library(GWNativeWireProfile5 SHARED
|
|
"${_gw_profile5_native}/wine_wire_windows.c"
|
|
"${_gw_profile5_native}/wine_bundle_paths.c"
|
|
"${_gw_profile5_native}/wine_wire_account.c"
|
|
"${_gw_profile5_native}/wine_wire_listener.c"
|
|
"${_gw_profile5_native}/wine_engine_realm.c"
|
|
"${_gw_profile5_native}/wine_pipe_host.c"
|
|
"${_gw_profile5_native}/wine_channel_policy.c"
|
|
"${_gw_profile5_native}/wine_session_retirement.c"
|
|
"${_gw_profile5_direct}/wine_preopen_hook.c"
|
|
"${_gw_profile5_direct}/wire_profile5_auto_realm.c"
|
|
"${_gw_profile5_native}/wine_source_profile.c"
|
|
"${_gw_profile5_native}/wine_source_resolver.c"
|
|
"${_gw_profile5_native}/wine_source_preflight.c"
|
|
"${_gw_profile5_native}/wine_source_login_readiness.c"
|
|
# Preserve public ordinals 1..79 and the appended diagnostic ordinal 80.
|
|
"${_gw_profile5_direct}/wire_exports.def")
|
|
target_include_directories(GWNativeWireProfile5 PRIVATE ${_gw_profile5_include}
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
target_compile_definitions(GWNativeWireProfile5 PRIVATE
|
|
NOMINMAX WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0A00
|
|
GW_NATIVE_WINDOWS=1 GW_NATIVE_LINKED_BACKEND=1
|
|
GW_SOURCE_UI_CREATE_EXPERIMENT=1 GW_ENABLE_SELF_LOCATING_BUNDLE=1
|
|
${_gw_wire_endpoint_definitions})
|
|
target_compile_options(GWNativeWireProfile5 PRIVATE
|
|
$<$<COMPILE_LANGUAGE:C>:-O2;-Wall;-Wextra;-Werror;-ffreestanding;-fno-stack-protector;-funwind-tables;-include;winternl.h>)
|
|
target_link_options(GWNativeWireProfile5 PRIVATE
|
|
-nostartfiles -Wl,-e,0 -Wl,--no-undefined)
|
|
target_link_libraries(GWNativeWireProfile5 PRIVATE
|
|
GWNativeBackend GWNativeBridgeProfile5 kernel32 ntdll msvcrt ws2_32)
|
|
set_target_properties(GWNativeWireProfile5 PROPERTIES
|
|
PREFIX "" OUTPUT_NAME "GWNativeWire"
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/windows-profile5"
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/windows-profile5")
|