1
0

BUILD.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. PREMAKE BUILD INSTRUCTIONS
  2. Premake is written in a mix of C and Lua. A small host executable,
  3. written in C, launches the app and prepares the environment, at which
  4. point control is handed off to a Lua script. Almost all of Premake is
  5. written in Lua scripts, which allow it to be easily extended and
  6. customized. The catch is that it is slightly more complicated to build
  7. it than your typical C/C++ application.
  8. If you find all of this very confusing and need some help, visit the
  9. Premake website for help and community links. We will be glad to help!
  10. BUILDING FROM A SOURCE PACKAGE
  11. If you downloaded a source code package (as opposed to pulling the sources
  12. directory from the repository) you will find project files for all of the
  13. officially supported toolsets in the build/ folder. Build the release
  14. configuration and you will be ready to go. For makefiles:
  15. $ cd build/gmake2.unix
  16. $ make config=release
  17. The binaries will be placed in the ./bin/release directory.
  18. BUILDING FROM THE REPOSITORY
  19. If you have pulled sources from the Premake source repository, you can
  20. use `Bootstrap.mak` to generate your first premake executable:
  21. $ make -f Bootstrap.mak PLATFORM
  22. Where PLATFORM can be osx or linux.
  23. On Windows with Visual Studio use nmake:
  24. $ nmake -f Bootstrap.mak windows
  25. Or on Windows with MinGW use mingw32-make:
  26. $ CC=mingw32-gcc mingw32-make -f Bootstrap.mak mingw
  27. If your toolset is not supported by the bootstrap Makefile, you will need
  28. to embed the scripts into a C source file so they may be built into the
  29. executable, and also generate the project files for your chosen toolset. In
  30. order do either of these things, you will need a working Premake executable.
  31. The easiest way to get an executable is to download one of the prebuilt
  32. binaries from the project website. If that isn't possible, or if not binary
  33. is provided for your platform, you can build from a source package as
  34. described above, as they also include pre-generated project files.
  35. Once you have a working Premake available, you can generate the project
  36. files for your toolset by running a command like the following in the
  37. top-level Premake directory:
  38. $ premake5 gmake2 # for makefiles
  39. $ premake5 vs2012 # for a Visual Studio 2012 solution
  40. $ premake --help # to see a list of supported toolsets
  41. If this is the first time you have built Premake, or if you have made
  42. changes to the Lua scripts, you should prepare them to be embedded into the
  43. Premake executable.
  44. $ premake5 embed
  45. This creates a C file (at src/host/scripts.c) which contains all of the
  46. Lua scripts as static string buffers. These then get compiled into the
  47. executable, which is how we get away with shipping a single file instead
  48. of a whole bunch of scripts.
  49. You should now have a solution/makefile/workspace in the top-level folder,
  50. which you can go ahead and build.
  51. RUNNING THE TESTS
  52. Once you have built an executable, you can verify it by running Premake's
  53. unit test suites. From the top-level Premake folder, run:
  54. $ bin/release/premake5 test
  55. RUNTIME SCRIPT LOADING
  56. If you are modifying or extending Premake, you can skip the embedding
  57. and compilation steps and run the scripts directly from the disk. This
  58. removes the build from the change-build-test cycle and really speeds up
  59. development.
  60. If you are running Premake from the top of its own source tree (where its
  61. premake5.lua is located) you will get this behavior automatically. If you
  62. are running Premake from some other location, use the --scripts option to
  63. provide the path to that top-level folder:
  64. $ bin/release/premake5 --scripts=../path/to/premake test
  65. If you find yourself doing this repeatedly, or if you want Premake to be
  66. able to find other, custom scripts, you can also set a search path with the
  67. PREMAKE_PATH environment variable. Set it just like you would set your
  68. system PATH variable.