-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_windows.ps1
More file actions
69 lines (60 loc) · 2.25 KB
/
install_windows.ps1
File metadata and controls
69 lines (60 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Stop the script on any error
$ErrorActionPreference = "Stop"
# Colors for success, warning, and error
$GREEN = "`e[32m"
$YELLOW = "`e[33m"
$RED = "`e[31m"
$NC = "`e[0m"
Write-Host "${YELLOW}=== Starting installation and build on Windows ===${NC}"
# Step 1: Check for Conan
Write-Host "${YELLOW}Checking for Conan...${NC}"
if (-not (Get-Command "conan" -ErrorAction SilentlyContinue)) {
Write-Host "${RED}ERROR: Conan is not installed. Please install it and try again.${NC}"
exit 1
} else {
Write-Host "${GREEN}SUCCESS: Conan is installed.${NC}"
}
# Step 2: Check for CMake
Write-Host "${YELLOW}Checking for CMake...${NC}"
if (-not (Get-Command "cmake" -ErrorAction SilentlyContinue)) {
Write-Host "${RED}ERROR: CMake is not installed. Please install it and try again.${NC}"
exit 1
} else {
Write-Host "${GREEN}SUCCESS: CMake is installed.${NC}"
}
# Step 3: Create the build directory
$BUILD_DIR = "build"
Write-Host "${YELLOW}Creating the build directory...${NC}"
if (-not (Test-Path $BUILD_DIR)) {
New-Item -ItemType Directory -Path $BUILD_DIR | Out-Null
Write-Host "${GREEN}SUCCESS: Build directory created.${NC}"
} else {
Write-Host "${GREEN}SUCCESS: Build directory already exists.${NC}"
}
# Step 4: Install dependencies with Conan
Write-Host "${YELLOW}Installing dependencies with Conan...${NC}"
if (conan install . --output-folder=$BUILD_DIR --build=missing) {
Write-Host "${GREEN}SUCCESS: Dependencies installed successfully.${NC}"
} else {
Write-Host "${RED}ERROR: Conan failed to install dependencies.${NC}"
exit 1
}
# Step 5: Configure the project with CMake
Write-Host "${YELLOW}Configuring the project with CMake...${NC}"
cd $BUILD_DIR
if (cmake .. -DCMAKE_TOOLCHAIN_FILE="build/Release/generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release) {
Write-Host "${GREEN}SUCCESS: CMake configuration completed.${NC}"
} else {
Write-Host "${RED}ERROR: CMake configuration failed.${NC}"
exit 1
}
# Step 6: Build the project
Write-Host "${YELLOW}Building the project...${NC}"
if (cmake --build .) {
Write-Host "${GREEN}SUCCESS: Project built successfully.${NC}"
} else {
Write-Host "${RED}ERROR: Build failed.${NC}"
exit 1
}
Write-Host "${GREEN}=== Installation and build completed successfully! ===${NC}"
exit 0