mirror of
https://github.com/Nexoniarz/Fry3DX.git
synced 2026-11-03 04:24:26 +00:00
0.8.1: project.json holds the version, the links, who made it and what it's built on (CMake reads it into fry_project.h and Windows' file details, which had stayed at 0.5.0); the About box lists the creators, the Help menu the website, reporting a problem and the newest version. Steadier far out: the grid's line sizes go by each pixel (not the focus, which jumps between the ground and the sky as you fly, popping every set at once), the far plane doesn't follow that focus when flying, and a wheel notch is at most twice as far as the nearest thing; the site's 0.8.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b2fc0437bc
commit
ee56ed4005
13 changed files with 176 additions and 64 deletions
81
cmake/Project.cmake
Normal file
81
cmake/Project.cmake
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# project.json, read before project(): FRY_VERSION and the rest as FRY_<KEY>; fry_project_header()
|
||||
# writes them as C++ constants (fry_project.h) and Windows' file details (fry3dx.rc).
|
||||
set(FRY_PROJECT_JSON ${CMAKE_CURRENT_LIST_DIR}/../project.json)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${FRY_PROJECT_JSON})
|
||||
file(READ ${FRY_PROJECT_JSON} FRY_JSON)
|
||||
foreach(key name long version tagline description website repo issues releases license copyright company look)
|
||||
string(TOUPPER ${key} upper)
|
||||
string(JSON FRY_${upper} GET "${FRY_JSON}" ${key})
|
||||
endforeach()
|
||||
|
||||
# out: the header's path; rc: Windows' file details (the version as 0,8,1,0 too).
|
||||
function(fry_project_header out rc)
|
||||
set(h "// Made by CMake from project.json: change that, not this.\n#pragma once\n#include <span>\n\nnamespace fry::project {\n")
|
||||
foreach(key name long version tagline description website repo issues releases license copyright company look)
|
||||
string(TOUPPER ${key} upper)
|
||||
set(ident ${key})
|
||||
if(key STREQUAL "long")
|
||||
set(ident long_) # (a C++ word)
|
||||
endif()
|
||||
string(APPEND h "inline constexpr const char* ${ident} = R\"fry(${FRY_${upper}})fry\";\n")
|
||||
endforeach()
|
||||
string(APPEND h "\nstruct Creator {\n const char* name;\n const char* role;\n const char* url;\n};\ninline constexpr Creator kCreators[] = {\n")
|
||||
string(JSON n LENGTH "${FRY_JSON}" creators)
|
||||
math(EXPR last "${n} - 1")
|
||||
foreach(i RANGE ${last})
|
||||
string(JSON who GET "${FRY_JSON}" creators ${i} name)
|
||||
string(JSON role ERROR_VARIABLE none GET "${FRY_JSON}" creators ${i} role)
|
||||
string(JSON url ERROR_VARIABLE none GET "${FRY_JSON}" creators ${i} url)
|
||||
if(role MATCHES "NOTFOUND$")
|
||||
set(role "")
|
||||
endif()
|
||||
if(url MATCHES "NOTFOUND$")
|
||||
set(url "")
|
||||
endif()
|
||||
string(APPEND h " {R\"fry(${who})fry\", R\"fry(${role})fry\", R\"fry(${url})fry\"},\n")
|
||||
endforeach()
|
||||
string(APPEND h "};\ninline constexpr std::span<const Creator> creators{kCreators};\n\n// What it's built on (for the About box).\ninline constexpr const char* builtWith = R\"fry(")
|
||||
string(JSON n LENGTH "${FRY_JSON}" builtWith)
|
||||
math(EXPR last "${n} - 1")
|
||||
foreach(i RANGE ${last})
|
||||
string(JSON part GET "${FRY_JSON}" builtWith ${i})
|
||||
if(i GREATER 0)
|
||||
if(i EQUAL last)
|
||||
string(APPEND h " and ")
|
||||
else()
|
||||
string(APPEND h ", ")
|
||||
endif()
|
||||
endif()
|
||||
string(APPEND h "${part}")
|
||||
endforeach()
|
||||
string(APPEND h ")fry\";\n} // namespace fry::project\n")
|
||||
file(CONFIGURE OUTPUT ${out} CONTENT "${h}" @ONLY)
|
||||
|
||||
string(REPLACE "." "," commas "${FRY_VERSION}")
|
||||
file(CONFIGURE OUTPUT ${rc} CONTENT "// Made by CMake from project.json (Windows: the program's icon and details, Explorer's Properties).
|
||||
1 ICON \"${PROJECT_SOURCE_DIR}/branding/fry3dx.ico\"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${commas},0
|
||||
PRODUCTVERSION ${commas},0
|
||||
BEGIN
|
||||
BLOCK \"StringFileInfo\"
|
||||
BEGIN
|
||||
BLOCK \"040904b0\"
|
||||
BEGIN
|
||||
VALUE \"CompanyName\", \"${FRY_COMPANY}\"
|
||||
VALUE \"FileDescription\", \"${FRY_NAME} - ${FRY_LONG}\"
|
||||
VALUE \"FileVersion\", \"${FRY_VERSION}\"
|
||||
VALUE \"InternalName\", \"fry3dx\"
|
||||
VALUE \"LegalCopyright\", \"${FRY_COPYRIGHT}, ${FRY_LICENSE}\"
|
||||
VALUE \"OriginalFilename\", \"fry3dx.exe\"
|
||||
VALUE \"ProductName\", \"${FRY_NAME}\"
|
||||
VALUE \"ProductVersion\", \"${FRY_VERSION}\"
|
||||
END
|
||||
END
|
||||
BLOCK \"VarFileInfo\"
|
||||
BEGIN
|
||||
VALUE \"Translation\", 0x409, 1200
|
||||
END
|
||||
END
|
||||
" @ONLY)
|
||||
endfunction()
|
||||
Loading…
Reference in a new issue