diff --git a/CMakeLists.txt b/CMakeLists.txt index ce8e0c0..74def9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,18 +63,14 @@ 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}) @@ -82,17 +78,8 @@ 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/*.*) @@ -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) @@ -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") diff --git a/cmake/3rdparty.cmake b/cmake/3rdparty.cmake index bda331f..9b69cf7 100644 --- a/cmake/3rdparty.cmake +++ b/cmake/3rdparty.cmake @@ -1,3 +1,5 @@ +include(FetchContent) + if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") else() @@ -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() diff --git a/cmake/boost.cmake b/cmake/boost.cmake index 3c0124e..8f71d41 100644 --- a/cmake/boost.cmake +++ b/cmake/boost.cmake @@ -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) diff --git a/mainWinLinuxMacos.cpp b/mainWinLinuxMacos.cpp index 9aeaa86..3edef0c 100644 --- a/mainWinLinuxMacos.cpp +++ b/mainWinLinuxMacos.cpp @@ -9,7 +9,7 @@ #include "imgui.h" #include "imgui_internal.h" -#include +#include #include "3rdparty/imgui/backends/imgui_impl_opengl3.h" #include "3rdparty/imgui/backends/imgui_impl_glfw.h" diff --git a/DemoDialog.cpp b/src/gui/DemoDialog.cpp similarity index 99% rename from DemoDialog.cpp rename to src/gui/DemoDialog.cpp index 5dcf810..012b8f8 100644 --- a/DemoDialog.cpp +++ b/src/gui/DemoDialog.cpp @@ -2,14 +2,14 @@ #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include +#include #include "imgui.h" #include "imgui_internal.h" #include "ImGuiFileDialog.h" -#include "CustomFont.cpp" -#include "Roboto_Medium.cpp" +#include +#include //#include "HanyISentyPagodaRegular.cpp" #include #include diff --git a/DemoDialog.h b/src/gui/DemoDialog.h similarity index 100% rename from DemoDialog.h rename to src/gui/DemoDialog.h diff --git a/CustomImGuiFileDialogConfig.h b/src/headers/CustomImGuiFileDialogConfig.h similarity index 99% rename from CustomImGuiFileDialogConfig.h rename to src/headers/CustomImGuiFileDialogConfig.h index 5e02fdc..01846f8 100644 --- a/CustomImGuiFileDialogConfig.h +++ b/src/headers/CustomImGuiFileDialogConfig.h @@ -5,7 +5,7 @@ #endif // #include -#include +#include #include // uncomment and modify defines under for customize ImGuiFileDialog diff --git a/CustomImWidgetsConfig.h b/src/headers/CustomImWidgetsConfig.h similarity index 93% rename from CustomImWidgetsConfig.h rename to src/headers/CustomImWidgetsConfig.h index d0bb9cd..9b39b32 100644 --- a/CustomImWidgetsConfig.h +++ b/src/headers/CustomImWidgetsConfig.h @@ -5,7 +5,7 @@ // ############# https://github.com/aiekick/ImGuiPack ################### // ###################################################################### -#include +#include #define BUTTON_LABEL_RESET ICON_IGFD_RESET #define BUTTON_LABEL_PLUS ICON_IGFD_ADD diff --git a/CustomFont.cpp b/src/res/CustomFont.cpp similarity index 100% rename from CustomFont.cpp rename to src/res/CustomFont.cpp diff --git a/CustomFont.h b/src/res/CustomFont.h similarity index 100% rename from CustomFont.h rename to src/res/CustomFont.h diff --git a/CustomFont.ifs b/src/res/CustomFont.ifs similarity index 100% rename from CustomFont.ifs rename to src/res/CustomFont.ifs diff --git a/CustomFont.png b/src/res/CustomFont.png similarity index 100% rename from CustomFont.png rename to src/res/CustomFont.png diff --git a/Roboto_Medium.cpp b/src/res/Roboto_Medium.cpp similarity index 100% rename from Roboto_Medium.cpp rename to src/res/Roboto_Medium.cpp diff --git a/Roboto_Medium.h b/src/res/Roboto_Medium.h similarity index 100% rename from Roboto_Medium.h rename to src/res/Roboto_Medium.h diff --git a/Roboto_Medium.png b/src/res/Roboto_Medium.png similarity index 100% rename from Roboto_Medium.png rename to src/res/Roboto_Medium.png