Skip to content

Commit

Permalink
Add quest cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBrumbler committed Dec 28, 2023
1 parent ce2fd13 commit 696255e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions cmake/quest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
if (NOT DEFINED CMAKE_ANDROID_NDK)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ndkpath.txt")
file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/ndkpath.txt" CMAKE_ANDROID_NDK)
else()
if(EXISTS $ENV{ANDROID_NDK_HOME})
set(CMAKE_ANDROID_NDK $ENV{ANDROID_NDK_HOME})
elseif(EXISTS $ENV{ANDROID_NDK_LATEST_HOME})
set(CMAKE_ANDROID_NDK $ENV{ANDROID_NDK_LATEST_HOME})
endif()
endif()
endif()
if (NOT DEFINED CMAKE_ANDROID_NDK)
message(FATAL_ERROR "Big time error buddy, no NDK")
endif()

string(REPLACE "\\" "/" CMAKE_ANDROID_NDK ${CMAKE_ANDROID_NDK})
message(STATUS "Using NDK ${CMAKE_ANDROID_NDK}")

set(ANDROID_PLATFORM 24)
set(ANDROID_ABI arm64-v8a)
set(ANDROID_STL c++_static)
set(ANDROID_USE_LEGACY_TOOLCHAIN_FILE OFF)

set(CMAKE_TOOLCHAIN_FILE ${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake)

# read in information about the mod from qpm.json
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/qpm.json PACKAGE_JSON)

string(JSON PACKAGE_INFO GET ${PACKAGE_JSON} info)

string(JSON PACKAGE_NAME GET ${PACKAGE_INFO} name)
string(JSON PACKAGE_ID GET ${PACKAGE_INFO} id)
string(JSON PACKAGE_VERSION GET ${PACKAGE_INFO} version)

message(STATUS "PACKAGE NAME: ${PACKAGE_NAME}")
message(STATUS "PACKAGE VERSION: ${PACKAGE_VERSION}")

string(JSON EXTERN_DIR_NAME GET ${PACKAGE_JSON} dependenciesDir)
string(JSON SHARED_DIR_NAME GET ${PACKAGE_JSON} sharedDir)

set(EXTERN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${EXTERN_DIR_NAME})
set(SHARED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${SHARED_DIR_NAME})

macro(find_qpm_package NAME)
set(${NAME}_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/cmake")
find_package(${NAME} REQUIRED)
endmacro()

0 comments on commit 696255e

Please sign in to comment.