Restore submodules for less widely available libraries.

This commit is contained in:
James Benton 2022-01-23 09:50:13 +00:00
parent 75993f0a6d
commit 2b55942eb8
26 changed files with 619 additions and 63 deletions

View file

@ -42,15 +42,12 @@ jobs:
repository: 'microsoft/vcpkg'
path: 'build/vcpkg'
- name: 'Setup vcpkg (Ubuntu)'
if: startsWith(matrix.os, 'ubuntu')
run: ./build/vcpkg/bootstrap-vcpkg.sh
- name: 'Setup vcpkg (Windows)'
if: startsWith(matrix.os, 'windows')
run: ./build/vcpkg/bootstrap-vcpkg.bat
- name: 'Setup NuGet Credentials'
if: startsWith(matrix.os, 'windows')
shell: 'bash'
run: >
cd build &&
@ -71,7 +68,7 @@ jobs:
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-bionic.list http://packages.lunarg.com/vulkan/lunarg-vulkan-bionic.list
sudo apt-add-repository ppa:cginternals/ppa
sudo apt-get update
sudo apt-get install -y cmake vulkan-sdk python3-setuptools nasm mesa-common-dev libglu1-mesa-dev ninja-build
sudo apt-get install -y cmake vulkan-sdk python3-setuptools mesa-common-dev libglu1-mesa-dev ninja-build libcurl4-openssl-dev libsdl2-dev libssl-dev zlib1g-dev libuv1-dev libc-ares-dev libavcodec-dev libavfilter-dev libavutil-dev libswscale-dev
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }}
else
@ -152,7 +149,7 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
run: |
cd build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux-release -DVCPKG_HOST_TRIPLET=x64-linux-release -DCMAKE_BUILD_TYPE=Release -DDECAF_BUILD_TOOLS=ON -DDECAF_VULKAN=ON -DDECAF_QT=ON -DCMAKE_PREFIX_PATH=$QTDIR -DCMAKE_INSTALL_PREFIX=install ..
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECAF_BUILD_TOOLS=ON -DDECAF_VULKAN=ON -DDECAF_QT=ON -DCMAKE_PREFIX_PATH=$QTDIR -DCMAKE_INSTALL_PREFIX=install ..
- name: Configure (Windows)
if: startsWith(matrix.os, 'windows')

27
.gitmodules vendored
View file

@ -1,21 +1,48 @@
[submodule "libraries/pugixml"]
path = libraries/pugixml
url = https://github.com/zeux/pugixml.git
[submodule "libraries/libbinrec"]
path = libraries/libbinrec
url = https://github.com/decaf-emu/libbinrec.git
[submodule "libraries/spdlog"]
path = libraries/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "libraries/cereal"]
path = libraries/cereal
url = https://github.com/USCiLab/cereal.git
[submodule "libraries/ovsocket"]
path = libraries/ovsocket
url = https://github.com/exjam/ovsocket.git
[submodule "libraries/gsl-lite"]
path = libraries/gsl-lite
url = https://github.com/decaf-emu/gsl-lite.git
[submodule "libraries/addrlib"]
path = libraries/addrlib
url = https://github.com/decaf-emu/addrlib.git
[submodule "libraries/excmd"]
path = libraries/excmd
url = https://github.com/exjam/excmd
[submodule "libraries/imgui"]
path = libraries/imgui
url = https://github.com/ocornut/imgui.git
[submodule "libraries/cnl"]
path = libraries/cnl
url = https://github.com/decaf-emu/cnl.git
[submodule "libraries/catch"]
path = libraries/catch
url = https://github.com/philsquared/Catch.git
[submodule "libraries/cpptoml"]
path = libraries/cpptoml
url = https://github.com/decaf-emu/cpptoml.git
[submodule "libraries/cpp-peglib"]
path = libraries/cpp-peglib
url = https://github.com/yhirose/cpp-peglib.git
[submodule "libraries/fmt"]
path = libraries/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "libraries/glslang"]
path = libraries/glslang
url = https://github.com/KhronosGroup/glslang.git
[submodule "libraries/qtads"]
path = libraries/qtads
url = https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git

View file

@ -40,7 +40,18 @@ Use cmake-gui to generate a VS project file:
Required:
- A modern C++17 friendly compiler such as g++9
- CMake
- [vcpkg](https://vcpkg.io/en/getting-started.html)
Required dependencies which can be acquired from system or vcpkg:
- c-ares
- curl
- ffmpeg
- libuv
- openssl
- sdl2
- zlib
For some systems, these can be installed with:
- `apt install cmake libcurl4-openssl-dev libsdl2-dev libssl-dev zlib1g-dev libuv1-dev libc-ares-dev libavcodec-dev libavfilter-dev libavutil-dev libswscale-dev`
Optional:
- [Vulkan SDK](https://vulkan.lunarg.com/sdk/home), disable by using `-DDECAF_VULKAN=OFF`
@ -54,7 +65,7 @@ For some systems, Qt can be installed with:
- `cd decaf-emu`
- `mkdir build`
- `cd build`
- `cmake -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../`
- `cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../`
- `make`
You might want to use `cmake -G Ninja <...>` and build with Ninja instead of Make for faster builds.

View file

@ -10,25 +10,6 @@ if(USING_CONAN)
conan_basic_setup(NO_OUTPUT_DIRS)
endif()
find_package(Threads REQUIRED)
find_package(c-ares CONFIG REQUIRED) # c-ares::cares c-ares::cares_shared c-ares::cares_static
find_package(Catch2 CONFIG REQUIRED) # Catch2::Catch2
find_package(cereal CONFIG REQUIRED) # cereal
find_package(CURL CONFIG REQUIRED) # CURL::libcurl
find_package(fmt CONFIG REQUIRED) # fmt::fmt
find_package(glslang CONFIG REQUIRED)
find_package(gsl-lite CONFIG REQUIRED) # gsl::gsl-lite
find_package(imgui CONFIG REQUIRED) # imgui::imgui
find_package(OpenSSL REQUIRED) # OpenSSL::SSL OpenSSL::Crypto
find_package(pugixml CONFIG REQUIRED) # pugixml pugixml::shared pugixml::pugixml
find_package(SDL2 CONFIG REQUIRED) # SDL2::SDL2 SDL2::SDL2main
find_package(spdlog CONFIG REQUIRED) # spdlog::spdlog spdlog::spdlog_header_only
find_package(unofficial-libuv CONFIG REQUIRED) # unofficial::libuv::libuv
find_package(ZLIB REQUIRED) # ZLIB::ZLIB
find_path(CPPTOML_INCLUDE_DIRS "cpptoml.h")
# Disable PCH by default on older versions of CMake
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
set(DECAF_PCH_DEFAULT OFF)
@ -69,10 +50,6 @@ if(DECAF_JIT_PROFILING)
add_definitions(-DDECAF_JIT_ALLOW_PROFILING)
endif()
find_package(FFMPEG REQUIRED)
add_definitions(-DDECAF_FFMPEG)
add_definitions(-DDECAF_SDL)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(XCB QUIET)
find_package(X11 QUIET)
@ -99,6 +76,49 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DECAF_PLATFORM_COCOA TRUE)
endif()
find_package(Threads REQUIRED)
if(VCPKG_TARGET_TRIPLET)
find_package(c-ares CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(SDL2 CONFIG REQUIRED)
find_package(unofficial-libuv CONFIG REQUIRED)
find_package(ZLIB REQUIRED)
set(CARES_LIBRARY c-ares::cares)
set(CURL_LIBRARY CURL::libcurl)
set(FFMPEG_LIBRARY FFMPEG::AVCODEC FFMPEG::AVFILTER FFMPEG::AVUTIL FFMPEG::SWSCALE)
set(LIBUV_LIBRARY unofficial::libuv::libuv)
set(OPENSSL_LIBRARY OpenSSL::SSL)
set(SDL2_LIBRARY SDL2::SDL2)
set(SDL2_MAIN_LIBRARY SDL2::SDL2main)
set(ZLIB_LIBRARY ZLIB::ZLIB)
else()
find_package(CARES REQUIRED)
find_package(CURL REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(LibUV REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(SDL2 REQUIRED)
find_package(ZLIB REQUIRED)
set(CARES_LIBRARY CARES::CARES)
set(CURL_LIBRARY CURL::libcurl)
set(FFMPEG_LIBRARY FFMPEG::AVCODEC FFMPEG::AVFILTER FFMPEG::AVUTIL FFMPEG::SWSCALE)
set(LIBUV_LIBRARY LibUV::LibUV)
set(OPENSSL_LIBRARY OpenSSL::SSL)
set(SDL2_LIBRARY SDL2::SDL2)
set(SDL2_MAIN_LIBRARY SDL2::SDL2main)
set(ZLIB_LIBRARY ZLIB::ZLIB)
endif()
# TODO: Remove these definitions as they are no longer optional
add_definitions(-DDECAF_FFMPEG)
add_definitions(-DDECAF_SDL)
if(DECAF_VULKAN)
find_package(Vulkan 1.1.106.0 REQUIRED) # Vulkan_INCLUDE_DIRS and Vulkan_LIBRARIES
add_library(vulkan INTERFACE IMPORTED)

View file

@ -0,0 +1,123 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#
# This is a slight edited version of FindLIBUV.cmake :)
#[=======================================================================[.rst:
FindCARES
---------
Find c-ares includes and library.
Imported Targets
^^^^^^^^^^^^^^^^
An :ref:`imported target <Imported targets>` named
``CARES::CARES`` is provided if c-ares has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``CARES_FOUND``
True if c-ares was found, false otherwise.
``CARES_INCLUDE_DIRS``
Include directories needed to include c-ares headers.
``CARES_LIBRARIES``
Libraries needed to link to c-ares.
``CARES_VERSION``
The version of c-ares found.
``CARES_VERSION_MAJOR``
The major version of c-ares.
``CARES_VERSION_MINOR``
The minor version of c-ares.
``CARES_VERSION_PATCH``
The patch version of c-ares.
Cache Variables
^^^^^^^^^^^^^^^
This module uses the following cache variables:
``CARES_LIBRARY``
The location of the c-ares library file.
``CARES_INCLUDE_DIR``
The location of the c-ares include directory containing ``ares.h``.
The cache variables should not be used by project code.
They may be set by end users to point at c-ares components.
#]=======================================================================]
set(CARES_NAMES ${CARES_NAMES} cares)
#-----------------------------------------------------------------------------
find_library(CARES_LIBRARY
NAMES ${CARES_NAMES}
)
mark_as_advanced(CARES_LIBRARY)
find_path(CARES_INCLUDE_DIR
NAMES ares.h
)
mark_as_advanced(CARES_INCLUDE_DIR)
#-----------------------------------------------------------------------------
# Extract version number if possible.
set(_CARES_H_REGEX "#[ \t]*define[ \t]+ARES_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+")
if(CARES_INCLUDE_DIR AND EXISTS "${CARES_INCLUDE_DIR}/ares_version.h")
file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _CARES_H REGEX "${_CARES_H_REGEX}")
else()
set(_CARES_H "")
endif()
foreach(c MAJOR MINOR PATCH)
if(_CARES_H MATCHES "#[ \t]*define[ \t]+ARES_VERSION_${c}[ \t]+([0-9]+)")
set(_CARES_VERSION_${c} "${CMAKE_MATCH_1}")
else()
unset(_CARES_VERSION_${c})
endif()
endforeach()
if(DEFINED _CARES_VERSION_MAJOR AND DEFINED _CARES_VERSION_MINOR)
set(CARES_VERSION_MAJOR "${_CARES_VERSION_MAJOR}")
set(CARES_VERSION_MINOR "${_CARES_VERSION_MINOR}")
set(CARES_VERSION "${CARES_VERSION_MAJOR}.${CARES_VERSION_MINOR}")
if(DEFINED _CARES_VERSION_PATCH)
set(CARES_VERSION_PATCH "${_CARES_VERSION_PATCH}")
set(CARES_VERSION "${CARES_VERSION}.${CARES_VERSION_PATCH}")
else()
unset(CARES_VERSION_PATCH)
endif()
else()
set(CARES_VERSION_MAJOR "")
set(CARES_VERSION_MINOR "")
set(CARES_VERSION_PATCH "")
set(CARES_VERSION "")
endif()
unset(_CARES_VERSION_MAJOR)
unset(_CARES_VERSION_MINOR)
unset(_CARES_VERSION_PATCH)
unset(_CARES_H_REGEX)
unset(_CARES_H)
#-----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CARES
FOUND_VAR CARES_FOUND
REQUIRED_VARS CARES_LIBRARY CARES_INCLUDE_DIR
VERSION_VAR CARES_VERSION
)
set(CARES_FOUND ${CARES_FOUND})
#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
if(CARES_FOUND)
set(CARES_INCLUDE_DIRS ${CARES_INCLUDE_DIR})
set(CARES_LIBRARIES ${CARES_LIBRARY})
if(NOT TARGET CARES::CARES)
add_library(CARES::CARES UNKNOWN IMPORTED)
set_target_properties(CARES::CARES PROPERTIES
IMPORTED_LOCATION "${CARES_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CARES_INCLUDE_DIRS}"
)
endif()
endif()

View file

@ -0,0 +1,123 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindLibUV
---------
Find libuv includes and library.
Imported Targets
^^^^^^^^^^^^^^^^
An :ref:`imported target <Imported targets>` named
``LibUV::LibUV`` is provided if libuv has been found.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``LibUV_FOUND``
True if libuv was found, false otherwise.
``LibUV_INCLUDE_DIRS``
Include directories needed to include libuv headers.
``LibUV_LIBRARIES``
Libraries needed to link to libuv.
``LibUV_VERSION``
The version of libuv found.
``LibUV_VERSION_MAJOR``
The major version of libuv.
``LibUV_VERSION_MINOR``
The minor version of libuv.
``LibUV_VERSION_PATCH``
The patch version of libuv.
Cache Variables
^^^^^^^^^^^^^^^
This module uses the following cache variables:
``LibUV_LIBRARY``
The location of the libuv library file.
``LibUV_INCLUDE_DIR``
The location of the libuv include directory containing ``uv.h``.
The cache variables should not be used by project code.
They may be set by end users to point at libuv components.
#]=======================================================================]
#-----------------------------------------------------------------------------
find_library(LibUV_LIBRARY
NAMES uv uv_a libuv
)
mark_as_advanced(LibUV_LIBRARY)
find_path(LibUV_INCLUDE_DIR
NAMES uv.h
)
mark_as_advanced(LibUV_INCLUDE_DIR)
#-----------------------------------------------------------------------------
# Extract version number if possible.
set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+")
if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h")
file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv/version.h")
file(STRINGS "${LibUV_INCLUDE_DIR}/uv/version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h")
file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
else()
set(_LibUV_H "")
endif()
foreach(c MAJOR MINOR PATCH)
if(_LibUV_H MATCHES "#[ \t]*define[ \t]+UV_VERSION_${c}[ \t]+([0-9]+)")
set(_LibUV_VERSION_${c} "${CMAKE_MATCH_1}")
else()
unset(_LibUV_VERSION_${c})
endif()
endforeach()
if(DEFINED _LibUV_VERSION_MAJOR AND DEFINED _LibUV_VERSION_MINOR)
set(LibUV_VERSION_MAJOR "${_LibUV_VERSION_MAJOR}")
set(LibUV_VERSION_MINOR "${_LibUV_VERSION_MINOR}")
set(LibUV_VERSION "${LibUV_VERSION_MAJOR}.${LibUV_VERSION_MINOR}")
if(DEFINED _LibUV_VERSION_PATCH)
set(LibUV_VERSION_PATCH "${_LibUV_VERSION_PATCH}")
set(LibUV_VERSION "${LibUV_VERSION}.${LibUV_VERSION_PATCH}")
else()
unset(LibUV_VERSION_PATCH)
endif()
else()
set(LibUV_VERSION_MAJOR "")
set(LibUV_VERSION_MINOR "")
set(LibUV_VERSION_PATCH "")
set(LibUV_VERSION "")
endif()
unset(_LibUV_VERSION_MAJOR)
unset(_LibUV_VERSION_MINOR)
unset(_LibUV_VERSION_PATCH)
unset(_LibUV_H_REGEX)
unset(_LibUV_H)
#-----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUV
FOUND_VAR LibUV_FOUND
REQUIRED_VARS LibUV_LIBRARY LibUV_INCLUDE_DIR
VERSION_VAR LibUV_VERSION
)
set(LIBUV_FOUND ${LibUV_FOUND})
#-----------------------------------------------------------------------------
# Provide documented result variables and targets.
if(LibUV_FOUND)
set(LibUV_INCLUDE_DIRS ${LibUV_INCLUDE_DIR})
set(LibUV_LIBRARIES ${LibUV_LIBRARY})
if(NOT TARGET LibUV::LibUV)
add_library(LibUV::LibUV UNKNOWN IMPORTED)
set_target_properties(LibUV::LibUV PROPERTIES
IMPORTED_LOCATION "${LibUV_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LibUV_INCLUDE_DIRS}"
)
endif()
endif()

206
CMakeModules/FindSDL2.cmake Normal file
View file

@ -0,0 +1,206 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindSDL2
# -------
#
# Locate SDL2 library
#
# This module defines
#
# ::
#
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL
# SDL2_INCLUDE_DIR, where to find SDL.h
# SDL2_VERSION_STRING, human-readable string containing the version of SDL
#
#
#
# This module responds to the flag:
#
# ::
#
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
#
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDLmain which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your
# configuration and no SDL2_LIBRARY, it means CMake did not find your SDL
# library (SDL.dll, libsdl.so, SDL.framework, etc). Set
# SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
# value as appropriate. These values are used to generate the final
# SDL2_LIBRARY variable, but when these values are unset, SDL2_LIBRARY
# does not get created.
#
#
#
# $SDLDIR is an environment variable that would correspond to the
# ./configure --prefix=$SDLDIR used in building SDL. l.e.galup 9-20-02
#
# Modified by Eric Wing. Added code to assist with automated building
# by using environmental variables and providing a more
# controlled/consistent search behavior. Added new modifications to
# recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL
# guidelines. Added a search for SDLmain which is needed by some
# platforms. Added a search for threads which is needed by some
# platforms. Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of SDL2_LIBRARY to
# override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL/SDL.h to just SDL.h
# This needed to change because "proper" SDL convention is #include
# "SDL.h", not <SDL/SDL.h>. This is done for portability reasons
# because not all systems place things in SDL/ (see FreeBSD).
if(NOT SDL2_DIR)
set(SDL2_DIR "" CACHE PATH "SDL2 directory")
endif()
find_path(SDL2_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
${SDL2_DIR}
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDLDIR}
include/SDL2 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()
# SDL-1.1 is the name used by FreeBSD ports...
# don't confuse it for the version number.
find_library(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
ENV SDLDIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
# Hide this cache variable from the user, it's an internal implementation
# detail. The documented library variable for the user is SDL2_LIBRARY
# which is derived from SDL2_LIBRARY_TEMP further below.
set_property(CACHE SDL2_LIBRARY_TEMP PROPERTY TYPE INTERNAL)
if(NOT SDL2_BUILDING_LIBRARY)
if(NOT SDL2_INCLUDE_DIR MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDLmain for compatibility even though they don't
# necessarily need it.
find_library(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
ENV SDLDIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
PATHS
/sw
/opt/local
/opt/csw
/opt
)
endif()
endif()
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
if(NOT APPLE)
find_package(Threads)
endif()
# MinGW needs an additional link flag, -mwindows
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows
if(MINGW)
set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW")
endif()
if(SDL2_LIBRARY_TEMP)
# For SDLmain
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
list(FIND SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" _SDL2_MAIN_INDEX)
if(_SDL2_MAIN_INDEX EQUAL -1)
set(SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
endif()
unset(_SDL2_MAIN_INDEX)
endif()
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
if(APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
endif()
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
if(NOT APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()
# For MinGW library
if(MINGW)
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
endif()
if(WIN32 AND NOT WINDOWS_STORE AND NOT WINDOWS_PHONE)
set(SDL2_LIBRARY_TEMP winmm imm32 version msimg32 ${SDL2_LIBRARY_TEMP})
endif(WIN32 AND NOT WINDOWS_STORE AND NOT WINDOWS_PHONE)
# Set the final string here so the GUI reflects the final state.
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
endif()
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL2_version.h")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
unset(SDL2_VERSION_MAJOR_LINE)
unset(SDL2_VERSION_MINOR_LINE)
unset(SDL2_VERSION_PATCH_LINE)
unset(SDL2_VERSION_MAJOR)
unset(SDL2_VERSION_MINOR)
unset(SDL2_VERSION_PATCH)
endif()
set(SDL2_LIBRARIES ${SDL2_LIBRARY})
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
REQUIRED_VARS SDL2_LIBRARIES SDL2_INCLUDE_DIRS
VERSION_VAR SDL2_VERSION_STRING)
mark_as_advanced(SDL2_LIBRARY SDL2_INCLUDE_DIR)

View file

@ -16,16 +16,62 @@ set(BINREC_ENABLE_ASSERT FALSE CACHE BOOL "Enable basic assertion checks")
add_subdirectory(libbinrec)
set_target_properties(binrec PROPERTIES FOLDER libraries)
# catch
add_library(catch2 INTERFACE IMPORTED GLOBAL)
set_target_properties(catch2 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/catch/single_include/catch2")
# cereal
add_library(cereal INTERFACE IMPORTED GLOBAL)
set_target_properties(cereal PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/cereal/include")
# cnl
add_library(cnl INTERFACE IMPORTED GLOBAL)
set_target_properties(cnl PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/cnl/include")
# cpptoml
add_library(cpptoml INTERFACE IMPORTED GLOBAL)
set_target_properties(cpptoml PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CPPTOML_USE_MAP"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/cpptoml/include")
# excmd
add_library(excmd INTERFACE IMPORTED GLOBAL)
set_target_properties(excmd PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/excmd/src")
# fmt
add_subdirectory(fmt)
set_target_properties(fmt PROPERTIES FOLDER libraries)
# glslang
if(DECAF_VULKAN OR DECAF_BUILD_TOOLS)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "glslang: BUILD_SHARED_LIBS" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "glslang: BUILD_TESTING" FORCE)
set(ENABLE_HLSL OFF CACHE BOOL "glslang: ENABLE_HLSL" FORCE)
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "glslang: ENABLE_GLSLANG_BINARIES" FORCE)
set(ENABLE_OPT ON CACHE BOOL "glslang: ENABLE_OPT" FORCE)
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "glslang: ENABLE_SPVREMAPPER" FORCE)
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "glslang: SKIP_GLSLANG_INSTALL" FORCE)
add_subdirectory(glslang)
endif()
# gsl
add_library(gsl INTERFACE IMPORTED GLOBAL)
set_target_properties(gsl PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "GSL_THROWS_FOR_TESTING"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/gsl-lite/include")
# imgui
add_library(imgui STATIC
"imgui/imgui.cpp"
"imgui/imgui_draw.cpp")
set_target_properties(imgui PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/imgui"
FOLDER libraries)
# ovsocket
add_library(ovsocket INTERFACE IMPORTED GLOBAL)
set_target_properties(ovsocket PROPERTIES
@ -36,6 +82,18 @@ add_library(peglib INTERFACE IMPORTED GLOBAL)
set_target_properties(peglib PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/cpp-peglib")
# pugixml
add_library(pugixml STATIC
"pugixml/src/pugixml.cpp")
set_target_properties(pugixml PROPERTIES
FOLDER libraries
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src")
# spdlog
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Use external fmt library instead of bundled" FORCE)
add_subdirectory(spdlog)
set_target_properties(spdlog PROPERTIES FOLDER libraries)
# Qt Advanced Docking System
if(DECAF_QT)
set(BUILD_STATIC TRUE CACHE BOOL "ADS: Build the static library")

1
libraries/catch Submodule

@ -0,0 +1 @@
Subproject commit c4e3767e265808590986d5db6ca1b5532a7f3d13

1
libraries/cereal Submodule

@ -0,0 +1 @@
Subproject commit 1de8fe89471d69ea392ea260ce74e079d5f4b415

1
libraries/cpptoml Submodule

@ -0,0 +1 @@
Subproject commit 5a6d92731aa8c2d1b2eb2741b1ea982967f77029

1
libraries/fmt Submodule

@ -0,0 +1 @@
Subproject commit b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9

1
libraries/glslang Submodule

@ -0,0 +1 @@
Subproject commit c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5

1
libraries/gsl-lite Submodule

@ -0,0 +1 @@
Subproject commit 4b796627ad0fa42640f5fdb96f23c4a0d9ee084f

1
libraries/imgui Submodule

@ -0,0 +1 @@
Subproject commit 512c54bbc062c41c74f8a8bd8ff1fd6bebd1e6d0

1
libraries/pugixml Submodule

@ -0,0 +1 @@
Subproject commit 08b3433180727ea2f78fe02e860a08471db1e03c

1
libraries/spdlog Submodule

@ -0,0 +1 @@
Subproject commit eb3220622e73a4889eee355ffa37972b3cac3df5

View file

@ -11,7 +11,7 @@ GroupSources("Source Files" src)
target_link_libraries(common
cnl
fmt::fmt
gsl::gsl-lite
gsl
spdlog::spdlog)
if(MSVC)

View file

@ -7,9 +7,6 @@ file(GLOB_RECURSE HEADER_FILES *.h)
add_executable(decaf-cli ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(decaf-cli PRIVATE
${CPPTOML_INCLUDE_DIRS})
target_link_libraries(decaf-cli
common
libconfig

View file

@ -38,7 +38,6 @@ GroupSources("UI Files" ui)
GroupSources("Resource Files" resources)
target_include_directories(decaf-qt PRIVATE
${CPPTOML_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS})
target_link_libraries(decaf-qt

View file

@ -19,7 +19,6 @@ add_executable(decaf-sdl
${RESOURCE_FILES})
target_include_directories(decaf-sdl PRIVATE
${CPPTOML_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS})
target_link_libraries(decaf-sdl

View file

@ -9,11 +9,10 @@ file(GLOB_RECURSE HEADER_FILES *.h)
add_library(libconfig STATIC ${SOURCE_FILES} ${HEADER_FILES})
GroupSources("Source Files" src)
target_include_directories(libconfig PRIVATE ${CPPTOML_INCLUDE_DIRS})
target_link_libraries(libconfig
common
libcpu
libdecaf
libgpu
cpptoml
excmd)

View file

@ -21,17 +21,14 @@ target_link_libraries(libdecaf
target_link_libraries(libdecaf
cnl
imgui::imgui
c-ares::cares
CURL::libcurl
OpenSSL::SSL
pugixml::pugixml
unofficial::libuv::libuv
ZLIB::ZLIB
FFMPEG::AVCODEC
FFMPEG::AVFILTER
FFMPEG::AVUTIL
FFMPEG::SWSCALE)
imgui
pugixml
${CARES_LIBRARY}
${CURL_LIBRARY}
${OPENSSL_LIBRARY}
${LIBUV_LIBRARY}
${ZLIB_LIBRARY}
${FFMPEG_LIBRARY})
if(MSVC)
target_link_libraries(libdecaf Crypt32 ws2_32 Psapi IPHLPAPI userenv)

View file

@ -2,8 +2,8 @@
#ifdef DECAF_VULKAN
#include <common/bit_cast.h>
#include <common/strutils.h>
#include <glslang/SPIRV/SpvBuilder.h>
#include <glslang/SPIRV/GLSL.std.450.h>
#include <SPIRV/SpvBuilder.h>
#include <SPIRV/GLSL.std.450.h>
namespace spirv
{

View file

@ -2,7 +2,7 @@
#include "spirv_transpiler.h"
#include "latte/latte_disassembler.h"
#include <glslang/SPIRV/disassemble.h>
#include <SPIRV/disassemble.h>
#include <regex>
namespace spirv

View file

@ -8,19 +8,10 @@
"features": ["avcodec", "avfilter", "swscale"]
},
"c-ares",
"catch2",
"cereal",
"cpptoml",
"curl",
"fmt",
"glslang",
"gsl-lite",
"imgui",
"libuv",
"openssl",
"pugixml",
"sdl2",
"spdlog",
"zlib"
]
}
}