elixir_cmake v0.8.0 mix compile.cmake View Source
Builds native source using CMake
Runs cmake in the current project (followed by make) .
This task runs cmake in the current project; any output coming from cmake is
printed in real-time on stdout.
Configuration
This compiler can be configured through the return value of the project/0
function in mix.exs; for example:
def project() do
[
# ...
compilers: [:cmake] ++ Mix.compilers,
# ...
]
end
The following options are available:
:cmake_env- (map of binary to binary) it's a map of extra environment variables to be passed tocmake. You can also pass a function in here in casemake_envneeds access to things that are not available during project setup; the function should return a map of binary to binary. Many default environment variables are set, see section below
Default environment variables
There are also several default environment variables set:
MIX_TARGETMIX_ENVMIX_BUILD_PATH- same asMix.Project.build_path/0MIX_APP_PATH- same asMix.Project.app_path/0MIX_COMPILE_PATH- same asMix.Project.compile_path/0MIX_CONSOLIDATION_PATH- same asMix.Project.consolidation_path/0MIX_DEPS_PATH- same asMix.Project.deps_path/0MIX_MANIFEST_PATH- same asMix.Project.manifest_path/0ERL_EI_LIBDIRERL_EI_INCLUDE_DIRERTS_INCLUDE_DIRERL_INTERFACE_LIB_DIRERL_INTERFACE_INCLUDE_DIRThese may also be overwritten with thecmake_envoption.
Compilation artifacts and working with priv directories
Generally speaking, compilation artifacts are written to the priv
directory, as that the only directory, besides ebin, which are
available to Erlang/OTP applications.
However, note that Mix projects supports the :build_embedded
configuration, which controls if assets in the _build directory
are symlinked (when false, the default) or copied (true).
In order to support both options for :build_embedded, it is
important to follow the given guidelines:
- The "priv" directory must not exist in the source code
- The Makefile should copy any artifact to
$MIX_APP_PATH/privor, even better, to$MIX_APP_PATH/priv/$MIX_TARGET - If there are static assets, the Makefile should copy them over from a directory at the project root (not named "priv")
Link to this section Summary
Link to this section Functions
clean() View Source
Removes compiled artifacts.
run(args) View Source
Runs this task.