add stuff for docs genning and fix issues for it

This commit is contained in:
HJfod 2022-12-31 00:50:12 +02:00
parent b87883903c
commit 486f5ab751
8 changed files with 115 additions and 45 deletions

View file

@ -52,6 +52,7 @@ set(GEODE_CODEGEN_BINARY_OUT ${CMAKE_CURRENT_BINARY_DIR}/codegen)
ExternalProject_Add(CodegenProject ExternalProject_Add(CodegenProject
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/codegen SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/codegen
CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${GEODE_CODEGEN_BINARY_OUT}" CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${GEODE_CODEGEN_BINARY_OUT}"
CMAKE_ARGS ${GEODE_CODEGEN_CMAKE_ARGS}
) )
add_custom_command( add_custom_command(

View file

@ -132,9 +132,18 @@ function(package_geode_resources_now proname src dest header_dest)
if (GEODE_DISABLE_CLI_CALLS) if (GEODE_DISABLE_CLI_CALLS)
message(WARNING message(WARNING
"package_geode_resources_now called, but GEODE_DISABLE_CLI_CALLS "package_geode_resources_now called, but GEODE_DISABLE_CLI_CALLS
is set to true - Ignoring it as this function requires CLI calls is set to true - Faking output result in case you only wish to
in order to work" analyze the project statically, do not expect built project to
function properly"
) )
set(HEADER_FILE
"#include <unordered_map>\n\n"
"static const std::unordered_map<std::string, std::string> "
"LOADER_RESOURCE_HASHES {};\n"
)
file(WRITE ${header_dest} ${HEADER_FILE})
message(STATUS "Wrote fake resource hashes to ${header_dest}")
return()
endif() endif()
if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND") if(GEODE_CLI STREQUAL "GEODE_CLI-NOTFOUND")

55
flash.toml Normal file
View file

@ -0,0 +1,55 @@
# Configuration file for the Flash C++ documentation generator.
# https://github.com/hjfod/flash
[project]
name = "Geode"
version = "v1.0.0-beta"
repository = "https://github.com/geode-sdk/geode"
[docs]
include = [
"loader/include/Geode/**/*.hpp",
"loader/include/Geode/**/*.h",
"build/codegenned/Geode/binding/*.hpp"
]
exclude = [
"loader/include/Geode/modify/Comparer.hpp",
"loader/include/Geode/platform/*.hpp",
"loader/include/Geode/c++stl/*.hpp",
# All of the relevant cocos headers are included through Geode headers
"loader/include/Geode/cocos/**/*.h"
]
tree = "https://github.com/geode-sdk/geode/tree/main"
# Root folders to show in the navigation browser
[[browser.roots]]
path = "loader/include/Geode"
include-prefix = "Geode"
name = "Geode"
[[browser.roots]]
path = "build/codegenned/Geode/binding"
include-prefix = "Geode/binding"
name = "Bindings"
[cmake]
config-args = [
"-G", "Ninja",
"-DCMAKE_CXX_COMPILER=Clang",
"-DCMAKE_C_COMPILER=Clang",
"-DGEODE_DISABLE_CLI_CALLS=On",
"-DGEODE_PLATFORM_NAME=Win32",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=On",
"-DGEODE_DISABLE_PRECOMPILED_HEADERS=On",
"-DGEODE_CODEGEN_CMAKE_ARGS=-DCMAKE_CXX_COMPILER=Clang;-DCMAKE_C_COMPILER=Clang",
"-DCMAKE_C_FLAGS=-m32",
"-DCMAKE_CXX_FLAGS=-m32",
"-DWIN32=On"
]
build = true
build-args = [
"--target", "CodegenRun"
]
infer-args-from = "loader/src/main.cpp"

View file

@ -139,16 +139,18 @@ add_subdirectory(lilac)
target_link_libraries(${PROJECT_NAME} md4c z lilac_hook geode-sdk re2) target_link_libraries(${PROJECT_NAME} md4c z lilac_hook geode-sdk re2)
# Use precompiled headers for faster builds # Use precompiled headers for faster builds
target_precompile_headers(${PROJECT_NAME} PRIVATE if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/DefaultInclude.hpp" target_precompile_headers(${PROJECT_NAME} PRIVATE
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Utils.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/DefaultInclude.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Loader.hpp" # "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/UI.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Loader.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Bindings.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/UI.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Modify.hpp" # "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Bindings.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/include/cocos2d.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Modify.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/extensions/cocos-ext.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/include/cocos2d.h"
) "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/extensions/cocos-ext.h"
)
endif()
# Create launcher # Create launcher
if (APPLE) if (APPLE)

View file

@ -285,7 +285,7 @@ enum {
# endif # endif
#endif #endif
#include <../pthread/sched.h> #include "sched.h"
/* /*
* To avoid including windows.h we define only those things that we * To avoid including windows.h we define only those things that we

View file

@ -9,40 +9,42 @@
namespace geode { namespace geode {
// Mod interoperability // Mod interoperability
template <typename... Args> // todo: update to new event system
class DispatchEvent : public Event {
std::string m_selector;
std::tuple<Args...> m_args;
public: // template <typename... Args>
DispatchEvent(std::string const& name, Args... args) : // class DispatchEvent : public Event {
m_selector(name), m_args(std::make_tuple(args...)) {} // std::string m_selector;
// std::tuple<Args...> m_args;
std::string const& selector() { // public:
return m_selector; // DispatchEvent(std::string const& name, Args... args) :
} // m_selector(name), m_args(std::make_tuple(args...)) {}
};
template <typename... Args> // std::string const& selector() {
class DispatchHandler : public EventHandler<DispatchEvent<Args...>> { // return m_selector;
std::string m_selector; // }
std::function<void(Args...)> m_callback; // };
DispatchHandler(std::string const& name, std::function<void(Args...)> callback) : // template <typename... Args>
m_selector(name), m_callback(callback) {} // class DispatchHandler : public EventHandler<DispatchEvent<Args...>> {
// std::string m_selector;
// std::function<void(Args...)> m_callback;
public: // DispatchHandler(std::string const& name, std::function<void(Args...)> callback) :
bool handle(DispatchEvent<Args...>* ev) { // m_selector(name), m_callback(callback) {}
if (ev->name() == m_selector) {
std::apply(m_callback, ev->m_args);
}
return true;
}
static DispatchHandler* create( // public:
std::string const& name, std::function<void(Args...)> callback // bool handle(DispatchEvent<Args...>* ev) {
) { // if (ev->name() == m_selector) {
return new DispatchHandler(name, callback); // std::apply(m_callback, ev->m_args);
} // }
}; // return true;
// }
// static DispatchHandler* create(
// std::string const& name, std::function<void(Args...)> callback
// ) {
// return new DispatchHandler(name, callback);
// }
// };
} }

View file

@ -4,6 +4,7 @@
#include "../external/json/json.hpp" #include "../external/json/json.hpp"
#include "../utils/VersionInfo.hpp" #include "../utils/VersionInfo.hpp"
#include "../utils/Result.hpp" #include "../utils/Result.hpp"
#include "Setting.hpp"
namespace geode { namespace geode {
namespace utils::file { namespace utils::file {

View file

@ -199,10 +199,10 @@ namespace geode::core::meta::x86 {
using Sequences = typename Membercall<Ret*, Class, Ret*, Args...>::Sequences; using Sequences = typename Membercall<Ret*, Class, Ret*, Args...>::Sequences;
// Where all the logic is actually implemented. // Where all the logic is actually implemented.
template <class Class, class> template <class ImplClass, class>
class Impl { class Impl {
static_assert( static_assert(
always_false<Class>, always_false<ImplClass>,
"Please report a bug to the Geode developers! This should never be reached.\n" "Please report a bug to the Geode developers! This should never be reached.\n"
"SFINAE didn't reach the right overload!" "SFINAE didn't reach the right overload!"
); );