forked from aiekick/ImGuiFileDialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (96 loc) · 3.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
cmake_minimum_required(VERSION 3.1)
set(PROJECT ImGuiFileDialog)
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" OFF)
include(cmake/3rdparty.cmake)
if(MSVC)
add_definitions(-DMSVC)
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter")
endif ()
add_definitions(${GLFW_DEFINITIONS})
add_definitions(-DCUSTOM_IMGUIFILEDIALOG_CONFIG="../../../CustomImGuiFileDialogConfig.h")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
if (USE_NEW_IMGUI_KEY_SYSTEM)
add_definitions(-DIMGUI_DISABLE_OBSOLETE_KEYIO)
endif()
file(GLOB MAIN_SOURCES ${CMAKE_SOURCE_DIR}/main.cpp)
file(GLOB CUSTOM_SOURCES ${CMAKE_SOURCE_DIR}/CustomImGuiFileDialogConfig.h)
file(GLOB RES_SOURCES
${CMAKE_SOURCE_DIR}/CustomFont.cpp
${CMAKE_SOURCE_DIR}/CustomFont.h)
file(GLOB IMGUIFILEDIALOG_SOURCES
${CMAKE_SOURCE_DIR}/ImGuiFileDialog/*.cpp
${CMAKE_SOURCE_DIR}/ImGuiFileDialog/*.h)
file(GLOB IMGUIIMPL_SOURCES
${CMAKE_SOURCE_DIR}/3rdparty/imgui/backends/imgui_impl_glfw.cpp
${CMAKE_SOURCE_DIR}/3rdparty/imgui/backends/imgui_impl_glfw.h
${CMAKE_SOURCE_DIR}/3rdparty/imgui/backends/imgui_impl_opengl3.cpp
${CMAKE_SOURCE_DIR}/3rdparty/imgui/backends/imgui_impl_opengl3.h)
source_group(main FILES ${MAIN_SOURCES})
source_group(src\\Custom FILES ${CUSTOM_SOURCES})
source_group(src\\Res FILES ${RES_SOURCES})
source_group(src\\ImGuiFileDialog FILES ${IMGUIFILEDIALOG_SOURCES})
source_group(src\\ImGuiImpl FILES ${IMGUIIMPL_SOURCES})
if (APPLE)
##set(ICON icon.icns)
##set_source_files_properties(icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif()
add_executable(${PROJECT}
MACOSX_BUNDLE
##${ICON}
${MAIN_SOURCES}
${CUSTOM_SOURCES}
${RES_SOURCES}
${IMGUIFILEDIALOG_SOURCES}
${IMGUIIMPL_SOURCES}
)
if (APPLE)
set_target_properties(${PROJECT}
PROPERTIES
OUTPUT_NAME "ImGuiFileDialog"
MACOSX_BUNDLE_EXECUTABLE_NAME "ImGuiFileDialog"
MACOSX_BUNDLE_BUNDLE_NAME "ImGuiFileDialog"
FOLDER "ImGuiFileDialog"
##RESOURCE icon.icns
MACOSX_BUNDLE_SHORT_VERSION_STRING ""
MACOSX_BUNDLE_LONG_VERSION_STRING ""
##MACOSX_BUNDLE_ICON_FILE icon.icns
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/MacOSXBundleInfo.plist.in")
elseif(WIN32)
set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "ImGuiFileDialog")
elseif(UNIX)
set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "ImGuiFileDialog")
endif()
if (USE_STD_FILESYSTEM)
add_definitions(-DUSE_STD_FILESYSTEM)
set(CMAKE_CXX_STANDARD 17)
set_target_properties(${PROJECT} PROPERTIES CXX_STANDARD 17)
message("USE C++17 and std::filesystem")
else()
set(CMAKE_CXX_STANDARD 11)
set_target_properties(${PROJECT} PROPERTIES CXX_STANDARD 11)
message("USE C++11 and DIRENT")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}")
install(TARGETS ${PROJECT} DESTINATION ${CMAKE_INSTALL_PREFIX})
include_directories(
${PLOG_INCLUDE_DIR}
${GLM_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
${GLFW_INCLUDE_DIR}
${GLAD_INCLUDE_DIR}
${IMGUI_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/ImGuiFileDialog
)
target_link_libraries(${PROJECT} PRIVATE
${OPENGL_LIBRARIES}
${GLFW_LIBRARIES}
${GLAD_LIBRARIES}
${IMGUI_LIBRARIES}
)