-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
79 lines (69 loc) · 2.34 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
cmake_minimum_required(VERSION 3.20)
project(imgui-lib)
set(CMAKE_CXX_STANDARD 17)
SET (CMAKE_VERBOSE_MAKEFILE ON)
SET (VERSION "0.0.1" CACHE STRING "Version")
SET (CMAKE_CXX_VISIBILITY_PRESET hidden)
SET (CMAKE_C_VISIBILITY_PRESET hidden)
SET (CMAKE_POSITION_INDEPENDENT_CODE ON)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -fno-rtti -fno-threadsafe-statics")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti -fno-threadsafe-statics")
set(LIB_NAME "imgui")
macro (configure_msvc_runtime)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -D_CRT_NONSTDC_NO_DEPRECATE)
# Default to statically-linked runtime.
if ("${MSVC_RUNTIME}" STREQUAL "")
set (MSVC_RUNTIME "static")
endif ()
# Set compiler options.
set (variables
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if (${MSVC_RUNTIME} STREQUAL "static")
message(STATUS
"MSVC -> forcing use of statically-linked runtime."
)
foreach (variable ${variables})
if (${variable} MATCHES "/MD")
string (REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif ()
endforeach ()
else ()
message (STATUS
"MSVC -> forcing use of dynamically-linked runtime."
)
foreach (variable ${variables})
if (${variable} MATCHES "/MT")
string (REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}")
endif ()
endforeach ()
endif ()
endif ()
endmacro ()
configure_msvc_runtime ()
set(
SRC_FILES
imgui/imgui.cpp
imgui/imgui_widgets.cpp
imgui/imgui_draw.cpp
imgui/imgui_tables.cpp
imgui/imgui_demo.cpp
implot/implot.cpp
implot/implot_items.cpp
implot/implot_demo.cpp
)
set(
INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/imgui
${PROJECT_SOURCE_DIR}/implot
)
add_library(${LIB_NAME} STATIC ${SRC_FILES})
target_include_directories(${LIB_NAME} PUBLIC ${INCLUDE_DIRS})