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
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/codegen
CMAKE_CACHE_ARGS "-DCMAKE_INSTALL_PREFIX:STRING=${GEODE_CODEGEN_BINARY_OUT}"
CMAKE_ARGS ${GEODE_CODEGEN_CMAKE_ARGS}
)
add_custom_command(

View file

@ -132,9 +132,18 @@ function(package_geode_resources_now proname src dest header_dest)
if (GEODE_DISABLE_CLI_CALLS)
message(WARNING
"package_geode_resources_now called, but GEODE_DISABLE_CLI_CALLS
is set to true - Ignoring it as this function requires CLI calls
in order to work"
is set to true - Faking output result in case you only wish to
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()
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,7 +139,8 @@ add_subdirectory(lilac)
target_link_libraries(${PROJECT_NAME} md4c z lilac_hook geode-sdk re2)
# Use precompiled headers for faster builds
target_precompile_headers(${PROJECT_NAME} PRIVATE
if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS)
target_precompile_headers(${PROJECT_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/DefaultInclude.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Loader.hpp"
@ -148,7 +149,8 @@ target_precompile_headers(${PROJECT_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Modify.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/include/cocos2d.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/extensions/cocos-ext.h"
)
)
endif()
# Create launcher
if (APPLE)

View file

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

View file

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

View file

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