Browse Source

All 3rd party dependencies now built by Cakelisp

* Removed extra BuildDependencies.sh because it's no longer needed!
* Build_Debug.sh will now build Cakelisp itself, keeping it up-to-date
in case you update or are iterating on it
* Update Cakelisp for run-process-sequential-or and comptime function
fix (building build-ogre and build-sdl is how the bug emerged)
* Ogre and Ogre's dependencies now built via run-process functions
* Updated Ogre because I thought it might have issues (I caused the
issues). It's good to be more up-to-date anyways
pitch-detection
Macoy Madson 1 month ago
parent
commit
613ec4d9a4
10 changed files with 166 additions and 77 deletions
  1. +0
    -38
      BuildDependencies_Debug.sh
  2. +7
    -1
      Build_Debug.sh
  3. +1
    -1
      Dependencies/cakelisp
  4. +1
    -1
      Dependencies/ogre-next
  5. +3
    -5
      ReadMe.org
  6. +0
    -1
      src/AutoTest.cake
  7. +137
    -10
      src/Ogre.cake
  8. +17
    -20
      src/SDL.cake
  9. BIN
      test/assets/Monkey.blend
  10. BIN
      test/data/Models/Suzanne.mesh

+ 0
- 38
BuildDependencies_Debug.sh View File

@ -1,38 +0,0 @@
#!/bin/sh
echo "Building Cakelisp..."
cd Dependencies/cakelisp && jam -j4 && cd ../
echo "done!"
# Now built by SDL.cake itself!
# http://wiki.libsdl.org/Installation
# echo "Building SDL"
# cd SDL
# mkdir -p build
# cd build
# # mkdir -p SDLBuild
# ../configure --prefix=$(pwd)SDLBuild && make && make install || exit $?
# cd ../
# See the official script at
# https://raw.githubusercontent.com/OGRECave/ogre-next/master/Scripts/BuildScripts/output/build_ogre_linux_c%2B%2Blatest.sh
echo "Building Ogre dependencies..."
cd ogre-next-deps && mkdir -p build && cd build && cmake -G Ninja .. || exit $?
ninja || exit $?
ninja install || exit $?
echo "Building Ogre..."
cd ../../ogre-next
if test ! -f Dependencies; then
ln -s ../ogre-next-deps/build/ogredeps Dependencies
fi
mkdir -p build/Debug
mkdir -p build/Release
cd build/Debug
echo "--- Building Ogre (Debug) ---"
cmake -D OGRE_USE_BOOST=0 -D OGRE_CONFIG_THREAD_PROVIDER=0 -D OGRE_CONFIG_THREADS=0 -D OGRE_BUILD_COMPONENT_SCENE_FORMAT=1 -D OGRE_BUILD_SAMPLES2=1 -D OGRE_BUILD_TESTS=1 -D CMAKE_BUILD_TYPE="Debug" -G Ninja ../.. || exit $?
ninja || exit $?
cd ../Release
echo "--- Building Ogre (Release) ---"
cmake -D OGRE_USE_BOOST=0 -D OGRE_CONFIG_THREAD_PROVIDER=0 -D OGRE_CONFIG_THREADS=0 -D OGRE_BUILD_COMPONENT_SCENE_FORMAT=1 -D OGRE_BUILD_SAMPLES2=1 -D OGRE_BUILD_TESTS=1 -D CMAKE_BUILD_TYPE="Release" -G Ninja ../.. || exit $?
ninja || exit $?

+ 7
- 1
Build_Debug.sh View File

@ -1,5 +1,11 @@
#!/bin/sh
# Build Cakelisp itself
echo "\n\nCakelisp\n\n"
cd Dependencies/cakelisp
./Build.sh || exit $?
cd ../..
echo "\n\nOgre\n\n"
./Dependencies/cakelisp/bin/cakelisp test/src/Config_Linux.cake test/src/OgreApp.cake || exit $?
echo "\n\nSDL Ogre\n\n"
@ -11,7 +17,7 @@ echo "\n\nVocal Game (hot reload)\n\n"
./Dependencies/cakelisp/bin/cakelisp test/src/Config_Linux.cake test/src/MakeHotReload.cake test/src/VocalGame.cake || exit $?
echo "\n\nLoader\n\n"
./Dependencies/cakelisp/bin/cakelisp --verbose-processes --verbose-build-reasons test/src/Config_Linux.cake test/src/Loader.cake || exit $?
./Dependencies/cakelisp/bin/cakelisp test/src/Config_Linux.cake test/src/Loader.cake || exit $?
echo "\n\nVocal Game (no reload)\n\n"
./Dependencies/cakelisp/bin/cakelisp \


+ 1
- 1
Dependencies/cakelisp

@ -1 +1 @@
Subproject commit e7e6bd2839c56c215495fb3850b6ec168f9f27f1
Subproject commit a8eea63fd2a4a75c2cc486996d1337646a9d0fb4

+ 1
- 1
Dependencies/ogre-next

@ -1 +1 @@
Subproject commit 3dceaab8f45e71b5f9ee68f7666b522c558396ae
Subproject commit 12c3b3b50ff970e920a6cf506becf226977992b8

+ 3
- 5
ReadMe.org View File

@ -12,16 +12,14 @@ git submodule update --init --recursive
hg clone http://hg.libsdl.org/SDL Dependencies/SDL
#+END_SRC
Build dependencies:
#+BEGIN_SRC sh
./BuildDependencies_Debug.sh
#+END_SRC
Build:
#+BEGIN_SRC sh
./Build_Debug.sh
#+END_SRC
This step will take a while the first time, because it builds Cakelisp, Ogre, SDL, and all the test programs. Subsequent executions will use the ~cakelisp_cache~ and will be much faster.
Note that changes to the 3rd-party dependencies will not automatically be detected.
* Asset pipeline
This is a work in progress.
** Blender setup


+ 0
- 1
src/AutoTest.cake View File

@ -56,7 +56,6 @@
(token-splice-array test-body)
(return num-errors)))
(prettyPrintTokens (deref main-definition))
(set (deref total-tests-found) (on-call functions-to-test size))
(unless (ReplaceAndEvaluateDefinition environment "main" (deref main-definition))
(return false))


+ 137
- 10
src/Ogre.cake View File

@ -3,7 +3,7 @@
(import
"OgreInitialize.cake"
&comptime-only "Macros.cake")
&comptime-only "Macros.cake" "BuildTools.cake")
(c-import "<stdio.h>"
;; Ogre dependencies
@ -163,17 +163,144 @@
;;
;; Building
;;
(defun-comptime build-ogre-on-failure (failure-message (* (const char)))
(Logf "error: Ogre build: %s\n
Note that you can also build Ogre 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/ogre-next/build/[Debug | Release].\n
See https://github.com/OGRECave/ogre-next#dependencies for dependencies and
https://github.com/OGRECave/ogre-next/tree/master/Scripts/BuildScripts/output for build scripts.\n"
failure-message))
(defun-comptime build-ogre (manager (& ModuleManager) module (* Module) &return bool)
(comptime-cond
('Windows
(comptime-error "Ogre build needs to be ported to Windows.
See https://github.com/OGRECave/ogre-next/tree/master/Scripts/BuildScripts/output"))
('Unix
;; Already built?
;; We could enhance this by checking for modifications, but that's pretty rare
(when (and (fileExists "Dependencies/ogre-next/build/Debug/lib/libOgreMain_d.so")
(fileExists "Dependencies/ogre-next/build/Release/lib/libOgreMain.so"))
(return true))
(Log "Ogre: Building via CMake and Make\n")
(var ogre-dependencies-dir-output (* (const char))
"Dependencies/ogre-next-deps/build/ogredeps")
(unless (fileExists ogre-dependencies-dir-output) ;; Build dependencies
(var ogre-dependencies-dir (* (const char)) "Dependencies/ogre-next-deps/build")
(makeDirectory ogre-dependencies-dir)
(run-process-sequential-or
("cmake"
"-G" "Ninja" ".."
:in-directory ogre-dependencies-dir)
(build-ogre-on-failure "failed at Ogre dependencies. This tool requires CMake.")
(return false))
(run-process-sequential-or
("ninja"
:in-directory ogre-dependencies-dir)
(build-ogre-on-failure "failed at Ogre dependencies Ninja build. This tool requires Ninja.")
(return false))
(run-process-sequential-or
("ninja" "install"
:in-directory ogre-dependencies-dir)
(build-ogre-on-failure "failed at Ogre dependencies Ninja install. This tool requires Ninja.")
(return false))
(unless (fileExists ogre-dependencies-dir-output)
(Logf "error: Expected Ogre dependencies to be in %s, but didn't find them\n"
ogre-dependencies-dir-output)
(return false)))
(unless (fileExists "Dependencies/ogre-next/Dependencies")
;; TODO: Add soft link to Dependencies
(Logf "Please run the following commands, then re-run the current command
(this manual step will eventually go away):\n
cd Dependencies/ogre-next\n
ln -s %s Dependencies\n" ogre-dependencies-dir-output)
(return false))
(var ogre-working-dir (* (const char)) "Dependencies/ogre-next/build")
(makeDirectory ogre-working-dir)
(var ogre-debug-output-dir ([] MAX_PATH_LENGTH char) (array 0))
(var ogre-release-output-dir ([] MAX_PATH_LENGTH char) (array 0))
(PrintfBuffer ogre-debug-output-dir "%s/Debug" ogre-working-dir)
(PrintfBuffer ogre-release-output-dir "%s/Release" ogre-working-dir)
(makeDirectory ogre-debug-output-dir)
(makeDirectory ogre-release-output-dir)
(scope ;; Debug
(run-process-sequential-or
("cmake"
"-D" "OGRE_USE_BOOST=0"
"-D" "OGRE_CONFIG_THREAD_PROVIDER=0"
"-D" "OGRE_CONFIG_THREADS=0"
"-D" "OGRE_BUILD_COMPONENT_SCENE_FORMAT=1"
"-D" "OGRE_BUILD_SAMPLES2=1"
"-D" "OGRE_BUILD_TESTS=1"
;; NOTE: You must not use quotes for this command. It needs to be
;; in one argument. This is because the shell interprets quotes a
;; certain way, which exec() does not
"-D" "CMAKE_BUILD_TYPE=Debug"
"-G" "Ninja"
"../.."
:in-directory ogre-debug-output-dir)
(build-ogre-on-failure "failed at Ogre cmake. This tool requires CMake.")
(return false))
(run-process-sequential-or
("ninja" "--verbose"
:in-directory ogre-debug-output-dir)
(build-ogre-on-failure "failed at Ogre ninja. This tool requires Ninja.")
(return false)))
;; TODO TURN BACK INTO scope
(scope ;; Release
(run-process-sequential-or
("cmake"
"-D" "OGRE_USE_BOOST=0"
"-D" "OGRE_CONFIG_THREAD_PROVIDER=0"
"-D" "OGRE_CONFIG_THREADS=0"
"-D" "OGRE_BUILD_COMPONENT_SCENE_FORMAT=1"
"-D" "OGRE_BUILD_SAMPLES2=1"
"-D" "OGRE_BUILD_TESTS=1"
"-D" "OGRE_DEBUG_MODE=0"
"-D" "CMAKE_BUILD_TYPE=Release"
"-G" "Ninja"
"../.."
:in-directory ogre-release-output-dir)
(build-ogre-on-failure "failed at Ogre cmake. This tool requires CMake.")
(return false))
(run-process-sequential-or
("ninja"
:in-directory ogre-release-output-dir)
(build-ogre-on-failure "failed at Ogre ninja. This tool requires Ninja.")
(return false)))
;; One final to check to ensure everything's good to go
(unless (and (fileExists "Dependencies/ogre-next/build/Debug/lib/libOgreMain_d.so")
(fileExists "Dependencies/ogre-next/build/Release/lib/libOgreMain.so"))
(build-ogre-on-failure
"Ogre build sequence completed, but files are not where expected. Is there an issue
with the configuration?\nFiles are expected in Dependencies/ogre-next/build")
(return false)))
(true
(comptime-error "need to define platform, e.g. (comptime-define-symbol 'Unix)")))
(Log "Ogre: Successfully built\n")
(return true))
(use-ogre-build-options)
(add-compile-time-hook-module pre-build build-ogre)
;; TODO: Automatically build Ogre if it isn't built yet
;; TODO: Copy necessary files (Hlms materials etc.) so self-test/user exes can run
;; (defun-comptime ogre-pre-build-hook (&return bool)
;; (unless (fileExists "Dependencies/ogre-next/build/Debug/lib")
;; (printf "error: Ogre is not built yet. Please run ./BuildDependencies_Debug.sh\n")
;; (return false))
;; (return true))
;; (add-compile-time-hook-module pre-build ogre-pre-build-hook)
(use-ogre-build-options)
(defun-comptime ogre-link-hook (manager (& ModuleManager)
linkCommand (& ProcessCommand)


+ 17
- 20
src/SDL.cake View File

@ -127,25 +127,22 @@ Note that you can also build SDL manually. This can be useful if you are porting
(PrintfBuffer configure-output-prefix "--prefix=%s" absolute-output-path)
(free (type-cast absolute-output-path (* void))))
(run-process-make-arguments configure-command "sh" "../configure" configure-output-prefix
:in-directory sdl-working-dir)
(unless (!= 0 (run-process-wait-for-completion (addr configure-command)))
(build-sdl-on-failure
"failed at SDL configure step. This requires a sh/bash-style shell to execute.")
(return false))
(run-process-make-arguments make-command "make"
:in-directory sdl-working-dir)
(unless (= 0 (run-process-wait-for-completion (addr make-command)))
(build-sdl-on-failure "failed at SDL make. This tool requires Makefile support.")
(return false))
(run-process-make-arguments make-install-command "make" "install"
:in-directory sdl-working-dir)
(unless (= 0 (run-process-wait-for-completion (addr make-install-command)))
(build-sdl-on-failure
"failed at SDL make install. Was there a configuration issue with --prefix?.")
(return false))
(run-process-sequential-or
("sh" "../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)
(build-sdl-on-failure "failed at SDL make. This tool requires Makefile support.")
(return false))
(run-process-sequential-or
("make" "install" :in-directory sdl-working-dir)
(build-sdl-on-failure
"failed at SDL make install. Was there a configuration issue with --prefix?.")
(return false))
;; One final to check to ensure everything's good to go
(unless (and (fileExists "Dependencies/SDL/buildSDLBuild/include/SDL2/SDL.h")
@ -153,7 +150,7 @@ Note that you can also build SDL manually. This can be useful if you are porting
(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\n")
\n\tDependencies/SDL/buildSDLBuild/lib")
(return false)))
(true
(comptime-error "need to define platform, e.g. (comptime-define-symbol 'Unix)")))


BIN
test/assets/Monkey.blend View File


BIN
test/data/Models/Suzanne.mesh View File


Loading…
Cancel
Save