Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ blends/**
*3d-game-shaders-for-beginners*
!blends/*
!blends/mill-scene/mill-scene-low-poly-backup.blend
demonstration/build/*
*.exe
22 changes: 22 additions & 0 deletions demonstration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.10)
project(3DGameShadersForBeginners LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED true)

add_executable(3d-game-shaders src/main.cxx)
find_package(Python3 REQUIRED)
set(PandaPath "C:\\Panda3D-1.10.15-x64" CACHE STRING "Path to the root of panda sdk")
list(APPEND LIBRARIES
libp3framework
libpanda
libpandafx
libpandaexpress
libpandaphysics
libp3dtoolconfig
libp3dtool
)
target_link_directories(3d-game-shaders PRIVATE "${PandaPath}/lib")
target_include_directories(3d-game-shaders PRIVATE "${PandaPath}/include")
target_link_libraries(3d-game-shaders PRIVATE ${LIBRARIES})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
65 changes: 65 additions & 0 deletions demonstration/build-for-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
function BuildExe() {
# Configure CMake
cmake . -B build
# Build the file in release mode
$result = (cmake --build build --config Release )
Write-Output $result
if($result -eq 0) {
Write-Error "An error occurred when building the project file! Check logs for more details."
}
return $result
}

function CopyExe() {
# Copies the exe file to the workspace root
Copy-Item "./build/Release/3d-game-shaders.exe" "./"
}

$changeCache = (Test-Path "build/cache.json") ? (Get-Content "build/cache.json" | ConvertFrom-Json -AsHashTable) : @{}

function GetFileHash {
param(
$file
)
return (Get-FileHash "$file" -Algorithm SHA256).Hash
}

function SetFileHash {
param (
$file
)
$changeCache["$file"] = GetFileHash($file)
}

function CheckDiff {
param ($file)
return ((GetFileHash($file)) -eq ($changeCache["$file"]))
}

function MakeCache {
if(Test-Path "build/cache.json") {
Clear-Content "build/cache.json"
}
SetFileHash("CMakeLists.txt")
SetFileHash("src/main.cxx")
Set-Content -Path "build/cache.json" -Value ($changeCache | ConvertTo-Json)
}

$firstTime = 0

# Create a build directory
if(-not(Test-Path ./build)) {
mkdir ./build > $null
$firstTime = 1
}

# If CMakeLists.txt or main.cxx is changed, rebuild the executable and copy it to the root directory
if($firstTime -or -not(CheckDiff("src/main.cxx") -and CheckDiff("CMakeLists.txt"))) {
Write-Output "Building exe file..."
if(buildExe -eq 0) {
Write-Output "Copying exe file..."
copyExe
MakeCache
}
Write-Output "Build script finished executing!"
}
1 change: 0 additions & 1 deletion demonstration/src/main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

#include <thread>
#include <unistd.h>
#include <random>
#include <string>
#include <chrono>
Expand Down