summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2018-01-15 20:53:53 -0700
committerJames Rowe <jroweboy@gmail.com>2018-01-16 01:15:52 -0700
commite026b66bbbb78f3c43c067eb94675d4782fb70b6 (patch)
treed64dd737b71c7845c92b598c3e2aee4314343537 /CMakeLists.txt
parent713c1ed2037e73d3eadcc605c839f069aefc4853 (diff)
Build: Add unicorn as a submodule and build it if needed
Adds a cmake custom target that will build unicorn on first compile and uses this in the build scripts as well. Updates Appveyor and Travis build scripts to work with the new unicorn build, and updates the paths to all of the different artifacts.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3da8465b9..f1a4d0152 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,6 +224,31 @@ if (YUZU_USE_BUNDLED_UNICORN)
set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers")
set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/lib/x64/unicorn_dynload.lib" CACHE PATH "Path to Unicorn library")
set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/lib/x64/" CACHE PATH "Path to unicorn.dll")
+elseif (YUZU_BUILD_UNICORN)
+ if (MSVC)
+ message(FATAL_ERROR "Cannot build unicorn on msvc. Use YUZU_USE_BUNDLED_UNICORN instead")
+ elseif (MINGW)
+ set(UNICORN_LIB_NAME "unicorn.a")
+ else()
+ set(UNICORN_LIB_NAME "libunicorn.a")
+ endif()
+
+ set(UNICORN_FOUND YES)
+ set(UNICORN_PREFIX ${CMAKE_SOURCE_DIR}/externals/unicorn)
+ set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/${UNICORN_LIB_NAME}" CACHE PATH "Path to Unicorn library")
+ set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers")
+ set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/" CACHE PATH "Path to unicorn dynamic library")
+
+ add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
+ COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" /bin/sh make.sh
+ WORKING_DIRECTORY ${UNICORN_PREFIX}
+ )
+ # ALL makes this custom target build every time
+ # but it won't actually build if LIBUNICORN_LIBRARY exists
+ add_custom_target(unicorn-build ALL
+ DEPENDS ${LIBUNICORN_LIBRARY}
+ )
+ unset(UNICORN_LIB_NAME)
else()
find_package(Unicorn REQUIRED)
endif()