Skip to content

Commit

Permalink
[ADD] : add demo boost file system proto
Browse files Browse the repository at this point in the history
[ADD] : add github actions jobs for all the File System Interfaces
  • Loading branch information
aiekick committed Nov 25, 2023
1 parent 5121ed1 commit 5620c76
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 8 deletions.
46 changes: 45 additions & 1 deletion .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- DemoApp

jobs:
build_Linux_Ubuntu:
ImGuiFileDialog_App_Linux_Dirent_FileSystem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -28,3 +28,47 @@ jobs:
name: ImGuiFileDialog
path: build/ImGuiFileDialog

ImGuiFileDialog_App_Linux_Std_FileSystem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: DemoApp
- name: checkout submodules
run : git submodule update --init --recursive
- name: Install OpenGL lib / Requirement for Glfw3
run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev
- name: configure
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON
- name: build
run: cmake --build build --config Release
- name: ctest
run: ctest --test-dir build --output-on-failure
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ImGuiFileDialog
path: build/ImGuiFileDialog

ImGuiFileDialog_App_Linux_Boost_Demo_FileSystem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: DemoApp
- name: checkout submodules
run : git submodule update --init --recursive
- name: Install OpenGL lib / Requirement for Glfw3
run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev
- name: configure
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON
- name: build
run: cmake --build build --config Release
- name: ctest
run: ctest --test-dir build --output-on-failure
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ImGuiFileDialog
path: build/ImGuiFileDialog

46 changes: 45 additions & 1 deletion .github/workflows/Osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- DemoApp

jobs:
build_Osx:
ImGuiFileDialog_App_Osx_Dirent_FileSystem:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -27,3 +27,47 @@ jobs:
with:
name: ImGuiFileDialog_App_Macos.app
path: build/ImGuiFileDialog_App_Macos.app

ImGuiFileDialog_App_Osx_Std_FileSystem:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: DemoApp
- name: checkout submodules
run : git submodule update --init --recursive
- name: Install OpenGL lib / Requirement for Glfw3
run : brew update
- name: configure
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON
- name: build
run: cmake --build build --config Release
- name: ctest
run: ctest --test-dir build --output-on-failure
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ImGuiFileDialog_App_Macos.app
path: build/ImGuiFileDialog_App_Macos.app

ImGuiFileDialog_App_Osx_Boost_Demo_FileSystem:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: DemoApp
- name: checkout submodules
run : git submodule update --init --recursive
- name: Install OpenGL lib / Requirement for Glfw3
run : brew update
- name: configure
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON
- name: build
run: cmake --build build --config Release
- name: ctest
run: ctest --test-dir build --output-on-failure
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ImGuiFileDialog_App_Macos.app
path: build/ImGuiFileDialog_App_Macos.app
43 changes: 42 additions & 1 deletion .github/workflows/Win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- DemoApp

jobs:
build_Win_latest:
ImGuiFileDialog_App_Win32_Dirent_FileSystem:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -25,3 +25,44 @@ jobs:
with:
name: ImGuiFileDialog_App_WIn32
path: build\Release\ImGuiFileDialog_App_WIn32.exe

ImGuiFileDialog_App_Win32_Std_FileSystem:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: DemoApp
- name: checkout submodules
run : git submodule update --init --recursive
- name: configure
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON
- name: build
run: cmake --build build --config Release
- name: ctest
run: ctest --test-dir build --output-on-failure
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ImGuiFileDialog_App_WIn32
path: build\Release\ImGuiFileDialog_App_WIn32.exe

ImGuiFileDialog_App_Win32_Boost_Demo_FileSystem:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: DemoApp
- name: checkout submodules
run : git submodule update --init --recursive
- name: configure
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON
- name: build
run: cmake --build build --config Release
- name: ctest
run: ctest --test-dir build --output-on-failure
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: ImGuiFileDialog_App_WIn32
path: build\Release\ImGuiFileDialog_App_WIn32.exe

32 changes: 28 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,31 @@ set(PROJECT ImGuiFileDialog_App)
enable_language(C CXX)
project(${PROJECT} CXX)

option(USE_STD_FILESYSTEM "Enable std::filesystem use for path and ImGuiFileDialog" OFF)
option(USE_NEW_IMGUI_KEY_SYSTEM "Define the symbol IMGUI_DISABLE_OBSOLETE_KEYIO" ON)
option(USE_TEST "Enable tests" ON)

option(USE_STD_FILESYSTEM "Enable std::filesystem use for path and ImGuiFileDialog" OFF)
option(USE_BOOST_DEMO_FILESYSTEM "Enable the demo of custom filesystem here with boost" OFF)

include(cmake/3rdparty.cmake)

if (USE_BOOST_DEMO_FILESYSTEM)
add_definitions(-DCUSTOM_FILESYSTEM_INCLUDE="${CMAKE_SOURCE_DIR}/FileSystemBoost.hpp")
endif()

if(MSVC)
add_definitions(-DMSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
if (USE_STD_FILESYSTEM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
endif()
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter")
if (USE_STD_FILESYSTEM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter")
endif()
endif ()

add_definitions(${GLFW_DEFINITIONS})
Expand Down Expand Up @@ -111,7 +125,11 @@ else()
set_target_properties(${PROJECT} PROPERTIES CXX_STANDARD 11)
set_target_properties(ImGuiFileDialog PROPERTIES CXX_STANDARD 11)
set_target_properties(imgui PROPERTIES CXX_STANDARD 11)
message("USE C++11 and DIRENT")
if (USE_BOOST_DEMO_FILESYSTEM)
message("USE C++11 and BOOST as demo custom filesystem")
else()
message("USE C++11 and DIRENT")
endif()
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand All @@ -131,6 +149,12 @@ set_target_properties(ImGuiFileDialog PROPERTIES FOLDER Lib)

target_include_directories(ImGuiFileDialog PRIVATE
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/3rdparty/boost_filesystem/include/
)

target_include_directories(${PROJECT} PRIVATE
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/3rdparty/boost_filesystem/include/
)

if (USE_TEST)
Expand Down
4 changes: 4 additions & 0 deletions CustomImGuiFileDialogConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

// uncomment and modify defines under for customize ImGuiFileDialog

// if you need to use your FileSystem Interface, you msut define the include of your FileSystem Interface file
// if commented, you have two default interface, std::filesystem or dirent
//#define CUSTOM_FILESYSTEM_INCLUDE

//this options need c++17
// in this app its defined in CMakeLists.txt
//#define USE_STD_FILESYSTEM
Expand Down
36 changes: 36 additions & 0 deletions FileSystemBoost.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include <ImGuiFileDialog/ImGuiFileDialog.h>
#include <boost/filesystem.hpp>

class FileSystemBoost : public IGFD::IFileSystem {
public:
bool IsDirectoryCanBeOpened(const std::string& vName) override {
return false;
}
bool IsDirectoryExist(const std::string& vName) override {
return false;
}
bool CreateDirectoryIfNotExist(const std::string& vName) override {
return false;
}
std::vector<std::string> GetDrivesList() override {
std::vector<std::string> res;
return res;
}

IGFD::Utils::PathStruct ParsePathFileName(const std::string& vPathFileName) override {
IGFD::Utils::PathStruct res;
return res;
}

std::vector<IGFD::FileInfos> ScanDirectory(const std::string& vPath) override {
std::vector<IGFD::FileInfos> res;
return res;
}
bool IsDirectory(const std::string& vFilePathName) override {
return false;
}
};

#define FILE_SYSTEM_OVERRIDE FileSystemBoost
2 changes: 1 addition & 1 deletion ImGuiFileDialog

0 comments on commit 5620c76

Please sign in to comment.