From e026b66bbbb78f3c43c067eb94675d4782fb70b6 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Mon, 15 Jan 2018 20:53:53 -0700 Subject: 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. --- CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'CMakeLists.txt') 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() -- cgit v1.2.3