1
0

54 lines
2.2 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.10)
2019-12-16 19:12:24 +01:00
project(Informatikprojekt C)
set(CMAKE_C_STANDARD 11)
2020-03-18 12:29:08 +01:00
set(PROJECT_SOURCES particlesystem.h particlesystem.c utils.h utils.c)
set(PROJECT_SOURCES_OPENGL ${PROJECT_SOURCES} initOpenGL.h initOpenGL.c utils.h glad/src/glad.c)
2020-03-31 15:22:15 +02:00
set(PROJECT_SOURCES_VULKAN ${PROJECT_SOURCES} initVulkan.h initVulkan.c)
2019-12-16 19:12:24 +01:00
2020-03-16 21:21:04 +01:00
add_executable(Informatikprojekt cpuMain.c ${PROJECT_SOURCES_OPENGL})
add_executable(Informatikprojekt_OpenGL openglMain.c ${PROJECT_SOURCES_OPENGL})
2020-03-31 15:22:15 +02:00
add_executable(Informatikprojekt_Vulkan vulkanMain.c ${PROJECT_SOURCES_VULKAN})
2020-03-18 12:53:11 +01:00
# Copy shader file to output directory
2020-03-18 14:07:11 +01:00
## OpenGL
configure_file(./shaders/opengl/ComputeShader.glsl ./opengl/ComputeShader.glsl COPYONLY)
configure_file(./shaders/opengl/VertexShader.glsl ./opengl/VertexShader.glsl COPYONLY)
configure_file(./shaders/opengl/FragmentShader.glsl ./opengl/FragmentShader.glsl COPYONLY)
## Vulkan
configure_file(./shaders/vulkan/ComputeShader.comp ./vulkan/ComputeShader.comp COPYONLY)
configure_file("shaders/vulkan/VertexShader.vert" ./vulkan/VertexShader.vert COPYONLY)
configure_file("shaders/vulkan/FragmentShader.frag" ./vulkan/FragmentShader.frag COPYONLY)
2021-11-26 17:07:18 +01:00
configure_file(shaders/vulkan/runCompiler.sh ./vulkan/runCompiler.sh COPYONLY)
execute_process(COMMAND sh runCompiler.sh WORKING_DIRECTORY ./vulkan)
2020-03-18 14:07:11 +01:00
# Vulkan
IF (NOT DEFINED WINDOWS)
find_package(Vulkan REQUIRED)
target_include_directories(${PROJECT_NAME} PUBLIC ${Vulkan_INCLUDE_DIRS})
ENDIF()
2019-12-18 18:18:55 +01:00
# glad
set(OpenGL_GL_PREFERENCE GLVND)
2021-11-26 17:07:18 +01:00
find_package(OpenGL REQUIRED)
include_directories(./glad/include)
2019-12-20 14:24:52 +01:00
# glfw for windows
IF (DEFINED WINDOWS)
include_directories(./glfw/include)
ENDIF()
# Linking
IF (DEFINED WINDOWS) # glfw windowsbinaries are provided by project
target_link_libraries(Informatikprojekt ./glfw/lib-mingw-w64/libglfw3.a)
target_link_libraries(Informatikprojekt_OpenGL ./glfw/lib-mingw-w64/libglfw3.a)
target_link_libraries(Informatikprojekt_Vulkan Vulkan::Vulkan ./glfw/lib-mingw-w64/libglfw3.a)
ELSE() # libglfw must be provided (e.g. with apt)
target_link_libraries(Informatikprojekt OpenGL::GL glfw)
target_link_libraries(Informatikprojekt_OpenGL OpenGL::GL glfw)
target_link_libraries(Informatikprojekt_Vulkan Vulkan::Vulkan glfw)
ENDIF()
2021-11-26 17:07:18 +01:00
2019-12-20 14:24:52 +01:00