Skip to content

Commit

Permalink
Merge pull request #1 from DarkStar1997/gui
Browse files Browse the repository at this point in the history
Gui
  • Loading branch information
DarkStar1997 authored Nov 2, 2022
2 parents 4105cb3 + 0021ef4 commit e709a89
Show file tree
Hide file tree
Showing 7 changed files with 2,416 additions and 8 deletions.
79 changes: 71 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,27 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()

if(MSVC)
set(CMAKE_CXX_FLAGS "/MT")
elseif(UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "-static")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
get_filename_component(fc_cache "../.fetchcontent_cache"
REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(FETCHCONTENT_BASE_DIR ${fc_cache})

FetchContent_Declare(
fmtlib
GIT_REPOSITORY "https://github.com/fmtlib/fmt"
GIT_TAG 5c0d65640118e7e0b1350f28fab3243fd6ce35a0
GIT_TAG 9.1.0
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(fmtlib)

FetchContent_Declare(
nlohmann
GIT_REPOSITORY "https://github.com/nlohmann/json"
GIT_TAG 700b95f4473cac1d900b807541daad0ca3d98f52
GIT_TAG v3.11.2
GIT_PROGRESS TRUE
)
FetchContent_Populate(nlohmann)
Expand All @@ -44,10 +41,76 @@ FetchContent_Declare(
FetchContent_Populate(hash)
include_directories(${hash_SOURCE_DIR}/src)

FetchContent_Declare(
imgui
GIT_REPOSITORY "https://github.com/ocornut/imgui"
GIT_TAG f87e891f1818d02f55028fe042a323bb27c41d66
GIT_PROGRESS TRUE
)
FetchContent_Populate(imgui)

FetchContent_Declare(
nativefiledialog
GIT_REPOSITORY "https://github.com/btzy/nativefiledialog-extended"
GIT_TAG 74923e7c0cc19fec1b789e78c033c211300e4a01
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(nativefiledialog)

set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "")
FetchContent_Declare(
glfw
GIT_REPOSITORY "https://github.com/glfw/glfw"
GIT_TAG 3.3.8
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(glfw)

set(SOURCES
main.cpp
)

set(EXE_NAME "rmg_organize")
add_executable(${EXE_NAME} ${SOURCES})
target_link_libraries(${EXE_NAME} fmt::fmt)


find_package(OpenGL REQUIRED)

set(GUI_SOURCE_LIST
main_gui.cpp
renderer.cpp
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp
)

if(UNIX OR WIN32)
set(BACKEND_LIST
${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
)
list(APPEND GUI_SOURCE_LIST main_gui.cpp ${BACKEND_LIST})
endif()

add_executable(run ${GUI_SOURCE_LIST})
target_include_directories(run PRIVATE
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
#${nativefiledialog_SOURCE_DIR}
)

if(UNIX)
target_link_libraries(run PRIVATE pthread glfw OpenGL::GL fmt::fmt nfd)
elseif(WIN32)
target_link_libraries(run PRIVATE glfw OpenGL::GL fmt::fmt nfd)
endif()

add_custom_target(copy_fonts
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_LIST_DIR}/fonts/OpenSans-Regular.ttf
${CMAKE_CURRENT_BINARY_DIR}
)
add_dependencies(run copy_fonts)
Binary file added fonts/OpenSans-Regular.ttf
Binary file not shown.
19 changes: 19 additions & 0 deletions imgui.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Window][DockSpaceViewport_11111111]
Pos=0,0
Size=960,540
Collapsed=0

[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0

[Window][Media Organizer]
Pos=0,0
Size=960,540
Collapsed=0
DockId=0x8B93E3BD,0

[Docking][Data]
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=379,194 Size=960,540 CentralNode=1 Selected=0x049E2545

Loading

0 comments on commit e709a89

Please # to comment.