@ -12,8 +12,6 @@ option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF)
option ( ENABLE_QT "Enable the Qt frontend" ON )
option ( YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" OFF )
option ( YUZU_USE_BUNDLED_UNICORN "Download bundled Unicorn binaries" OFF )
if ( NOT EXISTS ${ CMAKE_SOURCE_DIR } /.git/hooks/pre-commit )
message ( STATUS "Copying pre-commit hook" )
file ( COPY hooks/pre-commit
@ -29,7 +27,7 @@ function(check_submodules_present)
foreach ( module ${ gitmodules } )
string ( REGEX REPLACE "path *= *" "" module ${ module } )
if ( NOT EXISTS "${CMAKE_SOURCE_DIR}/${module}/.git" )
message ( SEND _ERROR "Git submodule ${module} not found. "
message ( FATAL _ERROR "Git submodule ${module} not found. "
" P l e a s e r u n : g i t s u b m o d u l e u p d a t e - - i n i t - - r e c u r s i v e " )
endif ( )
endforeach ( )
@ -204,59 +202,63 @@ else()
set ( SDL2_FOUND NO )
endif ( )
if ( YUZU_USE_BUNDLED_UNICORN )
# D e t e c t t o o l c h a i n a n d p l a t f o r m
if ( MSVC14 AND ARCHITECTURE_x86_64 )
set ( UNICORN_VER "unicorn-yuzu" )
else ( )
message ( FATAL_ERROR "No bundled Unicorn binaries for your toolchain. Disable YUZU_USE_BUNDLED_UNICORN and provide your own." )
endif ( )
if ( DEFINED UNICORN_VER )
download_bundled_external ( "unicorn/" ${ UNICORN_VER } UNICORN_PREFIX )
endif ( )
if ( DEFINED UNICORN_VER )
download_bundled_external ( "unicorn/" ${ UNICORN_VER } UNICORN_PREFIX )
endif ( )
set ( UNICORN_FOUND YES )
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 )
# I f u n i c o r n i s n ' t f o u n d , m s v c - > d o w n l o a d b u n d l e d u n i c o r n ; e v e r y o n e e l s e - > b u i l d e x t e r n a l
find_package ( Unicorn QUIET )
if ( NOT UNICORN_FOUND )
if ( MSVC )
message ( FATAL_ERROR "Cannot build unicorn on msvc. Use YUZU_USE_BUNDLED_UNICORN instead" )
elseif ( MINGW )
set ( UNICORN_LIB_NAME "unicorn.a" )
message ( STATUS "unicorn not found, falling back to bundled" )
# D e t e c t t o o l c h a i n a n d p l a t f o r m
if ( MSVC14 AND ARCHITECTURE_x86_64 )
set ( UNICORN_VER "unicorn-yuzu" )
else ( )
message ( FATAL_ERROR "No bundled Unicorn binaries for your toolchain. Disable YUZU_USE_BUNDLED_UNICORN and provide your own." )
endif ( )
if ( DEFINED UNICORN_VER )
download_bundled_external ( "unicorn/" ${ UNICORN_VER } UNICORN_PREFIX )
endif ( )
if ( DEFINED UNICORN_VER )
download_bundled_external ( "unicorn/" ${ UNICORN_VER } UNICORN_PREFIX )
endif ( )
set ( UNICORN_FOUND YES )
set ( LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE )
set ( LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/lib/x64/unicorn_dynload.lib" CACHE PATH "Path to Unicorn library" FORCE )
set ( UNICORN_DLL_DIR "${UNICORN_PREFIX}/lib/x64/" CACHE PATH "Path to unicorn.dll" FORCE )
else ( )
set ( UNICORN_LIB_NAME "libunicorn.a" )
message ( STATUS "unicorn not found, falling back to externals" )
if ( 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" FORCE )
set ( LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE )
set ( UNICORN_DLL_DIR "${UNICORN_PREFIX}/" CACHE PATH "Path to unicorn dynamic library" FORCE )
add_custom_command ( OUTPUT ${ LIBUNICORN_LIBRARY }
C O M M A N D $ { C M A K E _ C O M M A N D } - E e n v U N I C O R N _ A R C H S = " a a r c h 6 4 " / b i n / s h m a k e . s h
W O R K I N G _ D I R E C T O R Y $ { U N I C O R N _ P R E F I X }
)
# A L L m a k e s t h i s c u s t o m t a r g e t b u i l d e v e r y t i m e
# b u t i t w o n ' t a c t u a l l y b u i l d i f L I B U N I C O R N _ L I B R A R Y i s u p t o d a t e
add_custom_target ( unicorn-build ALL
D E P E N D S $ { L I B U N I C O R N _ L I B R A R Y }
)
unset ( UNICORN_LIB_NAME )
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 }
C O M M A N D $ { C M A K E _ C O M M A N D } - E e n v U N I C O R N _ A R C H S = " a a r c h 6 4 " / b i n / s h m a k e . s h
W O R K I N G _ D I R E C T O R Y $ { U N I C O R N _ P R E F I X }
)
# A L L m a k e s t h i s c u s t o m t a r g e t b u i l d e v e r y t i m e
# b u t i t w o n ' t a c t u a l l y b u i l d i f L I B U N I C O R N _ L I B R A R Y e x i s t s
add_custom_target ( unicorn-build ALL
D E P E N D S $ { L I B U N I C O R N _ L I B R A R Y }
)
unset ( UNICORN_LIB_NAME )
else ( )
find_package ( Unicorn REQUIRED )
endif ( )
if ( UNICORN_FOUND )
add_library ( unicorn INTERFACE )
target_link_libraries ( unicorn INTERFACE "${LIBUNICORN_LIBRARY}" )
target_include_directories ( unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}" )
else ( )
message ( FATAL_ERROR "Could not find or build unicorn which is required." )
endif ( )
if ( ENABLE_QT )