Skip to content

Commit f401106

Browse files
Merge pull request #3 from Patitotective/devel
V2
2 parents c04eb71 + 648aafb commit f401106

12 files changed

Lines changed: 1136 additions & 714 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ jobs:
1616

1717
- name: Build
1818
run: |
19+
nimble install -d -y
1920
nimble buildapp
2021
2122
- name: Upload Artifacts
2223
uses: actions/upload-artifact@v3
2324
with:
2425
name: appimage-amd64
25-
path: ./*-*-*.AppImage
26+
path: ./*.AppImage
2627
if-no-files-found: error
2728

2829
windows:
@@ -32,10 +33,12 @@ jobs:
3233
- uses: iffy/install-nim@v4.1.1
3334

3435
- name: Build
35-
run: nimble buildr
36+
run: |
37+
nimble install -d -y
38+
nimble buildr
3639
- name: Upload Artifacts
3740
uses: actions/upload-artifact@v3
3841
with:
3942
name: win-amd64
40-
path: ./*-*-*.exe
43+
path: ./*.exe
4144
if-no-files-found: error

ImExample.nimble

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ backend = "cpp"
88
# Dependencies
99

1010
requires "nim >= 1.6.2"
11-
requires "kdl >= 1.0.0"
11+
requires "kdl >= 2.0.1"
1212
requires "nimgl >= 1.3.2"
1313
requires "stb_image >= 2.5"
14-
requires "imstyle >= 1.0.0"
15-
requires "openurl >= 2.0.3"
14+
requires "imstyle >= 3.0.0"
15+
requires "openurl >= 2.0.4"
1616
requires "tinydialogs >= 1.0.0"
17+
requires "constructor >= 1.2.0"
1718

1819
import std/[strformat, options]
19-
import src/types
20-
import kdl
20+
import src/configtype
2121

22-
const configPath {.strdefine.} = "config.kdl"
23-
const config = parseKdlFile(configPath).decode(Config)
22+
const config = Config()
2423

2524
version = config.version
2625
namedBin["main"] = config.name
@@ -29,13 +28,12 @@ let arch = getEnv("ARCH", "amd64")
2928
let outPath = getEnv("OUTPATH", toExe &"{config.name}-{version}-{arch}")
3029
let flags = getEnv("FLAGS")
3130

32-
let args = &"--app:gui --out:{outPath} --cpu:{arch} -d:configPath={configPath} {flags}"
31+
let args = &"--app:gui --out:{outPath} --cpu:{arch} {flags}"
3332

3433
task buildr, "Build the application for release":
35-
exec "nimble install -d -y"
36-
exec &"nim cpp -d:release {args} main.nim"
34+
exec &"nimble c -d:release {args} main.nim"
3735

38-
const desktop = """
36+
const desktopTemplate = """
3937
[Desktop Entry]
4038
Name=$name
4139
Exec=AppRun
@@ -53,28 +51,27 @@ task buildapp, "Build the AppImage":
5351
let appimagePath = &"{config.name}-{version}-{arch}.AppImage"
5452

5553
# Compile applicaiton executable
56-
if not existsDir("AppDir"): mkDir("AppDir")
57-
exec "nimble install -d -y"
58-
exec &"nim cpp -d:release -d:appimage {args} --out:AppDir/AppRun main.nim"
54+
if not dirExists("AppDir"): mkDir("AppDir")
55+
exec &"nimble c -d:release -d:appimage {args} --out:AppDir/AppRun main.nim"
5956

6057
# Make desktop file
6158
writeFile(
62-
&"AppDir/{config.name}.desktop",
63-
desktop % [
64-
"name", config.name,
65-
"categories", config.categories.join(";"),
66-
"version", config.version,
67-
"comment", config.comment,
59+
&"AppDir/{config.name}.desktop",
60+
desktopTemplate % [
61+
"name", config.name,
62+
"categories", config.categories.join(";"),
63+
"version", config.version,
64+
"comment", config.comment,
6865
"arch", arch
6966
]
7067
)
7168
# Copy icons
7269
cpFile(config.iconPath, "AppDir/.DirIcon")
7370
cpFile(config.svgIconPath, &"AppDir/{config.name}.svg")
7471

75-
if config.appstreamPath.isSome:
72+
if config.appstreamPath.len > 0:
7673
mkDir("AppDir/usr/share/metainfo")
77-
cpFile(config.appstreamPath.get, &"AppDir/usr/share/metainfo/{config.name}.appdata.xml")
74+
cpFile(config.appstreamPath, &"AppDir/usr/share/metainfo/{config.name}.appdata.xml")
7875

7976
# Get appimagetool
8077
var appimagetoolPath = "appimagetool"
@@ -83,15 +80,15 @@ task buildapp, "Build the AppImage":
8380
exec(&"{appimagetoolPath} --help")
8481
except OSError:
8582
appimagetoolPath = "./appimagetool-x86_64.AppImage"
86-
if not existsFile(appimagetoolPath):
83+
if not fileExists(appimagetoolPath):
8784
echo &"Downloading {appimagetoolPath}"
88-
exec &"wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O ", appimagetoolPath
85+
exec &"wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O {appimagetoolPath}"
8986
exec &"chmod +x {appimagetoolPath}"
9087

9188
# Actually use appimagetool to build the AppImage
9289
if config.ghRepo.isSome:
9390
echo "Building updateable AppImage"
94-
exec &"{appimagetoolPath} -u \"gh-releases-zsync|{config.ghRepo.get[0]}|{config.ghRepo.get[0]}|latest|{config.name}-*-{arch}.AppImage.zsync\" AppDir {appimagePath}"
91+
exec &"{appimagetoolPath} -u \"gh-releases-zsync|{config.ghRepo.get.user}|{config.ghRepo.get.repo}|latest|{config.name}-*-{arch}.AppImage.zsync\" AppDir {appimagePath}"
9592
else:
9693
echo &"ghRepo not defined. Skipping updateable AppImage"
9794
exec &"{appimagetoolPath} AppDir {appimagePath}"

0 commit comments

Comments
 (0)