Skip to content

Commit

Permalink
Add Visual Studio build files
Browse files Browse the repository at this point in the history
  • Loading branch information
arozx committed Jan 24, 2025
1 parent 4b1b674 commit aac8d1b
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 13 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# build files
build/
cmake.db

#docs
docs/
Expand All @@ -22,3 +23,15 @@ profile_results.json
profiler_n_frames.json

heightmap_chunk*.bmp

# Vcpkg
vcpkg_installed/

# Visual Studio
.vs/voxel-eng/FileContentIndex
.vs/voxel-eng/v17/

.vs/CMake Overview
.vs/slnx.sqlite*

.vs/voxel-eng/copilot*
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "x64-Debug"
}
16 changes: 16 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"DevContainersInfoBarHidden": true,
"ActiveTargetSystem": "Local Machine",
"OutputFoldersPerTargetSystem": {
"Local Machine": [
"out\\build\\x64-Debug",
"out\\install\\x64-Debug",
"out\\build\\x64-Release",
"out\\install\\x64-Release"
],
"WSL: Arch": [
"out\\build\\x64-Debug",
"out\\install\\x64-Debug"
]
}
}
12 changes: 12 additions & 0 deletions .vs/launch.vs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "sandbox.exe",
"name": "sandbox.exe"
}
]
}
19 changes: 6 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)

if(WIN32)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(CMAKE_TOOLCHAIN_FILE "C:/Users/44782/vcpkg/scripts/buildsystems/vcpkg.cmake")
else()
include_directories(/usr/include)
link_directories(/usr/lib)
Expand Down Expand Up @@ -108,21 +108,14 @@ add_custom_command(TARGET sandbox POST_BUILD
${CMAKE_BINARY_DIR}/assets/scripts
)

add_custom_command(TARGET sandbox POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets $<TARGET_FILE_DIR:sandbox>/assets
)

# Enable precompiled headers - specify C++ explicitly
target_precompile_headers(voxel-engine
PRIVATE
$<INSTALL_INTERFACE:pch.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h>
)

# Force C++ compilation for PCH
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h
PROPERTIES
LANGUAGE CXX
)

# Ensure PCH is used for all C++ files
set_target_properties(voxel-engine PROPERTIES
COMPILE_FLAGS "-include pch.h"
)
27 changes: 27 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
}
]
}
14 changes: 14 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "4a9af5e5efcb24d0c8fcdf82dacf3b2b780b99f8",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}
12 changes: 12 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "voxel-engine",
"version": "1.0.0",
"dependencies": [
"glfw3",
"glm",
"stb",
"jsoncpp",
"lua",
"sol2"
]
}

0 comments on commit aac8d1b

Please sign in to comment.