Skip to content

Commit

Permalink
[RFR] : reorganized files
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Aug 18, 2024
1 parent 9221b8a commit f88a148
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 78 deletions.
28 changes: 5 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,23 @@ endif()

add_definitions(${GLFW_DEFINITIONS})
add_definitions(-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS)
add_definitions(-DCUSTOM_IMGUIFILEDIALOG_CONFIG="${CMAKE_CURRENT_SOURCE_DIR}/CustomImGuiFileDialogConfig.h")
add_definitions(-DCUSTOM_IMWIDGETS_CONFIG="${CMAKE_CURRENT_SOURCE_DIR}/CustomImWidgetsConfig.h")
add_definitions(-DCUSTOM_IMGUIFILEDIALOG_CONFIG="${CMAKE_CURRENT_SOURCE_DIR}/src/headers/CustomImGuiFileDialogConfig.h")
add_definitions(-DCUSTOM_IMWIDGETS_CONFIG="${CMAKE_CURRENT_SOURCE_DIR}/src/headers/CustomImWidgetsConfig.h")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

if (USE_NEW_IMGUI_KEY_SYSTEM)
add_definitions(-DIMGUI_DISABLE_OBSOLETE_KEYIO)
endif()

file(GLOB CUSTOM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/CustomImGuiFileDialogConfig.h
${CMAKE_CURRENT_SOURCE_DIR}/CustomImWidgetsConfig.h)

if (USE_BOOST_FILESYSTEM)
file(GLOB BOOST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/FileSystemBoost.hpp)
source_group(src\\Boost FILES ${BOOST_SOURCES})
elseif (USE_STD_FILESYSTEM)
add_definitions(-DUSE_STD_FILESYSTEM)
endif()

file(GLOB RES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/CustomFont.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CustomFont.h
${CMAKE_CURRENT_SOURCE_DIR}/Roboto_Medium.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Roboto_Medium.h)
file(GLOB RES_WIDGETS
${CMAKE_CURRENT_SOURCE_DIR}/ImWidgets.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ImWidgets.h)
file(GLOB RES_DEMO_DIALOG
${CMAKE_CURRENT_SOURCE_DIR}/DemoDialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/DemoDialog.h)
file(GLOB_RECURSE PROJECT_SRC_FILES ${CMAKE_SOURCE_DIR}/src/*.*)
source_group(TREE ${CMAKE_SOURCE_DIR}/src PREFIX src FILES ${PROJECT_SRC_FILES})

file(GLOB_RECURSE CMAKE_SOURCES ${CMAKE_SOURCE_DIR}/cmake/*.*)

Expand All @@ -114,10 +101,6 @@ else()
endif()

source_group(cmake FILES ${CMAKE_SOURCES})
source_group(src\\Res FILES ${RES_SOURCES})
source_group(src\\Widgets FILES ${RES_WIDGETS})
source_group(src\\Custom FILES ${CUSTOM_SOURCES})
source_group(src\\DemoDialog FILES ${RES_DEMO_DIALOG})
source_group(src\\ImGuiImpl FILES ${IMGUIIMPL_SOURCES})

if (APPLE)
Expand Down Expand Up @@ -160,8 +143,7 @@ set(SOURCES
${MAIN_SOURCES}
${BOOST_SOURCES}
${CMAKE_SOURCES}
${CUSTOM_SOURCES}
${RES_DEMO_DIALOG}
${PROJECT_SRC_FILES}
${IMGUIIMPL_SOURCES})

if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
Expand Down
4 changes: 3 additions & 1 deletion cmake/3rdparty.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(FetchContent)

if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")

else()
Expand All @@ -20,6 +22,6 @@ endif()
include(cmake/imgui.cmake)
include(cmake/imwidgets.cmake)

if(USE_BOOST_DEMO_FILESYSTEM)
if(USE_BOOST_FILESYSTEM)
include(cmake/boost.cmake)
endif()
111 changes: 63 additions & 48 deletions cmake/boost.cmake
Original file line number Diff line number Diff line change
@@ -1,53 +1,68 @@
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/boost/)

set(BOOST_FILESYSTEM_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/filesystem/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/assert/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/config/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/container_hash/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/core/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/detail/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/io/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/iterator/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/smart_ptr/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/system/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/type_traits/include
${CMAKE_SOURCE_DIR}/3rdparty/boost/libs/predef/include
FetchContent_Declare(
boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-1.86.0
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/_deps/boost
GIT_PROGRESS true
GIT_SHALLOW true
)

set(BOOST_FILESYSTEM_LIBRARIES
boost_assert
boost_config
boost_container_hash
boost_core
boost_detail
boost_filesystem
boost_io
boost_iterator
boost_predef
boost_smart_ptr
boost_system
boost_type_traits
)
FetchContent_GetProperties(boost)
if(NOT boost_POPULATED)
FetchContent_Populate(boost)

##EXCLUDE_FROM_ALL reject install for this target
add_subdirectory(${boost_SOURCE_DIR} EXCLUDE_FROM_ALL)

set(BOOST_FILESYSTEM_INCLUDE_DIRS
${boost_SOURCE_DIR}/libs/filesystem/include
${boost_SOURCE_DIR}/libs/assert/include
${boost_SOURCE_DIR}/libs/config/include
${boost_SOURCE_DIR}/libs/container_hash/include
${boost_SOURCE_DIR}/libs/core/include
${boost_SOURCE_DIR}/libs/detail/include
${boost_SOURCE_DIR}/libs/io/include
${boost_SOURCE_DIR}/libs/iterator/include
${boost_SOURCE_DIR}/libs/smart_ptr/include
${boost_SOURCE_DIR}/libs/system/include
${boost_SOURCE_DIR}/libs/type_traits/include
${boost_SOURCE_DIR}/libs/predef/include
)

set(BOOST_FILESYSTEM_LIBRARIES
boost_assert
boost_config
boost_container_hash
boost_core
boost_detail
boost_filesystem
boost_io
boost_iterator
boost_predef
boost_smart_ptr
boost_system
boost_type_traits
)

## will search for target with a particular prefix and will set destination folder
function(set_target_dir _PREFIX DIR TARGET_DIR)
get_property(TGTS DIRECTORY "${DIR}" PROPERTY BUILDSYSTEM_TARGETS)
string (REGEX MATCHALL "(^|;)${_PREFIX}[A-Za-z0-9_]*" _matchedVars "${TGTS}")
foreach (_var IN LISTS _matchedVars)
if (TARGET ${_var})
set_target_properties(${_var} PROPERTIES FOLDER ${TARGET_DIR})
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
else()
target_compile_options(${_var} INTERFACE "-Wno-everything")
endif()
endif()
endforeach()
get_property(SUBDIRS DIRECTORY "${DIR}" PROPERTY SUBDIRECTORIES)
foreach(SUBDIR IN LISTS SUBDIRS)
set_target_dir("${_PREFIX}" "${SUBDIR}" "${TARGET_DIR}")
endforeach()
endfunction()

## will serarhc for target with a particular prefix and will set destination folder
function(set_target_dir _PREFIX DIR TARGET_DIR)
get_property(TGTS DIRECTORY "${DIR}" PROPERTY BUILDSYSTEM_TARGETS)
string (REGEX MATCHALL "(^|;)${_PREFIX}[A-Za-z0-9_]*" _matchedVars "${TGTS}")
foreach (_var IN LISTS _matchedVars)
if (TARGET ${_var})
set_target_properties(${_var} PROPERTIES FOLDER ${TARGET_DIR})
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#target_compile_options(${_var} PRIVATE "-Wno-everything")
else()
target_compile_options(${_var} PRIVATE "-Wno-everything")
set_target_dir(boost . ${boost_SOURCE_DIR}/libs)
endif()
endif()
endforeach()
get_property(SUBDIRS DIRECTORY "${DIR}" PROPERTY SUBDIRECTORIES)
foreach(SUBDIR IN LISTS SUBDIRS)
set_target_dir("${_PREFIX}" "${SUBDIR}" "${TARGET_DIR}")
endforeach()
endfunction()

set_target_dir(boost . 3rdparty/boost)
2 changes: 1 addition & 1 deletion mainWinLinuxMacos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "imgui.h"
#include "imgui_internal.h"

#include <DemoDialog.h>
#include <src/gui/DemoDialog.h>

#include "3rdparty/imgui/backends/imgui_impl_opengl3.h"
#include "3rdparty/imgui/backends/imgui_impl_glfw.h"
Expand Down
6 changes: 3 additions & 3 deletions DemoDialog.cpp → src/gui/DemoDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#endif

#include <DemoDialog.h>
#include <src/gui/DemoDialog.h>

#include "imgui.h"
#include "imgui_internal.h"

#include "ImGuiFileDialog.h"
#include "CustomFont.cpp"
#include "Roboto_Medium.cpp"
#include <src/res/CustomFont.cpp>
#include <src/res/Roboto_Medium.cpp>
//#include "HanyISentyPagodaRegular.cpp"
#include <cstdio>
#include <sstream>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#endif

// #include <imgui.h>
#include <CustomFont.h>
#include <src/res/CustomFont.h>
#include <ImWidgets.h>

// uncomment and modify defines under for customize ImGuiFileDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ############# https://github.com/aiekick/ImGuiPack ###################
// ######################################################################

#include <CustomFont.h>
#include <src/res/CustomFont.h>

#define BUTTON_LABEL_RESET ICON_IGFD_RESET
#define BUTTON_LABEL_PLUS ICON_IGFD_ADD
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

0 comments on commit f88a148

Please sign in to comment.