Browse Source

Build SDL in cache rather than dirty the repo

master
Macoy Madson 9 months ago
parent
commit
f697d189cd
  1. 30
      src/SDL.cake

30
src/SDL.cake

@ -220,7 +220,7 @@
Note that you can also build SDL manually. This can be useful if you are porting to a new platform
and do not want to try to automate it yet.\n
The build step will automatically detect your build, as long as it is installed to
Dependencies/SDL/buildSDLBuild/[include | lib].\n
cakelisp_cache/SDLInstallDir/[include | lib].\n
See http://wiki.libsdl.org/Installation for how to build manually.\n"
failure-message))
@ -261,16 +261,16 @@ Note that you can also build SDL manually. This can be useful if you are porting
('Unix
;; Already built?
;; We could enhance this by checking for modifications, but that's pretty rare
(when (and (fileExists "Dependencies/SDL/buildSDLBuild/include/SDL2/SDL.h")
(fileExists "Dependencies/SDL/buildSDLBuild/lib/libSDL2.a"))
(when (and (fileExists "cakelisp_cache/SDLInstallDir/include/SDL2/SDL.h")
(fileExists "cakelisp_cache/SDLInstallDir/lib/libSDL2.a"))
(return true))
(Log "SDL: Building via Configure and Make\n")
(var sdl-working-dir (* (const char)) "Dependencies/SDL/build")
(var sdl-working-dir (* (const char)) "cakelisp_cache/SDLBuildDir")
(makeDirectory sdl-working-dir)
(var sdl-output-dir (* (const char)) "Dependencies/SDL/buildSDLBuild")
(var sdl-output-dir (* (const char)) "cakelisp_cache/SDLInstallDir")
(makeDirectory sdl-output-dir)
(var configure-output-prefix ([] MAX_PATH_LENGTH char) (array 0))
@ -286,13 +286,13 @@ Note that you can also build SDL manually. This can be useful if you are porting
(free (type-cast absolute-output-path (* void))))
(run-process-sequential-or
("sh" "../configure" configure-output-prefix :in-directory sdl-working-dir)
("sh" "../../Dependencies/SDL/configure" configure-output-prefix :in-directory sdl-working-dir)
(build-sdl-on-failure
"failed at SDL configure step. This requires a sh/bash-style shell to execute.")
(return false))
(run-process-sequential-or
("make" :in-directory sdl-working-dir)
("make" "--jobs=8" :in-directory sdl-working-dir)
(build-sdl-on-failure "failed at SDL make. This tool requires Makefile support.")
(return false))
@ -303,12 +303,12 @@ Note that you can also build SDL manually. This can be useful if you are porting
(return false))
;; One final to check to ensure everything's good to go
(unless (and (fileExists "Dependencies/SDL/buildSDLBuild/include/SDL2/SDL.h")
(fileExists "Dependencies/SDL/buildSDLBuild/lib/libSDL2.a"))
(unless (and (fileExists "cakelisp_cache/SDLInstallDir/include/SDL2/SDL.h")
(fileExists "cakelisp_cache/SDLInstallDir/lib/libSDL2.a"))
(build-sdl-on-failure
"error: SDL build sequence completed, but files are not where expected. Is there an issue
with the configuration?\nFiles are expected in:\n\tDependencies/SDL/buildSDLBuild/include
\n\tDependencies/SDL/buildSDLBuild/lib")
with the configuration?\nFiles are expected in:\n\tcakelisp_cache/SDLInstallDir/include
\n\tcakelisp_cache/SDLInstallDir/lib")
(return false)))
(true
(comptime-error "need to define platform, e.g. (comptime-define-symbol 'Unix), or your platform
@ -325,7 +325,7 @@ Note that you can also build SDL manually. This can be useful if you are porting
('Windows
(add-c-search-directory-module "Dependencies/SDL/include"))
('Unix
(add-c-search-directory-module "Dependencies/SDL/buildSDLBuild/include/SDL2"))))
(add-c-search-directory-module "cakelisp_cache/SDLInstallDir/include/SDL2"))))
;; TODO: Add debug version
(comptime-cond
@ -334,13 +334,13 @@ Note that you can also build SDL manually. This can be useful if you are porting
(add-static-link-objects "SDL2main.lib" "SDL2.lib"))
;; (add-library-runtime-search-directory "Dependencies/SDL/VisualC/x64/Debug" "."))
;; ('Unix ;; Dynamic link
;; (add-library-search-directory "Dependencies/SDL/buildSDLBuild/lib")
;; (add-library-search-directory "cakelisp_cache/SDLInstallDir/lib")
;; (add-library-dependency "SDL2")
;; ;; TODO: Relative path is going to break for sure
;; (add-library-runtime-search-directory "Dependencies/SDL/buildSDLBuild/lib" "."))
;; (add-library-runtime-search-directory "cakelisp_cache/SDLInstallDir/lib" "."))
('Unix ;; Static link
(add-compiler-link-options "-pthread")
(add-static-link-objects "Dependencies/SDL/buildSDLBuild/lib/libSDL2.a")))
(add-static-link-objects "cakelisp_cache/SDLInstallDir/lib/libSDL2.a")))
(comptime-cond
('Windows ;; DLLs need to be in the same directory as the executable

Loading…
Cancel
Save