59 lines
2.7 KiB
CMake
59 lines
2.7 KiB
CMake
project(opengl-playground)
|
|
|
|
#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
find_package(glm REQUIRED)
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(EPOXY REQUIRED epoxy)
|
|
pkg_check_modules(SDL2 REQUIRED sdl2)
|
|
pkg_check_modules(ASSIMP REQUIRED assimp)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
#find_package(OpenCL REQUIRED)
|
|
|
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/examples" "${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui" ${EPOXY_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
|
|
|
|
|
|
configure_file("shaders/2d-passthrough-vertex.glsl" "shaders/2d-passthrough-vertex.glsl" COPYONLY)
|
|
configure_file("shaders/fixed-red-fragment.glsl" "shaders/fixed-red-fragment.glsl" COPYONLY)
|
|
configure_file("shaders/triangle-gen-geometry.glsl" "shaders/triangle-gen-geometry.glsl" COPYONLY)
|
|
configure_file("shaders/triangle-gen-zoomed-geometry.glsl" "shaders/triangle-gen-zoomed-geometry.glsl" COPYONLY)
|
|
configure_file("shaders/textured-rectangle-vertex.glsl" "shaders/textured-rectangle-vertex.glsl" COPYONLY)
|
|
configure_file("shaders/textured-rectangle-fragment.glsl" "shaders/textured-rectangle-fragment.glsl" COPYONLY)
|
|
configure_file("shaders/2d-zoom-translate-vertex.glsl" "shaders/2d-zoom-translate-vertex.glsl" COPYONLY)
|
|
|
|
|
|
configure_file("shaders/mesh-vertex.glsl" "shaders/mesh-vertex.glsl" COPYONLY)
|
|
configure_file("shaders/mesh-fragment.glsl" "shaders/mesh-fragment.glsl" COPYONLY)
|
|
|
|
configure_file("models/coordinate-system/coordsys.obj" "coordinate-system/coordsys.obj" COPYONLY)
|
|
configure_file("models/coordinate-system/coordsys.mtl" "coordinate-system/coordsys.mtl" COPYONLY)
|
|
|
|
|
|
set(IMGUI_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/imgui.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/imgui_draw.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/imgui_demo.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/imgui_widgets.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/misc/cpp/imgui_stdlib.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/examples/imgui_impl_sdl.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/imgui-submodule/imgui/examples/imgui_impl_opengl3.cpp"
|
|
)
|
|
|
|
aux_source_directory("src" SOURCES)
|
|
add_compile_options(-Wall)
|
|
|
|
add_executable(${PROJECT_NAME} ${SOURCES} ${IMGUI_SOURCES})
|
|
target_link_libraries(${PROJECT_NAME} m pthread ${EPOXY_LIBRARIES} ${SDL2_LIBRARIES} ${ASSIMP_LIBRARIES} glm)
|
|
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
|
|
|
target_precompile_headers(${PROJECT_NAME}
|
|
PUBLIC
|
|
"$<$<COMPILE_LANGUAGE:CXX>:stb/stb_image.h>"
|
|
"$<$<COMPILE_LANGUAGE:CXX>:glm/glm.hpp>"
|
|
PRIVATE
|
|
)
|