mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-12 10:39:00 +08:00
Merge pull request #390 from google/fix_cmake_var_handling
Require Android NDK path in environment.
This commit is contained in:
commit
d83342256e
@ -321,11 +321,8 @@ It's sometimes useful to build Draco command line tools and run them directly on
|
|||||||
Android devices via adb.
|
Android devices via adb.
|
||||||
|
|
||||||
~~~~~ bash
|
~~~~~ bash
|
||||||
# all targets require CMAKE_ANDROID_NDK. It can be set in the environment or
|
# All targets require CMAKE_ANDROID_NDK. It must be set in the environment.
|
||||||
# within CMake. For example, this would set it in your environment.
|
|
||||||
$ export CMAKE_ANDROID_NDK=path/to/ndk
|
$ export CMAKE_ANDROID_NDK=path/to/ndk
|
||||||
# To set it within CMake, add -DCMAKE_ANDROID_NDK=path/to/ndk to your CMake
|
|
||||||
# command.
|
|
||||||
|
|
||||||
# arm
|
# arm
|
||||||
$ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=path/to/draco/cmake/toolchains/armv7-android-ndk-libcpp.cmake
|
$ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=path/to/draco/cmake/toolchains/armv7-android-ndk-libcpp.cmake
|
||||||
|
@ -51,21 +51,19 @@ function (set_compiler_launcher launcher_flag launcher_name)
|
|||||||
endif ()
|
endif ()
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
# Terminates CMake execution when $var_name is unset in CMake and environment,
|
# Terminates CMake execution when $var_name is unset in the environment. Sets
|
||||||
# and then calls set_variable_if_unset() to ensure variable is set for caller.
|
# CMake variable to the value of the environment variable when the variable is
|
||||||
|
# present in the environment.
|
||||||
macro(require_variable var_name)
|
macro(require_variable var_name)
|
||||||
if ((NOT DEFINED ${var_name}) AND ("$ENV{${var_name}}" STREQUAL ""))
|
if ("$ENV{${var_name}}" STREQUAL "")
|
||||||
message(FATAL_ERROR "${var_name} must be set in cmake or environment.")
|
message(FATAL_ERROR "${var_name} must be set in environment.")
|
||||||
endif ()
|
endif ()
|
||||||
set_variable_if_unset(${var_name} "")
|
set_variable_if_unset(${var_name} "")
|
||||||
endmacro ()
|
endmacro ()
|
||||||
|
|
||||||
# Sets $var_name to $default_value if not already set in CMake or the
|
# Sets $var_name to $default_value if not already set in the environment.
|
||||||
# environment.
|
|
||||||
macro (set_variable_if_unset var_name default_value)
|
macro (set_variable_if_unset var_name default_value)
|
||||||
if (DEFINED ${var_name})
|
if (NOT "$ENV{${var_name}}" STREQUAL "")
|
||||||
return ()
|
|
||||||
elseif (NOT "$ENV{${var_name}}" STREQUAL "")
|
|
||||||
set(${var_name} $ENV{${var_name}})
|
set(${var_name} $ENV{${var_name}})
|
||||||
else ()
|
else ()
|
||||||
set(${var_name} ${default_value})
|
set(${var_name} ${default_value})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user