added files
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(Engine CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
# ---------------------------------------------------------------------------
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(glfw3 3.3 REQUIRED)
|
||||
find_package(glm REQUIRED)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Engine demo executable
|
||||
# ---------------------------------------------------------------------------
|
||||
file(GLOB ENGINE_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp)
|
||||
|
||||
add_executable(engine_demo ${ENGINE_SOURCES})
|
||||
|
||||
target_include_directories(engine_demo PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
target_link_libraries(engine_demo PRIVATE
|
||||
glfw
|
||||
OpenGL::GL
|
||||
glm::glm
|
||||
)
|
||||
|
||||
# Baked-in fallback path so the binary still finds its shaders if it's run
|
||||
# from somewhere other than the build directory.
|
||||
target_compile_definitions(engine_demo PRIVATE
|
||||
ENGINE_ASSET_DIR="${CMAKE_SOURCE_DIR}/assets"
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(engine_demo PRIVATE dl pthread)
|
||||
endif()
|
||||
|
||||
# Keep a copy of assets next to the built executable so `./engine_demo`
|
||||
# works directly from the build directory.
|
||||
add_custom_command(TARGET engine_demo POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/assets
|
||||
$<TARGET_FILE_DIR:engine_demo>/assets
|
||||
)
|
||||
Reference in New Issue
Block a user