Browse Source

Now building without Jam

Cakelisp can handle building OgreApp.cake
SDLAttempt
Macoy Madson 3 years ago
parent
commit
5b72ab2d64
  1. 6
      Build_Debug.sh
  2. 2
      Dependencies/cakelisp
  3. 3
      Jamrules
  4. 66
      src/OgreCore.cake
  5. 3
      test/OgreApp.cake

6
Build_Debug.sh

@ -1,8 +1,6 @@
#!/bin/sh
./Dependencies/cakelisp/bin/cakelisp src/OgreCore.cake \
&& jam -j4 -sDEBUG_BUILD=true libGameLib.a || exit $?
# ./Dependencies/cakelisp/bin/cakelisp src/OgreCore.cake || exit $?
# TODO: Figure out how to remove clean by teaching jam about libGameLib.a (dyn link instead?)
./Dependencies/cakelisp/bin/cakelisp test/OgreApp.cake && cd test \
&& jam clean && jam -j4 -sDEBUG_BUILD=true || exit $?
./Dependencies/cakelisp/bin/cakelisp test/OgreApp.cake

2
Dependencies/cakelisp

@ -1 +1 @@
Subproject commit 5e094a4b270f3ed9572de6a06a671bffc48d41e2
Subproject commit 9f387399030f946bd75a8f92c5ec7295b8345b70

3
Jamrules

@ -54,7 +54,8 @@ if $(DEBUG_BUILD)
Dependencies/ogre-next/build/Debug/include
# Ogre overlay
Dependencies/ogre-next/Components/Overlay/include ;
OGRE_LINKLIBS = -lOgreHlmsPbs_d
OGRE_LINKLIBS =
-lOgreHlmsPbs_d
-lOgreHlmsUnlit_d
-lOgreMain_d
# Ogre 2D overlays

66
src/OgreCore.cake

@ -153,3 +153,69 @@
;; (getNextArgument tokens current-index end-invocation-index))
(incr current-index))
(return true))
;;
;; Building
;;
;; TODO: Relative vs. absolute paths
(import &comptime-only "../Dependencies/cakelisp/runtime/Macros.cake")
(add-cpp-build-dependency "OgreInitialize.cpp")
(set-module-option build-time-compiler "/usr/bin/clang++")
;; Include cakelisp source for DynamicLoader.hpp
(set-module-option build-time-compile-arguments
"-std=c++11" "-Wall" "-Wextra" "-Wno-unused-parameter"
"-g" "-c" 'source-input "-o" 'object-output "-fPIC"
;; Ogre options
"-DOGRE_DEBUG_MODE=1"
"-IDependencies/ogre-next/OgreMain/include"
"-IDependencies/ogre-next/Components/Hlms/Common/include"
"-IDependencies/ogre-next/Components/Hlms/Pbs/include"
"-IDependencies/ogre-next/Components/Hlms/Unlit/include"
"-IDependencies/ogre-next/build/Debug/include"
"-IDependencies/ogre-next/Components/Overlay/include")
;; (defun-comptime ogre-pre-build-hook ()
;; (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)
(defmacro command-add-string-argument ()
(destructure-arguments new-argument-index)
(quick-token-at new-argument new-argument-index)
(tokenize-push output (on-call (field linkCommand arguments) push_back
(array ProcessCommandArgumentType_String
(token-splice (addr new-argument)))))
(return true))
(defun-comptime ogre-link-hook (manager (& ModuleManager)
linkCommand (& ProcessCommand)
linkTimeInputs (* ProcessCommandInput) numLinkTimeInputs int
&return bool)
;; TODO: Expose this option somehow?
(var debug bool true)
(printf "OgreCore: Adding %s link arguments\n" (? debug "debug" "release"))
(if debug
(block
(command-add-string-argument "-LDependencies/ogre-next/build/Debug/lib")
(command-add-string-argument "-lOgreHlmsPbs_d")
(command-add-string-argument "-lOgreHlmsUnlit_d")
(command-add-string-argument "-lOgreMain_d")
(command-add-string-argument "-lOgreOverlay_d")
(command-add-string-argument "-Wl,-rpath,.:../Dependencies/ogre-next/build/Debug/lib"))
(block
(command-add-string-argument "-LDependencies/ogre-next/build/Release/lib")
(command-add-string-argument "-lOgreHlmsPbs")
(command-add-string-argument "-lOgreHlmsUnlit")
(command-add-string-argument "-lOgreMain")
(command-add-string-argument "-lOgreOverlay")
(command-add-string-argument "-Wl,-rpath,.:../Dependencies/ogre-next/build/Release/lib")))
(return true))
(add-compile-time-hook pre-link ogre-link-hook)

3
test/OgreApp.cake

@ -26,3 +26,6 @@
(when exit-reason
(printf "Exit reason: %s\n" exit-reason))
(return 0))
;; We need to place the executable relative to our data folders and such
(set-cakelisp-option executable-output "test/ogreApp")

Loading…
Cancel
Save