Skip to content

Commit

Permalink
Started development of xp-apps v2
Browse files Browse the repository at this point in the history
Why: because I want to create my own package manager to easily download applications from this repository and I also want learn C++ (or not?)
  • Loading branch information
nixxoq committed May 11, 2024
0 parents commit ce687b7
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-debug-windows-win32.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Release Win32

on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development

workflow_dispatch:

jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ windows-2019 ]
arch:
- x86

steps:
- uses: actions/checkout@v3

- name: Building
shell: bash
env:
CXX: cl.exe
run: |
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A Win32 ..
cmake --build . --config Debug
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: "Debug"
path: '${{github.workspace}}/build/Debug'
35 changes: 35 additions & 0 deletions .github/workflows/build-debug-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Debug

on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development

workflow_dispatch:

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Building
shell: bash
env:
CXX: cl.exe
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Debug
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: "Debug"
path: '${{github.workspace}}/build/Debug'
41 changes: 41 additions & 0 deletions .github/workflows/build-release-windows-win32.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Release Win32

on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development

workflow_dispatch:

jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ windows-2019 ]
arch:
- x86

steps:
- uses: actions/checkout@v3

- name: Building
shell: bash
env:
CXX: cl.exe
run: |
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A Win32 ..
cmake --build . --config Release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: "Debug"
path: '${{github.workspace}}/build/Release'
35 changes: 35 additions & 0 deletions .github/workflows/build-release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Release

on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development

workflow_dispatch:

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Building
shell: bash
env:
CXX: cl.exe
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: "Release"
path: '${{github.workspace}}/build/Release'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
.idea/
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/i686-w64-mingw32/include"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"string": "cpp"
}
}
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.6)

set(CMAKE_CXX_STANDARD 17)

project(xp-apps VERSION 0.1.0)

add_library(source source/functions.h source/functions.cpp)

add_link_options(-static -static-libgcc -static-libstdc++)
add_executable(xp-apps main.cpp)
target_link_libraries(xp-apps source)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
12 changes: 12 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <iostream>
#include "source/functions.h"

int main(int, char **)
{
if (!isWindowsXP()) {
std::cout << "This program works only on Windows XP" << std::endl;
return 0;
}

// std::cout << isWindowsXP() << std::endl;
}
3 changes: 3 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.6)
project(Source)
add_executable(Source functions.h functions.cpp)
18 changes: 18 additions & 0 deletions source/functions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// functions.cpp
#include "functions.h"

bool isWindowsXP() {
OSVERSIONINFO osVersion = {0};
osVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

/*
5 . 1
↓ ↓
MajorVersion MinorVersion
*/

auto majorVersion = osVersion.dwMajorVersion;
auto minorVersion = osVersion.dwMinorVersion;

return (majorVersion == 5 && minorVersion == 1) || (majorVersion == 5 && minorVersion == 2);
}
11 changes: 11 additions & 0 deletions source/functions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// functions.h
#ifndef FUNCTIONS_H
#define FUNCTIONS_H

#include <iostream>
#include <string>
#include <windows.h>

bool isWindowsXP();

#endif // FUNCTIONS_H

0 comments on commit ce687b7

Please sign in to comment.