Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
d032f3e
Update clang-format so clang-21 works
yohjimane Sep 22, 2025
d6bc19c
Cmake for windows can load in vs2022
yohjimane Sep 22, 2025
19ba0b5
23/29 building with cmake on windows
yohjimane Sep 23, 2025
44da204
More work on windows cmake build
yohjimane Sep 23, 2025
c009d0c
linux works again, windows 27/30
yohjimane Sep 23, 2025
1f6ad77
cmake for windows builds successfully
yohjimane Sep 23, 2025
488c901
Cmake for windows - final commit
yohjimane Sep 23, 2025
b420c5c
address some PR comments
yohjimane Sep 23, 2025
b8010ba
Don't set CMAKE_DEFAULT_BUILD_TYPE for visual studio
yohjimane Sep 23, 2025
e5a7d85
Fix cmake for windows release master gold
yohjimane Sep 23, 2025
15554f6
Merge branch 'yohji/feat/cmake-windows' into dev
yohjimane Sep 29, 2025
14bb16c
feat(xrAnimation): Initial module setup and build system integration
yohjimane Jul 11, 2025
923a0af
feat(xrAnimation): Add animation conversion infrastructure
yohjimane Jul 11, 2025
8a97c3c
feat(xrAnimation): Implement ozz-animation runtime system
yohjimane Jul 11, 2025
5e005f2
feat(xrAnimation): Add documentation and test infrastructure
yohjimane Jul 11, 2025
c5d33f9
feat(xrAnimation): Complete Phase 1 ozz-animation integration
yohjimane Jul 11, 2025
28f7b77
feat(xrAnimation): Add test infrastructure and build configuration
yohjimane Jul 11, 2025
4655127
build: Add ozz-animation as git submodule
yohjimane Jul 11, 2025
c331d0b
refactor: Replace STL types with X-Ray equivalents in xrAnimation
yohjimane Jul 11, 2025
c8dd375
Implement OGF/OMF to ozz-animation converters
yohjimane Jul 11, 2025
713914c
fix: Implement SBoneShape validity check in OGF converter to fix skel…
yohjimane Jul 12, 2025
9dfe262
fix: Critical animation playback and skeleton orientation fixes
yohjimane Jul 13, 2025
73fb843
[xrAnimation] Add ozz_animation_viewer
yohjimane Jul 13, 2025
5bd5b2f
[xrAnimation] support multiple anims in one .ozz file
yohjimane Jul 13, 2025
5b7789b
tmp commit bc housefire
yohjimane Sep 17, 2025
3e88f5e
fix cmake, add scripts, codex stuff
yohjimane Sep 18, 2025
21b99c2
Fresh start
yohjimane Sep 18, 2025
3cee6e0
checkpoint 1 - bind pose matches
yohjimane Sep 18, 2025
1e5bac8
checkpoint 2 - cmake fixes
yohjimane Sep 18, 2025
fa77c75
fix vs build
yohjimane Sep 18, 2025
53c44c5
add initial tests
yohjimane Sep 19, 2025
a0db197
checkpoint - animation converted, almost matches source of truth
yohjimane Sep 19, 2025
d8352c0
Prep for some tests
yohjimane Sep 19, 2025
d91d1e7
Add bone logging
yohjimane Sep 19, 2025
14abc5f
Add bind pose toggle to ozz animation viewer
yohjimane Sep 19, 2025
03dafe1
Add test for multi motion conversion
yohjimane Sep 19, 2025
c63207e
Multi motion conversion and ui in ozz_animation_viewer
yohjimane Sep 20, 2025
7a5befa
Prevent skeleton from appearing incorrectly in viewer
yohjimane Sep 20, 2025
b04e785
Cleanup
yohjimane Sep 20, 2025
7af803e
add script into tools folder
yohjimane Sep 20, 2025
b8a5abd
add test for ozz mesh generation
yohjimane Sep 20, 2025
e44ebac
update helper script, continue work on mesh tests
yohjimane Sep 20, 2025
4e3b9ea
begin work on vertex test
yohjimane Sep 20, 2025
db3fa5a
more work on vertex/skinning test
yohjimane Sep 20, 2025
61f1606
chkpoint
yohjimane Sep 21, 2025
3d58f9f
checkpoint 2
yohjimane Sep 21, 2025
5a5445e
checkpoint 3 - separate meshes in one ozz file
yohjimane Sep 21, 2025
079546f
More tests
yohjimane Sep 21, 2025
c4462bd
Revert deduping faces bc ogf viewer doesnt do that
yohjimane Sep 21, 2025
7ae2f86
Textures working
yohjimane Sep 21, 2025
a005586
Add timers
yohjimane Sep 21, 2025
bef96e5
Remove redundant script, rename npc asset and move to npc path
yohjimane Sep 21, 2025
1cd5abc
Add scripts and assets for arms, weapon, monster, gunsl arms, gunsl w…
yohjimane Sep 21, 2025
3b9b87a
Refactor ozz animation viewer to use actual dearimgui lib
yohjimane Sep 21, 2025
cc6494a
Wire up gtest, begin ozzkinematics tdd
yohjimane Sep 21, 2025
7cc0299
Set up bind pose test
yohjimane Sep 21, 2025
8750371
Bind pose test passes
yohjimane Sep 21, 2025
e378b42
setup animation parity test
yohjimane Sep 21, 2025
1905343
animation parity test passes
yohjimane Sep 21, 2025
e746b61
animation parity test checks all bones
yohjimane Sep 21, 2025
3379f6e
cleanup
yohjimane Sep 21, 2025
a1ac137
add bundled .ozz mesh/skeleton test
yohjimane Sep 21, 2025
fcdf704
first pass at bundling
yohjimane Sep 21, 2025
3a57f67
remove unnecessary json dump feature
yohjimane Sep 22, 2025
2850325
Update docs, expand ozzkinematics class
yohjimane Sep 22, 2025
51fe5a4
Add skeleton initialization from ozz buffer test
yohjimane Sep 22, 2025
16da278
moar tests, add root level agents.md
yohjimane Sep 22, 2025
7ba1884
Add more parity tests
yohjimane Sep 22, 2025
044309f
Begin wiring ozzx/ozz into engine
yohjimane Sep 22, 2025
9fdfe89
more work hooking OzzKinematics into engine
yohjimane Sep 22, 2025
a88440c
more work hooking OzzKinematics into engine - part 2
yohjimane Sep 22, 2025
87886f3
Refactor to use engine types
yohjimane Sep 22, 2025
1b28090
hook into dsgraph, update docs
yohjimane Sep 22, 2025
e324821
add bundle regression test, more documentation, more work to wire int…
yohjimane Sep 22, 2025
6b32b32
Preserve .ozzx visuals through model_Create
yohjimane Sep 22, 2025
ef4b394
More work on integrating ozzkinematics
yohjimane Sep 22, 2025
d6ce394
Fix cmake build on linux
yohjimane Sep 23, 2025
e7106b5
Fix windows cmake build
yohjimane Sep 24, 2025
cd6b346
Fix windows mixed cmake build
yohjimane Sep 24, 2025
2f52f0b
Fix mixed build on linux
yohjimane Sep 24, 2025
6b2e2e1
fix windows mixed build (again)
yohjimane Sep 24, 2025
7c04bdf
Fix vs build pt1
yohjimane Sep 24, 2025
d15ea8c
Fix vs2022 build
yohjimane Sep 24, 2025
c21ae87
Work to support playing ozz anim files
yohjimane Sep 24, 2025
f29bfa9
Update scripts to run for linux and windows
yohjimane Sep 24, 2025
014884d
tmp
yohjimane Sep 24, 2025
65a7ad2
tmp2
yohjimane Sep 24, 2025
3ec76ed
tmp3 - build works again
yohjimane Sep 24, 2025
b5505bc
xrAnimation: cover skeleton conversion output location
yohjimane Sep 24, 2025
136cc7b
Auto convert animations on loading ozzx, ozzx contains motion refs now
yohjimane Sep 24, 2025
e8555b8
Visual studio build fixed
yohjimane Sep 24, 2025
b04efee
Fix vertex buffer issue
yohjimane Sep 25, 2025
e93b65d
tmp
yohjimane Sep 25, 2025
21aa69e
tmp2
yohjimane Sep 25, 2025
109c1e5
tmp
yohjimane Sep 26, 2025
6991a7a
tmp
yohjimane Sep 27, 2025
6246909
no more box bug
yohjimane Sep 27, 2025
99dc3c3
TPOSE WORKS
yohjimane Sep 27, 2025
1f9c02f
tmp - animation almost playing
yohjimane Sep 27, 2025
3d0d290
tmp
yohjimane Sep 28, 2025
7fef12d
Cleanup
yohjimane Sep 28, 2025
bc4207f
tmp
yohjimane Sep 28, 2025
a5f773e
enable palette dumping for ogf, add rs_skeleton_force_bind_pose command
yohjimane Sep 28, 2025
af14973
tmp2
yohjimane Sep 28, 2025
fd16121
Exact parity between engine and ozz_animation_viewer
yohjimane Sep 29, 2025
d262a0f
Animation can play successfully in engine :)
yohjimane Sep 29, 2025
b6d0117
Fix mirroring
yohjimane Sep 29, 2025
71a5173
Port vertex fix from ogf viewer
yohjimane Sep 30, 2025
c747b78
Add vertex inspector
yohjimane Sep 30, 2025
11697f8
Triangle inspector
yohjimane Sep 30, 2025
a19f7c3
Triangle visualization
yohjimane Sep 30, 2025
0fb4d6f
More debug stuff in ozz viewer
yohjimane Sep 30, 2025
d571f0a
accurate raypick
yohjimane Sep 30, 2025
50a1dcc
Vert data in triangle inspector
yohjimane Sep 30, 2025
258554e
Track original/remap indexes on vertices
yohjimane Sep 30, 2025
8ccdc3a
Remove vertex remapping logic
yohjimane Sep 30, 2025
c3447f2
account for OGF_SWIDATA, progressive window
yohjimane Oct 1, 2025
8787f1a
Fix final bug
yohjimane Oct 1, 2025
3814a54
Fix tests, remove blender test
yohjimane Oct 1, 2025
2d2f192
Refactor tests
yohjimane Oct 1, 2025
e988b74
Doc next steps
yohjimane Oct 1, 2025
b155294
Progress on steps 1, 2 and IK
yohjimane Oct 1, 2025
66f62ce
remove deprecated code in xray_to_ozz_converter
yohjimane Oct 1, 2025
0e763f3
StartupConversionInventory progress
yohjimane Oct 1, 2025
0df694b
Fix bugs with previous commit on windows
yohjimane Oct 1, 2025
15445fa
Convert assets to ozzx/ozz during loading phase POC works
yohjimane Oct 1, 2025
83de251
Refactor OzzKinematicsVisual a bit
yohjimane Oct 2, 2025
bcf74f1
Fix anims saved under wrong dir
yohjimane Oct 2, 2025
e5b98ca
Tmp1 anim support
yohjimane Oct 2, 2025
794ffc6
Loading test level success
yohjimane Oct 2, 2025
8bcd608
Add disable for triangle debugger in ozz_animation_viewer
yohjimane Oct 2, 2025
8cdc8a1
Fix UV bug
yohjimane Oct 2, 2025
fdc4045
Cleanup OzzKinematics
yohjimane Oct 2, 2025
09b6be3
Tmp implement LL_PlayCycle
yohjimane Oct 2, 2025
338dd8d
Fix physics box crash
yohjimane Oct 2, 2025
dd695c4
Fix vs2022 build
yohjimane Oct 2, 2025
a292fea
cleanup pt1
yohjimane Oct 2, 2025
8a8622b
cleanup pt2
yohjimane Oct 2, 2025
c19a6ef
Tmp3
yohjimane Oct 2, 2025
dc917ed
Tmp4 add bone motions
yohjimane Oct 2, 2025
cb8bdd8
Fix anim playback
yohjimane Oct 3, 2025
c58c873
Passing bone motions along with other data now in .ozz/.ozzx
yohjimane Oct 3, 2025
513e0ff
Try rebuilding model pool on initial load
yohjimane Oct 3, 2025
d7e8dcc
Handle legacy ogf
yohjimane Oct 3, 2025
07044e4
Reloading modelpool to load ozz assets on initial load
yohjimane Oct 3, 2025
402c0a8
Fix grenade crash due to incorrect chunk parsing
yohjimane Oct 4, 2025
43ce986
fix crash1
yohjimane Oct 4, 2025
115cb9e
Create embedded motions and motion
yohjimane Oct 6, 2025
e414f2d
tmp
yohjimane Oct 6, 2025
c0b3747
Boot into full game on mixed build
yohjimane Oct 6, 2025
4bb00b3
slightly more stable?
yohjimane Oct 6, 2025
e461644
Working on stability + luajit debugging
yohjimane Oct 7, 2025
a678ba4
fix lighting issues
yohjimane Oct 7, 2025
20eab40
Fix making motions when unnecessary
yohjimane Oct 7, 2025
6255312
update animation viewer to see embedded anims
yohjimane Oct 7, 2025
ed9591c
Refactoring OzzKinematics -> OzzKinematicsCore, OzzKinematics, OzzKin…
yohjimane Oct 7, 2025
8c6b554
Refactoring OzzKinematics -> OzzKinematicsCore, OzzKinematics, OzzKin…
yohjimane Oct 7, 2025
02a6a26
fix bug1
yohjimane Oct 7, 2025
30848d6
Enable smart_cast on debug build
yohjimane Oct 7, 2025
353fc93
Fix comparator crash in r__dsgraph_render
yohjimane Oct 8, 2025
d88ba2d
Fix iterator crash in ui_focus.cpp
yohjimane Oct 8, 2025
9f0ef37
Remove OzzAnimationController, refactor related logic
yohjimane Oct 8, 2025
bbd02d1
Fix use after free memory issues
yohjimane Oct 8, 2025
e8706be
Some cleanup
yohjimane Oct 8, 2025
f8293f1
Revert "Enable smart_cast on debug build"
yohjimane Oct 8, 2025
bbea277
Fix engine build and casting issues
yohjimane Oct 8, 2025
a4f8cc2
HUGE refactor because ozz stuff is composition, not inheritance
yohjimane Oct 8, 2025
ba336d1
missed some Visual() dcast conversions
yohjimane Oct 8, 2025
67674d5
Refactor plan
yohjimane Oct 8, 2025
3c83aee
Refactor plan pt2
yohjimane Oct 8, 2025
4f9dce4
Implement Ozz Motion Container + fix some missed Visual dcasts
yohjimane Oct 9, 2025
8413dab
Fix embedded animations not being loaded
yohjimane Oct 9, 2025
b8bf35f
Fixing some issues pt1
yohjimane Oct 9, 2025
2a8580e
Cleanup comments and debug logs
yohjimane Oct 9, 2025
1ff9772
Fix crashes due to missing Visual dcast_pkinematics/animated
yohjimane Oct 9, 2025
2de0fc0
Reenable full asset conversion on initial launch
yohjimane Oct 9, 2025
71fb1fb
fix player hud crash
yohjimane Oct 9, 2025
d4d16eb
Parallel ogf->ozzx conversion
yohjimane Oct 9, 2025
3f74321
Parallel per-anim omf conversion
yohjimane Oct 9, 2025
8dce13a
add performance logging
yohjimane Oct 9, 2025
d3f5131
Introduce ECS/ENTT to OzzKinematicsAnimated
yohjimane Oct 9, 2025
75f3d25
tmp
yohjimane Oct 9, 2025
f7dc886
fix vs2022 release master gold build
yohjimane Oct 9, 2025
e1b118f
Begin porting xray_animation_viewer utilities to imgui ingame, fix ho…
yohjimane Oct 9, 2025
341ba76
Add ozz animation updates
yohjimane Oct 9, 2025
7a4748c
Fix ik arm slightly
yohjimane Oct 9, 2025
02e1ef7
ECS IK integration pt1
yohjimane Oct 10, 2025
12b9dc4
ECS IK integration pt2
yohjimane Oct 10, 2025
05c391b
Finishing hooking up ECS to ozz_animation_viewer; add multi instance …
yohjimane Oct 10, 2025
54b70bd
Lightweight vulkan implementation for ozz_animation_viewer
yohjimane Oct 10, 2025
290a5c0
Camera controller, skeleton shaders, draw triangle
yohjimane Oct 10, 2025
cf29159
fix capitalization of include
yohjimane Oct 10, 2025
2591bae
Triangle render works
yohjimane Oct 10, 2025
ebeabb9
Rendering skeleton
yohjimane Oct 10, 2025
6bf7416
Imgui launches
yohjimane Oct 10, 2025
7df1261
Fix Vulkan palette indexing and converter filesystem setup
yohjimane Oct 10, 2025
06fd298
Animations work for some meshes, add animation ui to imgui
yohjimane Oct 10, 2025
ce133a1
Add renderer files
yohjimane Oct 10, 2025
4c0a1fb
Fix full build on linux
yohjimane Oct 10, 2025
95bd0db
Fix palette merge for multi-mesh ozzx bundles
yohjimane Oct 10, 2025
38dcc60
Progress on animations, bone debugging
yohjimane Oct 10, 2025
975e92f
Almost fixed everything...
yohjimane Oct 10, 2025
fb5bfa8
debugging depth issues
yohjimane Oct 11, 2025
45d2c7f
Add shaded bone shaders
yohjimane Oct 11, 2025
0f422df
Fix scripts
yohjimane Oct 12, 2025
6326630
???
yohjimane Oct 12, 2025
5b56947
Vulkan renderer works on windows vs2022 build now
yohjimane Oct 12, 2025
505d8a7
Vulkan modernization
yohjimane Oct 12, 2025
114284c
Fix depth bug
yohjimane Oct 13, 2025
eb0d4f0
Integrate ECS back again
yohjimane Oct 13, 2025
bc9ed50
ECS pt2
yohjimane Oct 13, 2025
6661b5b
Fair test case for ecs vs non-ecs
yohjimane Oct 13, 2025
73e2fba
Fix linux build
yohjimane Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

# Omit scripts to avoid messing up line endings
*.sh text eol=lf
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@

# exclude doxygen output
doc/doxygen/html/*

# exclude ozz_utils folder
ozz_utils/*
src/intermediate/*
intermediate/*
src/xrAnimation/tests/testdata/*
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@
[submodule "Externals/sse2rvv"]
path = Externals/sse2rvv
url = https://github.com/pattonkan/sse2rvv.git
[submodule "Externals/ozz-animation"]
path = Externals/ozz-animation
url = https://github.com/guillaumeblanc/ozz-animation.git
[submodule "Externals/entt"]
path = Externals/entt
url = https://github.com/skypjack/entt.git
[submodule "Externals/glfw"]
path = Externals/glfw
url = https://github.com/glfw/glfw.git
37 changes: 37 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# AGENTS.md – Assistant Quick Guide

## Mission Snapshot
- Modernise OpenXRay's animation runtime by integrating ozz-animation while keeping legacy behaviour intact.
- xrAnimation module owns the façade around `OzzKinematics`, converter tools, parity tests, and the in-engine `.ozzx` visual.
- Converter CLI already produces `.ozz/.ozzx` assets from legacy `.ogf/.omf`; viewer tooling validates bind pose and animation parity.
- Minimum Viable Product is shipped: the runtime façade, converter, and bundle visual now mirror legacy behaviour for the shipped fixtures.

## Active Priorities
1. Harden the MVP: keep regression suites green, extend automation around `.ozzx` bundle loading, and react quickly to edge cases raised in gameplay smoke tests.
2. Capture and publish lightweight telemetry comparing legacy vs. Ozz frame costs; feed the numbers back into docs and tuning guidelines.
3. Shape the next phase (threading, GPU skinning, richer metadata) by collecting follow-up requirements and documenting the proposed roadmap.

## Workflow Expectations
- Read existing memory (docs, notes) before running commands or changing files.
- Prefer Debug/Mixed builds for iteration; use engine containers (`xr_vector`, `shared_str`, etc.) and `Msg()` for logging.
- After every code or doc change: rebuild the affected targets and rerun their tests without waiting for a prompt.
- Keep responses concise, factual, and professional; update documentation immediately when behaviour changes.

## Build & Test Quickstart
- Configure (if needed): `cmake -S xray-16 -B ozz_utils -DCMAKE_BUILD_TYPE=Debug`
- Build animation targets: `cmake --build ozz_utils --target ozz_kinematics_tests xrAnimation_converter_tests -j`
- Run suites: `ctest --test-dir ozz_utils --output-on-failure`
- Focused test loop: `ozz_utils/bin/Debug/ozz_kinematics_tests --gtest_filter=OzzKinematicsParity.*`

## Handy Tools & Scripts
- `convert_assets.sh` (repo root) -> regenerates sample `.ozz` skeletons/animations.
- `xray_to_ozz_converter` CLI handles skeleton/animation/batch conversion.
- `ozz_animation_viewer` (Debug build) can dump bind poses, JSON animation samples, and headless previews for parity checks.
- Blender snippets in `AGENT_COMMANDS.md` extract rest-pose matrices for cross-validation when needed.

## Where To Look Next
- Detailed guidance: `src/xrAnimation/AGENT_DOCS.md`
- Command recipes: `src/xrAnimation/AGENT_COMMANDS.md`
- Roadmap & priorities: `src/xrAnimation/AGENT_NEXT_STEPS.md`
- Historical context: `src/xrAnimation/CLAUDE.md`

12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ project(OpenXRay
HOMEPAGE_URL "https://github.com/OpenXRay/xray-16"
LANGUAGES CXX C
)
include(CTest)

option(BUILD_SHARED_LIBS "Build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT_VALUE})

Expand All @@ -21,7 +22,18 @@ option(XRAY_ENABLE_TRACY "Enable tracy profiler" OFF)
include(XRay.Build)
include(XRay.Packaging)

add_compile_definitions(
$<$<CONFIG:ReleaseMasterGold>:MASTER_GOLD>
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:XRAY_STATIC_BUILD>
)

add_subdirectory(Externals)
if(BUILD_TESTING)
get_property(_ozz_tests DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
foreach(_test IN LISTS _ozz_tests)
set_tests_properties(${_test} PROPERTIES DISABLED TRUE)
endforeach()
endif()
add_subdirectory(src)
add_subdirectory(res)
add_subdirectory(misc)
22 changes: 22 additions & 0 deletions Externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,34 @@ add_subdirectory(xrLuaFix)
add_subdirectory(OPCODE)
add_subdirectory(ode)

if (WIN32)
add_subdirectory(DiscordGameSDK)
endif()

# Silence all warnings for external libraries
add_compile_options(${XRAY_DISABLE_WARNINGS})

add_subdirectory(GameSpy)
add_subdirectory(imgui-proj)

if(MSVC AND CMAKE_GENERATOR MATCHES "Visual Studio")
set(ozz_build_samples OFF CACHE BOOL "Build ozz sample executables" FORCE)
set(ozz_build_howtos OFF CACHE BOOL "Build ozz howtos" FORCE)
set(ozz_build_tests OFF CACHE BOOL "Build ozz unit tests" FORCE)
endif()

add_subdirectory(ozz-animation)

# GLFW - Window and input library for Vulkan/OpenGL
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "Build GLFW example programs" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "Build GLFW test programs" FORCE)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "Build GLFW documentation" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "Generate GLFW installation target" FORCE)
add_subdirectory(glfw)

# EnTT - Entity Component System library (header-only)
add_subdirectory(entt)

if (NOT TARGET xrLuabind)
message(FATAL_ERROR
"You probably have downloaded OpenXRay sources as ZIP archive, you can't do that. Use git to clone the repository.\n"
Expand Down
27 changes: 27 additions & 0 deletions Externals/DiscordGameSDK/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
add_library(DiscordGameSDK STATIC
activity_manager.cpp
core.cpp
overlay_manager.cpp
relationship_manager.cpp
types.cpp
user_manager.cpp
)

target_include_directories(DiscordGameSDK
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
)

if (WIN32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_discord_sdk_lib "${CMAKE_SOURCE_DIR}/sdk/libraries/x64/discord_game_sdk.dll.lib")
else()
set(_discord_sdk_lib "${CMAKE_SOURCE_DIR}/sdk/libraries/x86/discord_game_sdk.dll.lib")
endif()

target_link_libraries(DiscordGameSDK PUBLIC "${_discord_sdk_lib}")
endif()

set_target_properties(DiscordGameSDK PROPERTIES
PREFIX ""
)
150 changes: 121 additions & 29 deletions Externals/LuaJIT-proj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,32 @@ if (APPLE)
endif()

# Clean unnecessary files in LuaJIT source directory
execute_process(
COMMAND make clean
WORKING_DIRECTORY ${LUAJIT_DIR}
)
if (NOT MSVC)
execute_process(
COMMAND make clean
WORKING_DIRECTORY ${LUAJIT_DIR}
)
endif()

add_library(xrLuaJIT)

# Compiler options
set(CCOPT_OPT_LEVEL "-O3")
if (MSVC)
set(CCOPT_OPT_LEVEL "/O2")
set(CCOPT "${CMAKE_C_FLAGS} ${CCOPT_OPT_LEVEL}")
else()
set(CCOPT_OPT_LEVEL "-O3")
set(CCOPT "${CMAKE_C_FLAGS} ${CCOPT_OPT_LEVEL}")

set(CCOPT "${CMAKE_C_FLAGS} ${CCOPT_OPT_LEVEL}")
if (XRAY_USE_ASAN)
set(CCOPT "${CCOPT} -fno-stack-protector")
else()
set(CCOPT "${CCOPT} -fomit-frame-pointer -fno-stack-protector")
endif()

if (XRAY_USE_ASAN)
set(CCOPT "${CCOPT} -fno-stack-protector")
else()
set(CCOPT "${CCOPT} -fomit-frame-pointer -fno-stack-protector")
set(CCOPT "${CCOPT} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE")
endif()

set(CCOPT "${CCOPT} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE")

string(REPLACE " " ";" CCOPT "${CCOPT}")

add_compile_options(
Expand Down Expand Up @@ -137,15 +143,59 @@ set(CCOPTIONS "${CCOPT};${XCFLAGS}")

target_compile_options(xrLuaJIT PRIVATE ${CCOPTIONS})

execute_process(
COMMAND ${CMAKE_C_COMPILER} ${CCOPTIONS} -E lj_arch.h -dM
WORKING_DIRECTORY "${LUAJIT_DIR}"
OUTPUT_VARIABLE TESTARCH_OUTPUT
ERROR_VARIABLE TESTARCH_ERROR
)
if (MSVC)
set(_luajit_detect_src "${CMAKE_CURRENT_BINARY_DIR}/luajit_detect_arch.c")

file(WRITE "${_luajit_detect_src}" "#include <stdio.h>\n#include \"lj_arch.h\"\nint main(void) {\n#ifdef LJ_TARGET_X64\n printf(\"LJ_TARGET_X64 %d\\n\", LJ_TARGET_X64);\n#endif\n#ifdef LJ_TARGET_X86\n printf(\"LJ_TARGET_X86 %d\\n\", LJ_TARGET_X86);\n#endif\n#ifdef LJ_TARGET_ARM64\n printf(\"LJ_TARGET_ARM64 %d\\n\", LJ_TARGET_ARM64);\n#endif\n#ifdef LJ_TARGET_ARM\n printf(\"LJ_TARGET_ARM %d\\n\", LJ_TARGET_ARM);\n#endif\n#ifdef LJ_TARGET_PPC\n printf(\"LJ_TARGET_PPC %d\\n\", LJ_TARGET_PPC);\n#endif\n#ifdef LJ_TARGET_MIPS\n printf(\"LJ_TARGET_MIPS %d\\n\", LJ_TARGET_MIPS);\n#endif\n#ifdef LJ_TARGET_MIPS64\n printf(\"LJ_TARGET_MIPS64 %d\\n\", LJ_TARGET_MIPS64);\n#endif\n#ifdef LJ_TARGET_E2K\n printf(\"LJ_TARGET_E2K %d\\n\", LJ_TARGET_E2K);\n#endif\n#ifdef LJ_TARGET_MIPSR6\n printf(\"LJ_TARGET_MIPSR6 %d\\n\", LJ_TARGET_MIPSR6);\n#endif\n#ifdef __MIPSEL__\n printf(\"__MIPSEL__ 1\\n\");\n#endif\n#ifdef __AARCH64EB__\n printf(\"__AARCH64EB__ 1\\n\");\n#endif\n#ifdef LJ_LE\n printf(\"LJ_LE %d\\n\", LJ_LE);\n#endif\n#ifdef LJ_ARCH_BITS\n printf(\"LJ_ARCH_BITS %d\\n\", LJ_ARCH_BITS);\n#endif\n#ifdef LJ_HASJIT\n printf(\"LJ_HASJIT %d\\n\", LJ_HASJIT);\n#endif\n#ifdef LJ_HASFFI\n printf(\"LJ_HASFFI %d\\n\", LJ_HASFFI);\n#endif\n#ifdef LJ_DUALNUM\n printf(\"LJ_DUALNUM %d\\n\", LJ_DUALNUM);\n#endif\n#ifdef LJ_ARCH_HASFPU\n printf(\"LJ_ARCH_HASFPU %d\\n\", LJ_ARCH_HASFPU);\n#endif\n#ifdef LJ_ABI_SOFTFP\n printf(\"LJ_ABI_SOFTFP %d\\n\", LJ_ABI_SOFTFP);\n#endif\n#ifdef LJ_NO_UNWIND\n printf(\"LJ_NO_UNWIND %d\\n\", LJ_NO_UNWIND);\n#endif\n#ifdef LJ_ARCH_VERSION\n printf(\"LJ_ARCH_VERSION %d\\n\", LJ_ARCH_VERSION);\n#endif\n#ifdef LJ_ARCH_SQRT\n printf(\"LJ_ARCH_SQRT %d\\n\", LJ_ARCH_SQRT);\n#endif\n#ifdef LJ_ARCH_ROUND\n printf(\"LJ_ARCH_ROUND %d\\n\", LJ_ARCH_ROUND);\n#endif\n#ifdef LJ_ARCH_PPC32ON64\n printf(\"LJ_ARCH_PPC32ON64 %d\\n\", LJ_ARCH_PPC32ON64);\n#endif\n#ifdef LJ_FR2\n printf(\"LJ_FR2 %d\\n\", LJ_FR2);\n#endif\n return 0;\n}\n")

set(_saved_try_compile_config ${CMAKE_TRY_COMPILE_CONFIGURATION})
if (CMAKE_CONFIGURATION_TYPES)
set(CMAKE_TRY_COMPILE_CONFIGURATION Release)
endif()

try_run(_luajit_arch_run _luajit_arch_compile
"${CMAKE_CURRENT_BINARY_DIR}/luajit_detect"
"${_luajit_detect_src}"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LUAJIT_DIR}"
RUN_OUTPUT_VARIABLE TESTARCH_OUTPUT
COMPILE_OUTPUT_VARIABLE TESTARCH_COMPILE_OUTPUT
)

if (CMAKE_CONFIGURATION_TYPES)
set(CMAKE_TRY_COMPILE_CONFIGURATION ${_saved_try_compile_config})
endif()

if (NOT _luajit_arch_compile OR NOT _luajit_arch_run EQUAL 0)
message(FATAL_ERROR "Failed to detect LuaJIT architecture with MSVC.\n${TESTARCH_COMPILE_OUTPUT}")
endif()

unset(_luajit_detect_src)
unset(_luajit_arch_run)
unset(_luajit_arch_compile)
unset(_saved_try_compile_config)
else()
set(_LUAJIT_TESTARCH_COMMAND ${CMAKE_C_COMPILER})

list(APPEND _LUAJIT_TESTARCH_COMMAND ${CCOPTIONS})

foreach(_dir ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES})
list(APPEND _LUAJIT_TESTARCH_COMMAND "-I${_dir}")
endforeach()

if(NOT "${TESTARCH_ERROR}" STREQUAL "")
message("TESTARCH_ERROR=${TESTARCH_ERROR}")
list(APPEND _LUAJIT_TESTARCH_COMMAND -E lj_arch.h -dM)

execute_process(
COMMAND ${_LUAJIT_TESTARCH_COMMAND}
WORKING_DIRECTORY "${LUAJIT_DIR}"
OUTPUT_VARIABLE TESTARCH_OUTPUT
ERROR_VARIABLE TESTARCH_ERROR
)

unset(_LUAJIT_TESTARCH_COMMAND)

if(NOT "${TESTARCH_ERROR}" STREQUAL "")
message("TESTARCH_ERROR=${TESTARCH_ERROR}")
endif()
endif()

if ("${TESTARCH_OUTPUT}" MATCHES "LJ_TARGET_X64")
Expand Down Expand Up @@ -187,10 +237,16 @@ string(APPEND TARGET_ARCH "-DLUAJIT_TARGET=LUAJIT_ARCH_${TARGET_LJARCH}")
if (WIN32)
#string(APPEND TARGET_STRIP "--strip-unneeded")

target_link_options(xrLuaJIT
PRIVATE
" -shared -Wl,--out-implib,libluajit-${ABIVER}.dll.a"
)
if (NOT MSVC)
target_link_options(xrLuaJIT
PRIVATE
" -shared -Wl,--out-implib,libluajit-${ABIVER}.dll.a"
)
endif()

# Export the public API symbols when building the DLL so MSVC generates
# an import library (xrLuaJIT.lib).
target_compile_definitions(xrLuaJIT PRIVATE LUA_BUILD_AS_DLL)

if (LUAJIT_BUILD_STATIC_LIB)
string(APPEND HOST_XCFLAGS " -DLUA_BUILD_AS_DLL")
Expand Down Expand Up @@ -308,6 +364,11 @@ endif()

set(HOST_ACFLAGS "${CMAKE_C_FLAGS} ${CCOPTIONS} ${TARGET_ARCH}")
set(HOST_ALDFLAGS "${CMAKE_C_FLAGS}")
if (MSVC)
string(REPLACE "/DWIN32" "" HOST_ALDFLAGS "${HOST_ALDFLAGS}")
string(REPLACE "/D_WINDOWS" "" HOST_ALDFLAGS "${HOST_ALDFLAGS}")
string(REPLACE " " " " HOST_ALDFLAGS "${HOST_ALDFLAGS}")
endif()

string(APPEND TARGET_XCFLAGS " -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE")

Expand All @@ -325,9 +386,33 @@ set(DASM_DASC "${LUAJIT_DIR}/vm_${DASM_ARCH}.dasc")
set(DASM "${LUAJIT_DIR}/../dynasm/dynasm.lua")
set(BUILDVM_ARCH "${CMAKE_CURRENT_BINARY_DIR}/buildvm_arch.h")

set(_luajit_host_build_config Release)
get_property(_luajit_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (_luajit_is_multi)
set(_luajit_host_cfg_subdir "${_luajit_host_build_config}")
else()
set(_luajit_host_cfg_subdir "")
endif()

if (_luajit_host_cfg_subdir)
set(_luajit_host_cfg_path "/${_luajit_host_cfg_subdir}")
else()
set(_luajit_host_cfg_path "")
endif()

set(_luajit_build_config_args)
if (_luajit_is_multi)
list(APPEND _luajit_build_config_args --config ${_luajit_host_build_config})
endif()

# Generate buildvm arch header
set(MINILUA_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/HostBuildTools/minilua")
set(MINILUA_FILE "${MINILUA_BINARY_DIR}/minilua")
set(MINILUA_BUILD_OUTPUT "${MINILUA_BINARY_DIR}${_luajit_host_cfg_path}/minilua${CMAKE_EXECUTABLE_SUFFIX}")
set(MINILUA_FILE "${MINILUA_BINARY_DIR}/minilua${CMAKE_EXECUTABLE_SUFFIX}")
set(_luajit_copy_minilua_command "")
if (NOT MINILUA_BUILD_OUTPUT STREQUAL MINILUA_FILE)
set(_luajit_copy_minilua_command COMMAND ${CMAKE_COMMAND} -E copy_if_different "${MINILUA_BUILD_OUTPUT}" "${MINILUA_FILE}")
endif()

add_custom_command(
OUTPUT "${MINILUA_FILE}"
Expand All @@ -342,7 +427,8 @@ add_custom_command(
-DLUA_USE_POSIX=${LUA_USE_POSIX}
-DHOST_ACFLAGS="${HOST_ACFLAGS}"
-DHOST_ALDFLAGS="${HOST_ALDFLAGS}"
COMMAND ${CMAKE_COMMAND} --build ${MINILUA_BINARY_DIR} --config Release --verbose
COMMAND ${CMAKE_COMMAND} --build ${MINILUA_BINARY_DIR} ${_luajit_build_config_args} --verbose
${_luajit_copy_minilua_command}
)

add_custom_command(OUTPUT ${BUILDVM_ARCH}
Expand All @@ -360,7 +446,12 @@ set_target_properties(buildvm_arch PROPERTIES

# Buildvm
set(BUILDVM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/HostBuildTools/buildvm")
set(BUILDVM_FILE "${BUILDVM_BINARY_DIR}/buildvm")
set(BUILDVM_BUILD_OUTPUT "${BUILDVM_BINARY_DIR}${_luajit_host_cfg_path}/buildvm${CMAKE_EXECUTABLE_SUFFIX}")
set(BUILDVM_FILE "${BUILDVM_BINARY_DIR}/buildvm${CMAKE_EXECUTABLE_SUFFIX}")
set(_luajit_copy_buildvm_command "")
if (NOT BUILDVM_BUILD_OUTPUT STREQUAL BUILDVM_FILE)
set(_luajit_copy_buildvm_command COMMAND ${CMAKE_COMMAND} -E copy_if_different "${BUILDVM_BUILD_OUTPUT}" "${BUILDVM_FILE}")
endif()

add_custom_command(
OUTPUT "${BUILDVM_FILE}"
Expand All @@ -374,7 +465,8 @@ add_custom_command(
-DBUILDVM_ARCH=${BUILDVM_ARCH}
-DHOST_ACFLAGS="${HOST_ACFLAGS}"
-DHOST_ALDFLAGS="${HOST_ALDFLAGS}"
COMMAND ${CMAKE_COMMAND} --build ${BUILDVM_BINARY_DIR} --config Release --verbose
COMMAND ${CMAKE_COMMAND} --build ${BUILDVM_BINARY_DIR} ${_luajit_build_config_args} --verbose
${_luajit_copy_buildvm_command}
)

add_custom_target(buildvm
Expand Down Expand Up @@ -576,7 +668,7 @@ target_link_libraries(xrLuaJIT

target_compile_options(xrLuaJIT
PRIVATE
-Wno-comment
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-comment>
)

set_target_properties(xrLuaJIT PROPERTIES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ target_include_directories(buildvm
target_compile_options(buildvm
PRIVATE
${HOST_ACFLAGS}
-Wno-discarded-qualifiers
$<$<NOT:$<C_COMPILER_ID:MSVC>>:-Wno-discarded-qualifiers>
)

target_link_options(buildvm
Expand Down
2 changes: 1 addition & 1 deletion Externals/LuaJIT-proj/LuaJIT.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)intermediate\$(PlatformShortName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>LUA_BUILD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">LUAJIT_ENABLE_GC64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">LUAJIT_ENABLE_GC64;LUA_USE_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
Expand Down
Loading
Loading