Browse Source

WIP Windows background reading

master
Macoy Madson 9 months ago
parent
commit
360ef19091
  1. 2
      Build.sh
  2. 23
      Build_Mingw.sh
  3. 20
      src/AutoColor.cake
  4. 22
      src/Config_Mingw.cake

2
Build.sh

@ -9,7 +9,7 @@ cd $CAKELISP_DIR
cd ../..
echo "\n\nFile Helper\n\n"
echo "\n\nAuto color\n\n"
CAKELISP=./Dependencies/cakelisp/bin/cakelisp

23
Build_Mingw.sh

@ -0,0 +1,23 @@
#!/bin/sh
CAKELISP_DIR=Dependencies/cakelisp
# Build Cakelisp itself
echo "\n\nCakelisp\n\n"
cd $CAKELISP_DIR
./Build.sh || exit $?
cd ../..
echo "\n\nAuto Color\n\n"
CAKELISP=./Dependencies/cakelisp/bin/cakelisp
# We can't run the full app yet until I set up SDL to build under Mingw
$CAKELISP --verbose-processes \
src/Config_Mingw.cake \
src/AutoColorCLI.cake || exit $?
rsync /usr/lib/gcc/x86_64-w64-mingw32/9.3-win32/libgcc_s_seh-1.dll .
wine AutoColor.exe

20
src/AutoColor.cake

@ -2,6 +2,7 @@
&comptime-only "CHelpers.cake")
(c-import "<stdio.h>" ;; fprintf, strncmp
"<stdlib.h>" ;; qsort
"<string.h>" ;; memcmp
"<math.h>") ;; sqrtf
;;
@ -40,7 +41,24 @@
(return null))
(set background (strdup (+ background file-uri-prefix-length)))
(return background))))
(return background)))
('Windows
(c-preprocessor-define WIN32_LEAN_AND_MEAN)
(c-import "windows.h")
(defun-local auto-color-get-current-background-filename (error-string (* (* (const char)))
&return (* (const char)))
(set (deref error-string) "Unable to read background: platform not supported")
(var wallpaper-path ([] 2048 char) (array 0))
(var buffer-size DWORD (sizeof wallpaper-path))
(var result DWORD
(RegGetValueA HKEY_CURRENT_USER "Control Panel\\Desktop" "WallPaper" RRF_RT_REG_SZ
null wallpaper-path (addr buffer-size)))
(unless (= result ERROR_SUCCESS)
(set (deref error-string) "Could not get value from registry")
(return null))
(return null))))
;;
;; Image data

22
src/Config_Mingw.cake

@ -0,0 +1,22 @@
(skip-build)
(set-cakelisp-option cakelisp-src-dir "Dependencies/cakelisp/src")
(add-cakelisp-search-directory "Dependencies/gamelib/src")
(add-cakelisp-search-directory "Dependencies/cakelisp/runtime")
(add-cakelisp-search-directory "src")
(comptime-define-symbol 'Windows)
;; TODO: Remove. These are only to ease testing via cross-compilation
(set-cakelisp-option build-time-compiler "/usr/bin/x86_64-w64-mingw32-g++")
(set-cakelisp-option build-time-compile-arguments
"-g" "-c" 'source-input "-o" 'object-output
'include-search-dirs 'additional-options)
(set-cakelisp-option build-time-linker "/usr/bin/x86_64-w64-mingw32-g++")
(set-cakelisp-option build-time-link-arguments
"-o" 'executable-output 'object-input)
;; Use separate build configuration in case other things build files from src/
(add-build-config-label "CrossCompile_Windows")
(set-cakelisp-option executable-output "AutoColor.exe")
Loading…
Cancel
Save