-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
137 lines (119 loc) · 4.28 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
cmake_minimum_required(VERSION 3.20)
project(vulkan_engine)
set(CMAKE_CXX_STANDARD 17)
# GLFW
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(thirdparty/glfw)
add_subdirectory(thirdparty/lua)
add_subdirectory(thirdparty/imgui)
add_subdirectory(thirdparty/tracy)
# Vulkan
find_package(Vulkan REQUIRED)
# OpenGL
find_package(OpenGL REQUIRED)
# FMOD
set(FMOD_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/fmod/inc")
if(WIN32)
set(FMOD_LIBRARY
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmod_vc.lib" # for production use
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmodstudio_vc.lib" # for production use
# "${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmodstudioL_vc.lib" # for debug use
)
file(COPY
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmod.dll" # for production use
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmodstudio.dll" # for production use
# "${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmodstudioL.dll" # for debug use
DESTINATION ${CMAKE_BINARY_DIR})
elseif(APPLE)
set(FMOD_LIBRARY
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/libfmod.dylib" # for production use
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/libfmodstudio.dylib" # for production use
)
else()
set(FMOD_LIBRARY
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/libfmod.so" # for production use
"${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/libfmodstudio.so" # for production use
# "${CMAKE_SOURCE_DIR}/thirdparty/fmod/lib/x64/fmodstudioL_vc.lib" # for debug use
)
endif()
# Free Type
set(FREETYPE_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/freetype/inc")
if(WIN32)
set(FREETYPE_LIBRARY "${CMAKE_SOURCE_DIR}/thirdparty/freetype/lib/freetype.lib" )
file(COPY "${CMAKE_SOURCE_DIR}/thirdparty/freetype/lib/freetype.dll" DESTINATION ${CMAKE_BINARY_DIR})
endif()
# Geforce NOW
set(GEFORCE_NOW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/geforce_now/include")
#set(GEFORCE_NOW_LIBRARY
# "${CMAKE_SOURCE_DIR}/thirdparty/geforce_now/lib/x64/GfnRuntimeSdk.dll"
# )
file(COPY
"${CMAKE_SOURCE_DIR}/thirdparty/geforce_now/lib/x64/GfnRuntimeSdk.dll"
DESTINATION ${CMAKE_BINARY_DIR})
#add_library(GEFORCE_NOW_LIBRARY SHARED thirdparty/geforce_now/lib/x64/GfnRuntimeSdk.dll)
#set_target_properties(GEFORCE_NOW_LIBRARY PROPERTIES LINKER_LANGUAGE C)
# Messages
message("Libraries:")
message(VULKAN_INCLUDE_DIRS: ${Vulkan_INCLUDE_DIRS})
message(VULKAN_LIB: ${Vulkan_LIBRARIES})
message(OPENGL_LIBRARIES: ${OPENGL_LIBRARIES})
message(FMOD_LIBRARY: ${FMOD_LIBRARY})
message(GEFORCE_NOW_LIBRARY: ${GEFORCE_NOW_LIBRARY})
# include directories
include_directories(
thirdparty
${FMOD_INCLUDE_DIR}
${GEFORCE_NOW_INCLUDE_DIR}
)
# load source and header files
file(GLOB_RECURSE SOURCE_FILES
"src/*.h"
"src/*.cpp")
# Package project with CPACK
SET(CPACK_GENERATOR "ZIP")
SET(CPACK_PACKAGE_NAME "Elixir Engine")
include(CPack)
# application icon
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/appicon.rc")
# creating executable
add_executable(${PROJECT_NAME}
${SOURCE_FILES}
thirdparty/glad/glad.c
${APP_ICON_RESOURCE_WINDOWS}
)
if(WIN32)
target_link_libraries(
${PROJECT_NAME}
glfw
Vulkan::Vulkan
d3d12
OpenGL::GL
lua_lib
imgui
TracyClient
${FMOD_LIBRARY}
${FREETYPE_LIBRARY}
)
else()
target_link_libraries(
${PROJECT_NAME}
glfw
Vulkan::Vulkan
OpenGL::GL
lua_lib
imgui
TracyClient
${FMOD_LIBRARY}
)
endif()
# defining final executable name
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "Elixir Engine")
# pre-build stuff (shader compilation and asset copying to binary folder)
add_custom_target(pre_build
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/pre-build.cmake
)
add_dependencies(${PROJECT_NAME} pre_build)
# TODO: Use rcedit after cmake build to change windows executable details
# TODO: Package project with CPACK