Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Premake conan_basic_setup() and example update #998

Merged
merged 2 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 15 additions & 27 deletions integrations/premake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,39 +55,27 @@ In order to use new generator within your project, use the following Premake scr

-- premake5.lua

require 'conanbuildinfo'
include("conanbuildinfo.lua")

workspace "ConanPremakeDemo"
configurations { "Debug", "Release" }
platforms { "Win32", "x64" }
workspace("ConanPremakeDemo")
conan_basic_setup()

filter { "platforms:Win32" }
system "Windows"
architecture "x32"
project "ConanPremakeDemo"
kind "ConsoleApp"
language "C++"
targetdir "bin/%{cfg.buildcfg}"

filter { "platforms:x64" }
system "Windows"
architecture "x64"
linkoptions { conan_exelinkflags }

project "ConanPremakeDemo"
kind "ConsoleApp"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
files { "**.h", "**.cpp" }

includedirs { conan_includedirs }
libdirs { conan_libdirs }
links { conan_libs }
linkoptions { conan_exelinkflags }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"

files { "**.h", "**.cpp" }

filter "configurations:Debug"
defines { "DEBUG", conan_cppdefines }
symbols "On"

filter "configurations:Release"
defines { "NDEBUG", conan_cppdefines }
optimize "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"

Now we are going to let Conan retrieve the dependencies and generate the dependency information in a *conanbuildinfo.lua*:

Expand Down
31 changes: 29 additions & 2 deletions reference/generators/premake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ The file contains:

- N groups of variables, one group per require, declaring the same individual values: include dirs, libs, bin dirs, defines, etc.
- One group of global variables with aggregated values for all requirements.
- Helper functions to setup the settings in your configuration.

**Package declared vars**
Variables
---------

Package declared variables
++++++++++++++++++++++++++

For each requirement ``conanbuildinfo.lua`` file declares the following variables.
```XXX``` is the name of the require. e.g. "zlib" for ``zlib/1.2.11@lasote/stable`` requirement:
Expand Down Expand Up @@ -47,7 +52,8 @@ For each requirement ``conanbuildinfo.lua`` file declares the following variable
| conan_rootpath_XXX | Abs path to root package folder |
+---------------------------+------------------------------------------------------+

**Global declared vars**
Global declared variables
+++++++++++++++++++++++++

+---------------------------+------------------------------------------------------+
| NAME | VALUE |
Expand All @@ -70,3 +76,24 @@ For each requirement ``conanbuildinfo.lua`` file declares the following variable
+---------------------------+------------------------------------------------------+
| conan_exelinkflags | Aggregated executable link flags |
+---------------------------+------------------------------------------------------+

Functions
---------

conan_basic_setup()
+++++++++++++++++++

Basic function to setup the settings into your configuration. Useful to reduce the logic in premake scripts and automate the conversion of
settings:

.. code-block:: lua

function conan_basic_setup()
configurations{conan_build_type}
architecture(conan_arch)
includedirs{conan_includedirs}
libdirs{conan_libdirs}
links{conan_libs}
defines{conan_cppdefines}
bindirs{conan_bindirs}
end