This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2024CG-project-render/CMakeLists.txt
github-classroom[bot] cd5209c3f2
Initial commit
2024-11-15 09:32:00 +00:00

51 lines
No EOL
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.0)
project(gpgpu)
set(CMAKE_CXX_STANDARD 11)
# Add OpenGL and OpenCL
find_package(OpenCL REQUIRED)
find_package(OpenGL REQUIRED)
# Add Glad
add_library(glad src/glad.c)
include_directories(include)
# Add GLFW as a submodule (since it has its own CMake files)
add_subdirectory(lib/glfw)
include_directories(lib/glfw/include)
# Define the paths to the source files
set(APP_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/GpuParticleSystem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/GpuPerlinNoise.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/GpuSimpleAdd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/CL_Helpers.cpp
)
# Define the paths to the cl files
set(APP_KERNELS
${CMAKE_CURRENT_SOURCE_DIR}/src/Addition.cl
${CMAKE_CURRENT_SOURCE_DIR}/src/PerlinNoise.cl
${CMAKE_CURRENT_SOURCE_DIR}/src/ParticleSystem.cl
)
# Give them a name
source_group( "sources" FILES ${APP_SOURCES} )
source_group( "shaders" FILES ${APP_KERNELS} )
# Use the source files for the project
add_executable(${PROJECT_NAME} ${APP_SOURCES} ${APP_KERNELS})
# Link libraries
target_link_libraries(${PROJECT_NAME} OpenCL::OpenCL OpenGL::GL glfw glad)
# Set the startup project in Visual Studio
if(MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
endif()
# Define the string "CMAKELISTS_SOURCE_DIR", which is used in the .cpp files to more easily find the shader files
target_compile_definitions(${PROJECT_NAME} PUBLIC CMAKELISTS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")