Skip to content

Commit

Permalink
Merge branch 'feature/custom-main-functions'
Browse files Browse the repository at this point in the history
  • Loading branch information
muit committed Sep 2, 2023
2 parents 8451434 + 36eaf0a commit fdf8601
Show file tree
Hide file tree
Showing 104 changed files with 57 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
path = Extern/imgui
url = https://github.com/ocornut/imgui.git
[submodule "Libs/Pipe"]
path = Libs/Pipe
path = Extern/Pipe
url = https://github.com/PipeRift/pipe.git
[submodule "Extern/glfw"]
path = Extern/glfw
Expand Down
2 changes: 1 addition & 1 deletion Apps/CLI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_sources(RiftCLIExe PRIVATE ${CLI_SOURCE_FILES})

target_link_libraries(RiftCLIExe PUBLIC
CLI11
Rift
RiftAST
RiftCompilerModules
)

Expand Down
5 changes: 3 additions & 2 deletions Apps/CLI/Src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// Override as first include

#include <AST/Utils/ModuleUtils.h>
#include <ASTModule.h>
#include <Compiler/Compiler.h>
#include <Compiler/Utils/BackendUtils.h>
#include <FrameworkModule.h>
#include <GraphViewModule.h>
#include <LLVMBackendModule.h>
#include <MIRBackendModule.h>
Expand All @@ -19,6 +19,7 @@
#include <CLI/CLI.hpp>



using namespace rift;


Expand Down Expand Up @@ -65,7 +66,7 @@ namespace rift
int main(int argc, char** argv)
{
p::Initialize("Saved/Logs");
EnableModule<FrameworkModule>();
EnableModule<ASTModule>();
EnableModule<LLVMBackendModule>();
EnableModule<MIRBackendModule>();
EnableModule<GraphViewModule>();
Expand Down
5 changes: 3 additions & 2 deletions Apps/Editor/Src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <Pipe/Memory/NewDelete.h>
// Override as first include

#include <ASTModule.h>
#include <Editor.h>
#include <FrameworkModule.h>
#include <GraphViewModule.h>
#include <LLVMBackendModule.h>
#include <MIRBackendModule.h>
Expand All @@ -13,6 +13,7 @@
#include <iostream>



using namespace rift;


Expand All @@ -23,7 +24,7 @@ using namespace rift;
int RunEditor(StringView projectPath)
{
p::Initialize("Saved/Logs");
EnableModule<FrameworkModule>();
EnableModule<ASTModule>();
EnableModule<LLVMBackendModule>();
EnableModule<MIRBackendModule>();
EnableModule<GraphViewModule>();
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ option(RIFT_BUILD_TESTS "Build Rift and Core tests" ${RIFT_IS_PROJECT})

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CMake/DownloadProject.cmake)
include(Libs/Pipe/CMake/Util.cmake)
include(Extern/Pipe/CMake/Util.cmake)
include(CMake/Util.cmake)
include(CMake/SetIcon.cmake)
include(CMake/CheckClangTools.cmake)
Expand All @@ -56,7 +56,7 @@ if(CLANG_FORMAT_EXE)
# Additional targets to perform clang-format/clang-tidy
file(GLOB_RECURSE ALL_SOURCE_FILES CONFIGURE_DEPENDS
Apps/**/*.cpp Apps/**/*.h
Libs/Framework/**/*.cpp Libs/Framework/**/*.h
Libs/AST/**/*.cpp Libs/AST/**/*.h
Libs/UI/**/*.cpp Libs/UI/**/*.h
Libs/Pipe/Include/**/*.cpp Libs/Pipe/Include/**/*.h
Libs/Pipe/Src/**/*.cpp Libs/Pipe/Src/**/*.h
Expand All @@ -71,7 +71,7 @@ endif()
if(CLANG_TIDY_EXE)
file(GLOB_RECURSE ALL_SOURCE_FILES CONFIGURE_DEPENDS
Apps/**/*.cpp
Libs/Framework/**/*.cpp
Libs/AST/**/*.cpp
Libs/UI/**/*.cpp
Libs/Pipe/Include/**/*.cpp
Libs/Pipe/Src/**/*.cpp
Expand Down
5 changes: 5 additions & 0 deletions Extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ include(FetchContent)
set(BUILD_SHARED_LIBS OFF)

# Submodule libraries

set(PIPE_BUILD_TESTS ${RIFT_BUILD_TESTS} CACHE BOOL "Build Pipe tests")
add_subdirectory(Pipe)


set(CLI11_BUILD_TESTS OFF CACHE BOOL "Build CLI11 tests")
set(CMAKE_POLICY_DEFAULT_CMP0054 NEW)
add_subdirectory(CLI11)
Expand Down
Submodule Pipe updated from 000000 to 918e8b
16 changes: 16 additions & 0 deletions Libs/AST/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2015-2023 Piperift - All rights reserved

add_library(RiftAST STATIC)
target_include_directories(RiftAST PUBLIC Include)

file(GLOB_RECURSE AST_SOURCE_FILES CONFIGURE_DEPENDS Src/*.cpp Src/*.h)
target_sources(RiftAST PRIVATE ${AST_SOURCE_FILES})

target_link_libraries(RiftAST PUBLIC
Pipe
Taskflow
RiftBindingNative
)

rift_module(RiftAST)
set_target_properties (RiftAST PROPERTIES FOLDER Rift)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace rift
class Tree;
}

class FrameworkModule : public Module
class ASTModule : public Module
{
CLASS(FrameworkModule, Module)
CLASS(ASTModule, Module)

public:
static const p::Tag structType;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "AST/Utils/Namespaces.h"
#include "AST/Utils/Paths.h"
#include "AST/Utils/TransactionUtils.h"
#include "FrameworkModule.h"
#include "ASTModule.h"
#include "Rift.h"

#include <Pipe/Core/Checks.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2015-2023 Piperift - All rights reserved

#include "FrameworkModule.h"
#include "ASTModule.h"

#include "AST/Components/CDeclClass.h"
#include "AST/Components/CDeclStatic.h"
Expand All @@ -13,12 +13,12 @@

namespace rift
{
const p::Tag FrameworkModule::structType = "Struct";
const p::Tag FrameworkModule::classType = "Class";
const p::Tag FrameworkModule::staticType = "Static";
const p::Tag ASTModule::structType = "Struct";
const p::Tag ASTModule::classType = "Class";
const p::Tag ASTModule::staticType = "Static";


void FrameworkModule::Load()
void ASTModule::Load()
{
AST::RegisterFileType<AST::CDeclStruct>(
structType, {.displayName = "Struct", .hasVariables = true, .hasFunctions = false});
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Libs/Backends/LLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
add_library(RiftBackendLLVM STATIC)
rift_compiler_module(RiftBackendLLVM)

target_link_libraries(RiftBackendLLVM PUBLIC Rift)
target_link_libraries(RiftBackendLLVM PUBLIC RiftAST)
target_link_libraries(RiftBackendLLVM PRIVATE
RiftLLVM
RiftBindingNative
Expand Down
2 changes: 1 addition & 1 deletion Libs/Backends/MIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
add_library(RiftBackendMIR STATIC)
rift_compiler_module(RiftBackendMIR)

target_link_libraries(RiftBackendMIR PUBLIC Rift)
target_link_libraries(RiftBackendMIR PUBLIC RiftAST)
target_link_libraries(RiftBackendMIR PRIVATE
mir_static
RiftBindingNative
Expand Down
2 changes: 1 addition & 1 deletion Libs/Bindings/Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
add_library(RiftBindingNative STATIC)


target_link_libraries(RiftBindingNative PUBLIC Rift)
target_link_libraries(RiftBindingNative PUBLIC RiftAST)
target_link_libraries(RiftBindingNative PRIVATE RiftClang)

rift_compiler_module(RiftBindingNative)
Expand Down
5 changes: 1 addition & 4 deletions Libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Copyright 2015-2023 Piperift - All rights reserved

set(PIPE_BUILD_TESTS ${RIFT_BUILD_TESTS} CACHE BOOL "Build Pipe tests")
add_subdirectory(Pipe)

add_subdirectory(Framework)
add_subdirectory(AST)
add_subdirectory(Backends/LLVM)
add_subdirectory(Backends/MIR)
add_subdirectory(Bindings/Native)
Expand Down
2 changes: 1 addition & 1 deletion Libs/Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ file(GLOB_RECURSE RiftEditor_SOURCE_FILES CONFIGURE_DEPENDS Src/*.cpp Src/*.h)
target_sources(RiftEditor PRIVATE ${RiftEditor_SOURCE_FILES})

target_link_libraries(RiftEditor PUBLIC
Rift
RiftAST
RiftBackendLLVM
RiftBackendMIR
RiftUI
Expand Down
16 changes: 0 additions & 16 deletions Libs/Framework/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion Libs/Views/Graph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

add_library(RiftViewGraph STATIC)
rift_compiler_module(RiftViewGraph)
target_link_libraries(RiftViewGraph PUBLIC Rift)
target_link_libraries(RiftViewGraph PUBLIC RiftAST)

add_library(RiftViewGraphEditor STATIC)
rift_editor_module(RiftViewGraphEditor)
Expand Down
3 changes: 2 additions & 1 deletion Libs/Views/Graph/Compiler/Include/GraphViewModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

#pragma once

#include <ASTModule.h>
#include <Compiler/Backend.h>
#include <FrameworkModule.h>
#include <Module.h>
#include <Pipe/Core/EnumFlags.h>
#include <View.h>



namespace rift
{
class GraphViewModule : public Module
Expand Down
2 changes: 1 addition & 1 deletion Libs/Views/Graph/Compiler/Src/GraphViewModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace rift
{
RegisterView(View{
.name = "Graph",
.supportedTypes = {FrameworkModule::classType, FrameworkModule::structType},
.supportedTypes = {ASTModule::classType, ASTModule::structType},
.onDrawEditor = &GraphViewModule::DrawEditor
});
}
Expand Down
13 changes: 7 additions & 6 deletions Tests/AST/Namespaces.spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <AST/Tree.h>
#include <AST/Utils/Namespaces.h>
#include <AST/Utils/TypeUtils.h>
#include <ASTModule.h>
#include <bandit/assertion_frameworks/snowhouse/assert.h>
#include <bandit/bandit.h>
#include <FrameworkModule.h>



using namespace snowhouse;
Expand All @@ -25,7 +26,7 @@ go_bandit([]() {
AST::GetNamespace(ast, functionId).ToString().c_str(), Equals("@TestFunction"));
AssertThat(AST::GetParentNamespace(ast, functionId).ToString().c_str(), Equals(""));

AST::Id classBId = AST::CreateType(ast, FrameworkModule::classType, "TestClass");
AST::Id classBId = AST::CreateType(ast, ASTModule::classType, "TestClass");
AST::Id functionBId = AST::AddFunction({ast, classBId}, "TestFunction");
AssertThat(AST::GetNamespace(ast, functionBId).ToString().c_str(),
Equals("@TestClass.TestFunction"));
Expand All @@ -35,7 +36,7 @@ go_bandit([]() {
AST::Id parentC = ast.Create();
ast.Add<AST::CModule>(parentC);
ast.Add(parentC, AST::CNamespace{"SomeScope"});
AST::Id classCId = AST::CreateType(ast, FrameworkModule::classType, "TestClass");
AST::Id classCId = AST::CreateType(ast, ASTModule::classType, "TestClass");
p::Attach(ast, parentC, classCId);
AST::Id functionCId = AST::AddFunction({ast, classCId}, "TestFunction");
AssertThat(AST::GetNamespace(ast, functionCId).ToString().c_str(),
Expand All @@ -50,7 +51,7 @@ go_bandit([]() {
AST::Id parent = ast.Create();
ast.Add<AST::CModule>(parent);
ast.Add(parent, AST::CNamespace{"SomeModule"});
AST::Id classId = AST::CreateType(ast, FrameworkModule::classType, "TestClass");
AST::Id classId = AST::CreateType(ast, ASTModule::classType, "TestClass");
p::Attach(ast, parent, classId);
AST::Id functionId = AST::AddFunction({ast, classId}, "TestFunction");
p::String ns = AST::GetNamespace(ast, functionId).ToString(true);
Expand Down Expand Up @@ -105,10 +106,10 @@ go_bandit([]() {
ast.Add<AST::CModule>(parent);
ast.Add(parent, AST::CNamespace{"A"});

AST::Id classId = AST::CreateType(ast, FrameworkModule::classType, "B");
AST::Id classId = AST::CreateType(ast, ASTModule::classType, "B");
p::Attach(ast, parent, classId);

AST::Id class2Id = AST::CreateType(ast, FrameworkModule::classType, "B2");
AST::Id class2Id = AST::CreateType(ast, ASTModule::classType, "B2");
p::Attach(ast, parent, class2Id);

AST::Id functionId = AST::AddFunction({ast, classId}, "C");
Expand Down
2 changes: 1 addition & 1 deletion Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ add_executable(RiftTests ${TESTS_SOURCE_FILES})
rift_module(RiftTests)
pipe_target_shared_output_directory(RiftTests)
target_include_directories(RiftTests PUBLIC .)
target_link_libraries(RiftTests PUBLIC Rift Bandit)
target_link_libraries(RiftTests PUBLIC RiftAST Bandit)

add_test(NAME RiftTests COMMAND $<TARGET_FILE:RiftTests>)

0 comments on commit fdf8601

Please sign in to comment.