-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (55 loc) · 3.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
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.15)
project(VulkanEngine VERSION 1.0 DESCRIPTION "Vulkan Graphics Engine" LANGUAGES CXX)
set (CMAKE_CXX_STANDARD 17)
#Allow to build with lower than c++17 if not avaliable
set (CMAKE_CXX_STANDARD_REQUIRED NO)
#Allow gcc extensions that isnt in c++ standard but are there to help.
set (CMAKE_CXX_EXTENSIONS OFF)
add_executable(${PROJECT_NAME} VulkanSource/main.cpp)
set (OSByte 32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set (OSByte 64)
message(STATUS "64 Bit")
else()
message(STATUS "32 Bit")
endif()
#find_package(Vulkan REQUIRED)
#message(STATUS ${VULKAN_INCLUDE_DIR})
#include_directories(${VULKAN_INCLUDE_DIR})
include_directories(C:/VulkanSDK/1.3.280.0/Include)
include_directories(${CMAKE_SOURCE_DIR}/Libraries/assimp)
add_library(assimp ${CMAKE_SOURCE_DIR}/Libraries/assimp/assimp-vc143-mtd.dll)
set_target_properties(assimp PROPERTIES LINKER_LANGUAGE CXX)
add_subdirectory(${CMAKE_SOURCE_DIR}/Libraries/glfw)
include_directories(${CMAKE_SOURCE_DIR}/Libraries/glfw/include)
add_subdirectory(${CMAKE_SOURCE_DIR}/Libraries/glm)
add_library(stbImage ${CMAKE_SOURCE_DIR}/Libraries/stb_image/stb_image.cpp)
include_directories(${CMAKE_SOURCE_DIR}/Libraries/stb_image)
include_directories(${CMAKE_SOURCE_DIR}/Libraries/imgui)
add_library(imgui)
target_sources(imgui PRIVATE
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui.cpp
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui_demo.cpp
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui_draw.cpp
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui_impl_glfw.cpp
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui_impl_opengl3.cpp
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui_tables.cpp
${CMAKE_SOURCE_DIR}/Libraries/imgui/imgui_widgets.cpp
)
include_directories(${CMAKE_SOURCE_DIR}/Libraries/glew/include)
add_library(glew ${CMAKE_SOURCE_DIR}/Libraries/glew/lib/Release/x64/glew32.lib ${CMAKE_SOURCE_DIR}/Libraries/glew/lib/Release/x64/glew32s.lib)
set_target_properties(glew PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${PROJECT_NAME} glew imgui stbImage glm assimp glfw C:/VulkanSDK/1.3.280.0/Lib/vulkan-1.lib)
set (OutputDirectory ${CMAKE_SOURCE_DIR}/bin/${CMAKE_SYSTEM_NAME}${OSByte}/${CMAKE_BUILD_TYPE})
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OutputDirectory}/Libraries)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OutputDirectory})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OutputDirectory})
#SHARED = make it a lib to share / dll (link at runtime), otherwise the default if unspecified is static and it will make something similar to a dll but the .exe will need to be updated instead of changing the dll.
#add_library(console SHARED console.cpp)
#target_link_libraries(${PROJECT_NAME} console)
#this is some package manager bs that the tutorial used.
#find_package(SDL2 REQUIRED)
#include_directories(${SDL2_INCLUDE_DIRS})
#target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES})
# Somehow the below will force the x64 and for it to correctly setup and build with gcc? on visual studio code, hate that the tutorial doesnt actually explain what vscode is doing just that its a magic button that makes things work.
# -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:/ProgramData\mingw64\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\ProgramData\mingw64\mingw64\bin\g++.exe --no-warn-unused-cli -SD:/PersonalProjects/CMakeBuild -Bd:/PersonalProjects/CMakeBuild/build -G "MinGW Makefiles"