-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (47 loc) · 2.46 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
cmake_minimum_required(VERSION 3.24)
project(PolyEditor)
set(CMAKE_CXX_STANDARD 23)
set(INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/libs/")
# Engine
file(GLOB_RECURSE ENGINE_SOURCE_FILES
${CMAKE_SOURCE_DIR}/engine/*.cpp)
file(GLOB_RECURSE ENGINE_HEADER_FILES
${CMAKE_SOURCE_DIR}/engine/*.h)
# Editor
file(GLOB_RECURSE EDITOR_SOURCE_FILES
${CMAKE_SOURCE_DIR}/editor/*.cpp)
file(GLOB_RECURSE EDITOR_HEADER_FILES
${CMAKE_SOURCE_DIR}/editor/*.h)
file(GLOB_RECURSE INCLUDE_SOURCE_FILES
${CMAKE_SOURCE_DIR}/libs/*.cpp)
add_executable(PolyEditor main.cpp glad.c stb.cpp tinygltf.cpp ${EDITOR_SOURCE_FILES} ${EDITOR_HEADER_FILES} ${ENGINE_SOURCE_FILES} ${ENGINE_HEADER_FILES} ${INCLUDE_SOURCE_FILES} libs/tinyobj/tiny_obj_loader.h tinyobj.cpp editor/CustomImGuiStyle.h)
find_package(glfw3 3.3 REQUIRED)
target_link_libraries(PolyEditor glfw)
find_package(OpenGL REQUIRED)
target_link_libraries(PolyEditor OpenGL::GL)
target_include_directories(PolyEditor PUBLIC ${INCLUDE_DIR})
#Copy shaders
file(GLOB_RECURSE SHADER_FILES
${CMAKE_SOURCE_DIR}/shaders/*.glsl)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/shaders")
add_custom_command(TARGET PolyEditor PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SHADER_FILES} "${CMAKE_CURRENT_BINARY_DIR}/shaders")
#Copy textures
file(GLOB_RECURSE TEXTURE_FILES
${CMAKE_SOURCE_DIR}/assets/textures/*.jpg)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/textures")
add_custom_command(TARGET PolyEditor PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TEXTURE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/textures")
#Copy Objects
file(GLOB_RECURSE OBJECT_FILES
${CMAKE_SOURCE_DIR}/assets/objects/*.obj)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/objects")
add_custom_command(TARGET PolyEditor PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OBJECT_FILES} "${CMAKE_CURRENT_BINARY_DIR}/objects")
#Copy MTL
file(GLOB_RECURSE MTL_FILES
${CMAKE_SOURCE_DIR}/assets/objects/*.mtl)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/objects")
add_custom_command(TARGET PolyEditor PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MTL_FILES} "${CMAKE_CURRENT_BINARY_DIR}/objects")
#Copy Fonts
file(GLOB_RECURSE FONT_FILES
${CMAKE_SOURCE_DIR}/assets/fonts/*.ttf)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/fonts")
add_custom_command(TARGET PolyEditor PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FONT_FILES} "${CMAKE_CURRENT_BINARY_DIR}/fonts/")