mirror of https://github.com/axmolengine/axmol.git
1k: parse generater from cmake options
This commit is contained in:
parent
6cb7618ed0
commit
8939723108
63
1k/1kiss.ps1
63
1k/1kiss.ps1
|
@ -1662,33 +1662,6 @@ if (!$setupOnly) {
|
|||
|
||||
# determine generator, build_dir, inst_dir for non gradlew projects
|
||||
if (!$is_gradlew) {
|
||||
if (!$cmake_generator -and !$TARGET_OS.StartsWith('win')) {
|
||||
$cmake_generator = $cmake_generators[$TARGET_OS]
|
||||
if ($null -eq $cmake_generator) {
|
||||
$cmake_generator = if (!$IsWin) { 'Unix Makefiles' } else { 'Ninja' }
|
||||
}
|
||||
}
|
||||
|
||||
if ($cmake_generator) {
|
||||
$using_ninja = $cmake_generator.StartsWith('Ninja')
|
||||
|
||||
if (!$is_wasm) {
|
||||
$CONFIG_ALL_OPTIONS += '-G', $cmake_generator
|
||||
}
|
||||
|
||||
if ($cmake_generator -eq 'Unix Makefiles' -or $using_ninja) {
|
||||
$CONFIG_ALL_OPTIONS += "-DCMAKE_BUILD_TYPE=$optimize_flag"
|
||||
}
|
||||
|
||||
if ($using_ninja -and $Global:is_android) {
|
||||
$CONFIG_ALL_OPTIONS += "-DCMAKE_MAKE_PROGRAM=$ninja_prog"
|
||||
}
|
||||
|
||||
if ($cmake_generator -eq 'Xcode') {
|
||||
setup_xcode
|
||||
}
|
||||
}
|
||||
|
||||
$INST_DIR = $null
|
||||
$xopt_presets = 0
|
||||
$xprefix_optname = '-DCMAKE_INSTALL_PREFIX='
|
||||
|
@ -1714,6 +1687,15 @@ if (!$setupOnly) {
|
|||
}
|
||||
++$xopt_presets
|
||||
}
|
||||
elseif ($opt.startsWith('-G')) {
|
||||
if ($opt.Length -gt 2) {
|
||||
$cmake_generator = $opt.Substring(2).Trim()
|
||||
}
|
||||
elseif (++$opti -lt $xopts.Count) {
|
||||
$cmake_generator = $xopts[$opti]
|
||||
}
|
||||
++$xopt_presets
|
||||
}
|
||||
elseif ($opt.StartsWith($xprefix_optname)) {
|
||||
++$xopt_presets
|
||||
$INST_DIR = $opt.SubString($xprefix_optname.Length)
|
||||
|
@ -1723,6 +1705,33 @@ if (!$setupOnly) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!$cmake_generator -and !$TARGET_OS.StartsWith('win')) {
|
||||
$cmake_generator = $cmake_generators[$TARGET_OS]
|
||||
if ($null -eq $cmake_generator) {
|
||||
$cmake_generator = if (!$IsWin) { 'Unix Makefiles' } else { 'Ninja' }
|
||||
}
|
||||
}
|
||||
|
||||
if ($cmake_generator) {
|
||||
$using_ninja = $cmake_generator.StartsWith('Ninja')
|
||||
|
||||
if (!$is_wasm) {
|
||||
$CONFIG_ALL_OPTIONS += '-G', $cmake_generator
|
||||
}
|
||||
|
||||
if ($cmake_generator -eq 'Unix Makefiles' -or $using_ninja) {
|
||||
$CONFIG_ALL_OPTIONS += "-DCMAKE_BUILD_TYPE=$optimize_flag"
|
||||
}
|
||||
|
||||
if ($using_ninja -and $Global:is_android) {
|
||||
$CONFIG_ALL_OPTIONS += "-DCMAKE_MAKE_PROGRAM=$ninja_prog"
|
||||
}
|
||||
|
||||
if ($cmake_generator -eq 'Xcode') {
|
||||
setup_xcode
|
||||
}
|
||||
}
|
||||
|
||||
if (!$BUILD_DIR) {
|
||||
$BUILD_DIR = resolve_out_dir 'build_'
|
||||
}
|
||||
|
|
|
@ -6,11 +6,15 @@ project(dm)
|
|||
find_program(PWSH_PROG NAMES pwsh powershell NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
|
||||
message(STATUS "CMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
|
||||
message(STATUS "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
|
||||
message(STATUS "CMAKE_C_FLAGS=${CMAKE_C_FLAGS}")
|
||||
message(STATUS "ANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}")
|
||||
message(STATUS "CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
|
||||
message(STATUS "CMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
message(STATUS "CMAKE_SYSROOT=${CMAKE_SYSROOT}")
|
||||
|
||||
set(cross_flags "")
|
||||
if(ANDROID)
|
||||
message(STATUS "ANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}")
|
||||
if(CMAKE_ANDROID_ARCH_ABI MATCHES "arm64-v8a")
|
||||
set(cross_flags "-target aarch64-none-linux-android${ANDROID_NATIVE_API_LEVEL}")
|
||||
elseif(CMAKE_ANDROID_ARCH_ABI MATCHES "x86_64")
|
||||
|
@ -34,3 +38,5 @@ endif()
|
|||
if(NOT ${CMAKE_C_COMPILER} MATCHES ".*cl\.exe" OR "${MSVC_VERSION}" GREATER_EQUAL 1928)
|
||||
execute_process(COMMAND ${PWSH_PROG} "${CMAKE_CURRENT_SOURCE_DIR}/dm.ps1" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS} ${cross_flags}")
|
||||
endif()
|
||||
|
||||
add_library(dm dm.c)
|
|
@ -0,0 +1,4 @@
|
|||
long double dm2x(long double v)
|
||||
{
|
||||
return v * 10.33;
|
||||
}
|
Loading…
Reference in New Issue