Switch to using vcpkg for dependencies
This commit is contained in:
parent
83a8d7f444
commit
a1ba01324d
|
@ -7,6 +7,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
# Define output directories for different configurations
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Ensure vcpkg toolchain file is used
|
||||
# This is set through the CMakePresets.json or command line, so not directly here
|
||||
|
||||
# Find packages using vcpkg
|
||||
find_package(GLEW CONFIG REQUIRED)
|
||||
find_package(glfw3 CONFIG REQUIRED)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}")
|
||||
|
||||
|
@ -17,7 +24,7 @@ file(GLOB_RECURSE SOURCES
|
|||
|
||||
# Add header files
|
||||
file(GLOB_RECURSE HEADERS
|
||||
"${CMAKE_SOURCE}/headers/*.h"
|
||||
"${CMAKE_SOURCE_DIR}/headers/*.h"
|
||||
)
|
||||
|
||||
# Add shader files
|
||||
|
@ -25,23 +32,14 @@ file(GLOB SHADERS
|
|||
"${CMAKE_SOURCE_DIR}/shaders/*.glsl"
|
||||
)
|
||||
|
||||
# Include directories
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/include # Third-party headers
|
||||
${CMAKE_SOURCE_DIR}/headers # Project headers
|
||||
)
|
||||
|
||||
# Link directories for libraries
|
||||
link_directories(${CMAKE_SOURCE_DIR}/lib)
|
||||
|
||||
# Add the executable
|
||||
add_executable(TerraVisor ${SOURCES} ${HEADERS})
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(TerraVisor glew32 glfw3 opengl32)
|
||||
# Include directories
|
||||
include_directories(${CMAKE_SOURCE_DIR}/headers)
|
||||
|
||||
# Include directories for the target
|
||||
target_include_directories(TerraVisor PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/GL ${CMAKE_SOURCE_DIR}/include/GLFW ${CMAKE_SOURCE_DIR}/headers)
|
||||
# Link libraries using vcpkg
|
||||
target_link_libraries(TerraVisor PRIVATE GLEW::GLEW glfw opengl32)
|
||||
|
||||
# Custom target for shaders
|
||||
add_custom_target(copy_shaders ALL
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
"binaryDir": "${sourceDir}/build/debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES"
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
|
||||
"CMAKE_TOOLCHAIN_FILE": "C:/users/jmchr/vcpkg/scripts/buildsystems/vcpkg.cmake",
|
||||
"VCPKG_TARGET_TRIPLET": "x64-windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -19,7 +21,9 @@
|
|||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_TOOLCHAIN_FILE": "C:/users/jmchr/vcpkg/scripts/buildsystems/vcpkg.cmake",
|
||||
"VCPKG_TARGET_TRIPLET": "x64-windows"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue