Browse Source

WIP GameLib tests on Windows

task-system-completables
Macoy Madson 2 years ago
parent
commit
60f37d9f6e
  1. 2
      src/DataBundle.cake
  2. 97
      test/Build.bat
  3. 7
      test/src/Config_Windows.cake
  4. 12
      test/src/Config_WindowsBootstrap.cake

2
src/DataBundle.cake

@ -1,7 +1,7 @@
;; DataBundle.cake: Bundle data into the executable to avoid loose files
;; Important caveat: The bundled data is not null-terminated, so don't just go printing it as a
;; string or you'll get garbage at the end
(import "CHelpers.cake" "CppHelpers.cake" "ComptimeHelpers.cake")
(import "CHelpers.cake" "CppHelpers.cake" "ComptimeHelpers.cake" "BuildTools.cake")
;; I don't want to expose this until I've determined a clean way to do this.
(defgenerator declare-extern (statement-token (arg-index array))

97
test/Build.bat

@ -0,0 +1,97 @@
echo off
if not exist "bin" (
mkdir bin
)
rem TODO: Use Build.bat in cakelisp instead of copy-pasting
cd Dependencies/cakelisp
if not exist "bin" (
mkdir bin
)
rem Set environment variables. The user may need to adjust this path
rem See https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160#developer_command_file_locations
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
) else (
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
) else (
echo This script builds using MSVC.
echo You must download and install MSVC before it will work. Download it here:
echo https://visualstudio.microsoft.com/downloads/
echo Select workloads for C++ projects. Ensure you install the C++ developer tools.
echo If you're still seeing this, you may need to edit Build.bat to your vcvars path
echo Please see the following link:
echo https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160
goto fail
))
if not exist "bin\cakelisp_bootstrap.exe" (
goto manualBuild
) else (
goto bootstrapBuild
)
:manualBuild
CL.exe src/Tokenizer.cpp ^
src/Evaluator.cpp ^
src/Utilities.cpp ^
src/FileUtilities.cpp ^
src/Converters.cpp ^
src/Writer.cpp ^
src/Generators.cpp ^
src/GeneratorHelpers.cpp ^
src/RunProcess.cpp ^
src/OutputPreambles.cpp ^
src/DynamicLoader.cpp ^
src/ModuleManager.cpp ^
src/Logging.cpp ^
src/Metadata.cpp ^
src/Build.cpp ^
src/Main.cpp ^
/EHsc /MP /DWINDOWS /DCAKELISP_EXPORTING ^
/FS /Fe"bin\cakelisp_bootstrap" /Zi /Fd"bin\cakelisp_bootstrap.pdb" /DEBUG:FASTLINK
echo %ERRORLEVEL%
@if %ERRORLEVEL% == 0 (
echo Success building
rem Clean up working directory
del *.obj
goto bootstrapBuild
) else (
echo Error while building
goto fail
)
:bootstrapBuild
cd ../../
"Dependencies\cakelisp\bin\cakelisp_bootstrap.exe" --verbose-build-reasons src/Config_WindowsBootstrap.cake Dependencies/cakelisp/Bootstrap_MSVC.cake
@if %ERRORLEVEL% == 0 (
echo Success! Use bin\cakelisp.exe to build your programs
goto build_user
) else (
echo Error while bootstrapping cakelisp
goto fail
)
:build_user
rem "bin\cakelisp.exe" --execute --verbose-processes src/Config_Windows.cake src/GameLibTests.cake
"bin\cakelisp.exe" --execute --verbose-processes src/Config_Windows.cake src/Config_WindowsBootstrap.cake ../src/AutoTest.cake ../src/DataBundle.cake
@if %ERRORLEVEL% == 0 (
echo Success!
goto success
) else (
echo Error while building user program
goto fail
)
:fail
goto end
:success
goto end
:end
echo Done

7
test/src/Config_Windows.cake

@ -0,0 +1,7 @@
(comptime-define-symbol 'Windows)
;; Building from test/, need to go up one into gamelib (a bit unusual)
(add-cakelisp-search-directory "../src")
(add-cakelisp-search-directory "../../cakelisp/runtime")
;; Need to define this to not have to manually delete dependencies after testing is done
(comptime-define-symbol 'Dependencies-Clone-Only)

12
test/src/Config_WindowsBootstrap.cake

@ -0,0 +1,12 @@
(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")
;; For bootstrap build only
(add-c-search-directory-global "Dependencies/cakelisp/src")
(add-cakelisp-search-directory "Dependencies/cakelisp")
(add-cakelisp-search-directory "src")
(comptime-define-symbol 'Windows)
Loading…
Cancel
Save