Skip to content

Commit

Permalink
Build : Fix build system
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomrno committed May 1, 2024
1 parent 622ebce commit 0cd01ed
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 59 deletions.
26 changes: 3 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# Liste des fichiers sources pour la bibliothèque partagée
file(GLOB_RECURSE VORTEX_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main/src/*.cpp")
file(GLOB_RECURSE VORTEXEDITOR_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tools/editor/*.cpp")
file(GLOB_RECURSE VORTEXLAUNCHER_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher/*.cpp")
file(GLOB_RECURSE VORTEXEDITOR_SHARED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher/*.cpp")

# Création de la bibliothèque partagée
add_library(vortex_shared SHARED
${VORTEX_SHARED_SOURCES}
${VORTEXEDITOR_SHARED_SOURCES}
${VORTEXLAUNCHER_SHARED_SOURCES}
${VORTEXCORE_SHARED_SOURCES}
${VORTEXPROJECT_SHARED_SOURCES}
${VORTEXUTILS_SHARED_SOURCES}
Expand All @@ -24,36 +23,25 @@ target_include_directories(vortex_shared PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/main/include
${CMAKE_CURRENT_SOURCE_DIR}/main/src
${CMAKE_CURRENT_SOURCE_DIR}/tools/editor
${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher
)

# Liste des fichiers sources pour l'exécutable principal
file(GLOB_RECURSE VORTEX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main/src/*.cpp")




# Add editor
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/editor editor_build)
target_link_libraries(vortex_shared PUBLIC editor)

# Add launcher
# Add editor
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher launcher_build)
target_link_libraries(vortex_shared PUBLIC launcher)

if (NOT TARGET launcher AND NOT TARGET editor)
option(SPDLOG_INSTALL "Enable installation of spdlog" ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/spdlog spdlog_build)
target_link_libraries(vortex_shared PUBLIC spdlog)
endif()

# Création de l'exécutable principal
add_executable(vortex ${VORTEX_SOURCES} main.cpp)

# Liaison avec la bibliothèque partagée
target_link_libraries(vortex PRIVATE vortex_shared)


# Ajouter d'autres dépendances ou configurations pour l'exécutable principal

# Installation de l'exécutable dans /bin
Expand Down Expand Up @@ -82,19 +70,11 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/editor/app/
PATTERN "*.inl"
)

# Installation des fichiers d'en-tête de /tools/launcher/app/include
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher/app/
DESTINATION ${INSTALL_INCLUDE_DIR}/tools/launcher/app/
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.inl"
)

# Installation des fichiers d'en-tête de /lib
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/
DESTINATION ${INSTALL_INCLUDE_DIR}/lib
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.inl"
)
)
Binary file modified build/bin/vortex
Binary file not shown.
3 changes: 2 additions & 1 deletion build/in_system/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build
build
build_spdlog
8 changes: 6 additions & 2 deletions build/in_system/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
mkdir build_spdlog
mkdir build
cd build && cmake ../../.. && make install

#TODO If vortex working, install all builtin modules in system.
cd build_spdlog && cmake ../../../lib/spdlog && make install
cd ../build && cmake ../../.. && make install

#TODO If vortex working, install all builtin modules in system.
#TODO Embed spdlog into main CMakeLists.txt
11 changes: 7 additions & 4 deletions tools/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)



add_library(editor
# API
${CMAKE_CURRENT_SOURCE_DIR}/../../main/src/vortex.cpp
Expand All @@ -22,16 +24,18 @@ add_library(editor

${CMAKE_CURRENT_SOURCE_DIR}/app/core/ContentBrowser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/app/core/ProjectViewer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/app/core/TemplateManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/app/core/ModuleManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/app/src/editor.cpp

${CMAKE_CURRENT_SOURCE_DIR}/app/instances/Utils/ModuleDetails/ModuleDetails.cpp
)

target_include_directories(editor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)

target_include_directories(editor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)

if (NOT TARGET launcher)
# editor requirements
if (NOT TARGET launcher)
find_package(Vulkan REQUIRED)
option(SPDLOG_INSTALL "Enable installation of spdlog" ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../lib/spdlog spdlog_build)
Expand All @@ -45,7 +49,6 @@ target_link_libraries(editor PUBLIC imgui)
target_link_libraries(editor PUBLIC glm)
target_link_libraries(editor PUBLIC stbimage)
target_link_libraries(editor PUBLIC spdlog)

endif()

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/platform/GUI/editor/icon.png DESTINATION /usr/include/vortex)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/platform/GUI/editor/icon.png DESTINATION /usr/include/vortex)
26 changes: 1 addition & 25 deletions tools/editor/app/include/editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,34 +136,10 @@ class EditorLayer : public UIKit::Layer
std::vector<std::string> instanciedWindowsNames;
};

UIKit::Application *CreateEditor(int argc, char **argv)
{
int port = atoi(argv[1]);

std::shared_ptr<EditorLayer> applayer = std::make_shared<EditorLayer>();
applayer->m_ctx = VortexMaker::GetCurrentContext();

UIKit::ApplicationSpecification spec;
std::string name = applayer->m_ctx->name + " - Vortex Editor";
spec.Name = name;
spec.CustomTitlebar = true;
spec.IconPath = "icon.png";

UIKit::Application *app = new UIKit::Application(spec);

app->PushLayer(applayer);
app->SetMenubarCallback([app, applayer]()
{ applayer->menubar(applayer, app); });

return app;
}

namespace VortexMaker
{
static int VortexEditor(int argc, char **argv)
{
return UIKit::ThirdMain(argc, argv, CreateEditor);
}
int VortexEditor(int argc, char **argv);

// Old call
/*static int VortexEditor(int argc, char **argv)
Expand Down
27 changes: 27 additions & 0 deletions tools/editor/app/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,30 @@ void EditorLayer::menubar(const std::shared_ptr<EditorLayer> &exampleLayer, UIKi
ImGui::EndMenu();
}
}

UIKit::Application *CreateEditor(int argc, char **argv)
{
int port = atoi(argv[1]);

std::shared_ptr<EditorLayer> applayer = std::make_shared<EditorLayer>();
applayer->m_ctx = VortexMaker::GetCurrentContext();

UIKit::ApplicationSpecification spec;
std::string name = applayer->m_ctx->name + " - Vortex Editor";
spec.Name = name;
spec.CustomTitlebar = true;
spec.IconPath = "icon.png";

UIKit::Application *app = new UIKit::Application(spec);

app->PushLayer(applayer);
app->SetMenubarCallback([app, applayer]()
{ applayer->menubar(applayer, app); });

return app;
}

int VortexMaker::VortexEditor(int argc, char **argv)
{
return UIKit::ThirdMain(argc, argv, CreateEditor);
}
8 changes: 4 additions & 4 deletions tools/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ add_library(launcher
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/platform/GUI/editor/Image.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/src/core/Log.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/assets/icons.cpp

${CMAKE_CURRENT_SOURCE_DIR}/app/src/launcher.cpp
)


target_include_directories(launcher PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)

if (NOT TARGET editor)
# launcher requirements
if (NOT TARGET editor)
find_package(Vulkan REQUIRED)
option(SPDLOG_INSTALL "Enable installation of spdlog" ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../lib/spdlog spdlog_build)
Expand All @@ -42,7 +42,7 @@ target_link_libraries(launcher PUBLIC imgui)
target_link_libraries(launcher PUBLIC glm)
target_link_libraries(launcher PUBLIC stbimage)
target_link_libraries(launcher PUBLIC spdlog)

endif()

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/platform/GUI/editor/icon.png DESTINATION /usr/include/vortex)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/uikit/platform/GUI/editor/icon.png DESTINATION /usr/include/vortex)

0 comments on commit 0cd01ed

Please sign in to comment.