-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (54 loc) · 2.36 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
cmake_minimum_required(VERSION 3.3)
set(PROJ_DIR C:/Code/opengl-es)
set(BUILD_DIR build/Release)
set(XNLIB_DIR xnlib)
set(GLAD_DIR ${XNLIB_DIR}/external/glad)
set(IMGUI_DIR ${XNLIB_DIR}/external/imgui)
set(SDL_DIR ${XNLIB_DIR}/external/SDL2)
set(GLM_DIR ${XNLIB_DIR}/external/glm )
project(opengl_impl)
set( opengl_impl_src
${GLAD_DIR}/src/glad.c
${XNLIB_DIR}/external/stb_image_impl.cpp
)
include_directories(${GLAD_DIR}/include )
add_library(opengl_impl STATIC ${opengl_impl_src} )
macro(SDL_Build_Native project_name src_file )
project( ${project_name} )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set (extra_macro_args ${ARGN})
add_executable( ${PROJECT_NAME}
${IMGUI_DIR}/imgui.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_demo.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/backends/imgui_impl_sdl.h
${IMGUI_DIR}/backends/imgui_impl_sdl.cpp
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
${src_file}
)
find_library(SDL2_LIBRARY NAME SDL2 PATHS ${SDL_DIR}/lib/x64)
find_file(SDL2_INCLUDE_DIR NAME SDL.h PATHS ${SDL_DIR}/include HINTS SDL2 )
target_include_directories(${PROJECT_NAME} PRIVATE
${SDL_DIR}/include
${GLAD_DIR}/include
${IMGUI_DIR} ${IMGUI_DIR}/backends}
)
target_link_directories(${PROJECT_NAME} PRIVATE ${SDL_DIR}/lib/x64 )
target_link_libraries( ${PROJECT_NAME} ${SDL2_LIBRARY} opengl_impl)
target_include_directories(${PROJECT_NAME} PRIVATE ${IMGUI_DIR} ${IMGUI_DIR}/backends ${GLM_DIR} ${XNLIB_DIR} ${SDL2_INCLUDE_DIR})
target_compile_options(${PROJECT_NAME} PRIVATE /Bt)
# target_precompile_headers(${PROJECT_NAME} PRIVATE
# <iostream> <stdio.h> <fstream> <streambuf> <sstream> <stdlib.h>
# <ctime> <chrono> <thread> <queue> <mutex> <cmath> <unordered_map> <vector>
# <algorithm> <string.h> <cstring> <sys/types.h> <type_traits> <utility> <filesystem>
# <glm/glm.hpp> <glm/gtc/matrix_transform.hpp> <glm/gtc/type_ptr.hpp> <glm/gtx/norm.hpp> <glm/gtx/rotate_vector.hpp>
# <io.h> <conio.h> <errno.h>
# )
add_definitions(-D_USE_MATH_DEFINES)
endmacro()
SDL_Build_Native(imgui_sdl src/imgui_sdl.cpp)
SDL_Build_Native(main_sim_sdl src/main_sim_sdl.cpp)