Skip to content

Instantly share code, notes, and snippets.

@romatthe
Created August 25, 2022 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romatthe/81505a322e1afa00f9f0081985ea105b to your computer and use it in GitHub Desktop.
Save romatthe/81505a322e1afa00f9f0081985ea105b to your computer and use it in GitHub Desktop.
cemu
{ lib
, clangStdenv
, fetchFromGitHub
, cmake
, ninja
, nasm
, pkg-config
, boost
, curl
, freeglut
, glslang
, gtk3
, imgui
, libsecret
, libgcrypt
, libzip
, pugixml
, rapidjson
, SDL2
, vulkan-headers
, vulkan-loader
, wxGTK31
, zlib
, zstd
}:
let
zstd-static = zstd.overrideAttrs (oldAttrs: rec {
static = true;
});
in
clangStdenv.mkDerivation rec {
pname = "cemu-emu";
version = "2.0";
src = fetchFromGitHub {
owner = "cemu-project";
repo = "cemu";
rev = "v${version}";
sha256 = "5DgG+EgKLXtLWS1u01j8GM8c+h5Uv/l/dS3x/t4qIW4=";
fetchSubmodules = true;
};
patches = [
./patches/no-vcpkg.patch
];
cmakeFlags = [
"-DCMAKE_MAKE_PROGRAM=ninja"
"-DENABLE_WXWIDGETS=0"
];
nativeBuildInputs = [
cmake
ninja
nasm
pkg-config
];
buildInputs = [
boost
curl
freeglut
glslang
gtk3
imgui
libsecret
libgcrypt
libzip
pugixml
rapidjson
SDL2
vulkan-headers
vulkan-loader
wxGTK31
zstd.out
];
# hardeningDisable = [ "format" ];
preConfigure = ''
'';
# meta = with lib; {
# homepage = "";
# description = "An open-source Nintendio Wii U emulator";
# longDescription = ''
# '';
# license = licenses.;
# maintainers = [ ];
# platforms = platforms.unix;
# };
}
diff --git a/.gitmodules b/.gitmodules
index 04f0118..e504d54 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -6,7 +6,3 @@
path = dependencies/cubeb
url = https://github.com/mozilla/cubeb
shallow = true
-[submodule "dependencies/vcpkg"]
- path = dependencies/vcpkg
- url = https://github.com/microsoft/vcpkg
- shallow = true
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6104c17..67453b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,10 +11,6 @@ if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
endif()
-set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
-set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
- CACHE STRING "Vcpkg toolchain file")
-
project(Cemu VERSION 0.1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -60,13 +56,13 @@ option(ENABLE_CUBEB "Enabled cubeb backend" ON)
option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
find_package(SDL2 CONFIG REQUIRED)
-find_package(CURL CONFIG REQUIRED)
+find_package(CURL REQUIRED)
find_package(pugixml CONFIG REQUIRED)
-find_package(imgui CONFIG REQUIRED)
+#find_package(imgui CONFIG REQUIRED)
find_package(RapidJSON CONFIG REQUIRED)
find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
find_package(libzip REQUIRED)
-find_package(glslang REQUIRED)
+#find_package(glslang REQUIRED)
find_package(ZLIB REQUIRED)
find_package(zstd CONFIG REQUIRED)
@@ -95,7 +91,7 @@ link_libraries(${Boost_LIBRARIES})
link_libraries(${X11_LIBRARIES})
link_libraries(SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
if(ENABLE_WXWIDGETS)
-link_libraries(wx::core wx::base)
+ link_libraries(wxWidgets REQUIRED COMPONENTS core base)
endif()
if(ENABLE_CUBEB)
diff --git a/dependencies/vcpkg_overlay_ports/fmt/fix-warning4189.patch b/dependencies/vcpkg_overlay_ports/fmt/fix-warning4189.patch
deleted file mode 100644
index 0efab0f..0000000
--- a/dependencies/vcpkg_overlay_ports/fmt/fix-warning4189.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/include/fmt/format.h b/include/fmt/format.h
-index 4e96539..0f1d179 100644
---- a/include/fmt/format.h
-+++ b/include/fmt/format.h
-@@ -33,6 +33,7 @@
- #ifndef FMT_FORMAT_H_
- #define FMT_FORMAT_H_
-
-+#pragma warning(disable:4189)
- #include <algorithm>
- #include <cerrno>
- #include <cmath>
diff --git a/dependencies/vcpkg_overlay_ports/fmt/portfile.cmake b/dependencies/vcpkg_overlay_ports/fmt/portfile.cmake
deleted file mode 100644
index aef43b4..0000000
--- a/dependencies/vcpkg_overlay_ports/fmt/portfile.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-vcpkg_from_github(
- OUT_SOURCE_PATH SOURCE_PATH
- REPO fmtlib/fmt
- REF 7bdf0628b1276379886c7f6dda2cef2b3b374f0b # v7.1.3
- SHA512 52ea8f9d2c0cb52ec3a740e38fcdfd6a0318566e3b599bd2e8d557168642d005c0a59bc213cff2641a88fed3bb771d15f46c39035ccd64809569af982aba47aa
- HEAD_REF master
- PATCHES fix-warning4189.patch
-)
-
-vcpkg_cmake_configure(
- SOURCE_PATH ${SOURCE_PATH}
- DISABLE_PARALLEL_CONFIGURE # with MSBuild (on UWP), fmt writes into the source directory
- OPTIONS
- -DFMT_CMAKE_DIR=share/fmt
- -DFMT_TEST=OFF
- -DFMT_DOC=OFF
-)
-
-vcpkg_cmake_install()
-file(INSTALL ${SOURCE_PATH}/LICENSE.rst DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
-if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
- if(VCPKG_TARGET_IS_WINDOWS)
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
- if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/fmtd.dll")
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/fmtd.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fmtd.dll)
- endif()
- endif()
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
- if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/fmt.dll")
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
- file(RENAME ${CURRENT_PACKAGES_DIR}/lib/fmt.dll ${CURRENT_PACKAGES_DIR}/bin/fmt.dll)
- endif()
- endif()
- endif()
-
- vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/fmt/core.h
- "defined(FMT_SHARED)"
- "1"
- )
-endif()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-
-vcpkg_cmake_config_fixup()
-vcpkg_fixup_pkgconfig()
-
-if(VCPKG_TARGET_IS_WINDOWS)
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
- vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake
- "lib/fmtd.dll"
- "bin/fmtd.dll"
- )
- endif()
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
- vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake
- "lib/fmt.dll"
- "bin/fmt.dll"
- )
- endif()
-endif()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
-
-# Handle post-build CMake instructions
-vcpkg_copy_pdbs()
-file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/dependencies/vcpkg_overlay_ports/fmt/usage b/dependencies/vcpkg_overlay_ports/fmt/usage
deleted file mode 100644
index c9988aa..0000000
--- a/dependencies/vcpkg_overlay_ports/fmt/usage
+++ /dev/null
@@ -1,7 +0,0 @@
-The package fmt provides CMake targets:
-
- find_package(fmt CONFIG REQUIRED)
- target_link_libraries(main PRIVATE fmt::fmt)
-
- # Or use the header-only version
- target_link_libraries(main PRIVATE fmt::fmt-header-only)
diff --git a/dependencies/vcpkg_overlay_ports/fmt/vcpkg.json b/dependencies/vcpkg_overlay_ports/fmt/vcpkg.json
deleted file mode 100644
index 880adf3..0000000
--- a/dependencies/vcpkg_overlay_ports/fmt/vcpkg.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "fmt",
- "version": "7.1.3",
- "port-version": 2,
- "description": "Formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams.",
- "homepage": "https://github.com/fmtlib/fmt",
- "dependencies": [
- {
- "name": "vcpkg-cmake",
- "host": true
- },
- {
- "name": "vcpkg-cmake-config",
- "host": true
- }
- ]
-}
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/example/CMakeLists.txt b/dependencies/vcpkg_overlay_ports/wxwidgets/example/CMakeLists.txt
deleted file mode 100644
index 229b710..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/example/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-cmake_minimum_required(VERSION 3.7)
-
-project(wxwidgets-example)
-
-add_executable(main WIN32 popup.cpp)
-
-find_package(wxWidgets REQUIRED)
-target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$<CONFIG:DEBUG>:${wxWidgets_DEFINITIONS_DEBUG}>")
-target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS})
-target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})
-
-add_executable(main2 WIN32 popup.cpp)
-
-find_package(wxWidgets CONFIG REQUIRED)
-target_link_libraries(main2 PRIVATE wx::core wx::base)
-
-option(USE_WXRC "Use the wxrc resource compiler" ON)
-if(USE_WXRC)
- execute_process(
- COMMAND "${wxWidgets_wxrc_EXECUTABLE}" --help
- RESULTS_VARIABLE error_result
- )
- if(error_result)
- message(FATAL_ERROR "Failed to run wxWidgets_wxrc_EXECUTABLE (${wxWidgets_wxrc_EXECUTABLE})")
- endif()
-endif()
-
-set(PRINT_VARS "" CACHE STRING "Variables to print at the end of configuration")
-foreach(var IN LISTS PRINT_VARS)
- message(STATUS "${var}:=${${var}}")
-endforeach()
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/fix-libs-export.patch b/dependencies/vcpkg_overlay_ports/wxwidgets/fix-libs-export.patch
deleted file mode 100644
index 064c3a7..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/fix-libs-export.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake
-index 52ae69d3f6..f261d5d262 100644
---- a/build/cmake/config.cmake
-+++ b/build/cmake/config.cmake
-@@ -39,8 +39,14 @@ macro(wx_get_dependencies var lib)
- else()
- # For the value like $<$<CONFIG:DEBUG>:LIB_PATH>
- # Or $<$<NOT:$<CONFIG:DEBUG>>:LIB_PATH>
-- string(REGEX REPLACE "^.+>:(.+)>$" "\\1" dep_name ${dep})
-- if (NOT dep_name)
-+ if(dep MATCHES "^(.+>):(.+)>$")
-+ if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_MATCH_1 STREQUAL [[$<$<NOT:$<CONFIG:DEBUG>>]])
-+ continue()
-+ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_MATCH_1 STREQUAL [[$<$<CONFIG:DEBUG>]])
-+ continue()
-+ endif()
-+ set(dep_name "${CMAKE_MATCH_2}")
-+ else()
- set(dep_name ${dep})
- endif()
- endif()
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/fix-pcre2.patch b/dependencies/vcpkg_overlay_ports/wxwidgets/fix-pcre2.patch
deleted file mode 100644
index 20063f4..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/fix-pcre2.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git a/build/cmake/modules/FindPCRE2.cmake b/build/cmake/modules/FindPCRE2.cmake
-index a27693a..455675a 100644
---- a/build/cmake/modules/FindPCRE2.cmake
-+++ b/build/cmake/modules/FindPCRE2.cmake
-@@ -24,7 +24,10 @@ set(PCRE2_CODE_UNIT_WIDTH_USED "${PCRE2_CODE_UNIT_WIDTH}" CACHE INTERNAL "")
-
- find_package(PkgConfig QUIET)
- pkg_check_modules(PC_PCRE2 QUIET libpcre2-${PCRE2_CODE_UNIT_WIDTH})
-+set(PCRE2_LIBRARIES ${PC_PCRE2_LINK_LIBRARIES})
-+set(PCRE2_INCLUDE_DIRS ${PC_PCRE2_INCLUDE_DIRS})
-
-+if (0)
- find_path(PCRE2_INCLUDE_DIRS
- NAMES pcre2.h
- HINTS ${PC_PCRE2_INCLUDEDIR}
-@@ -36,6 +39,7 @@ find_library(PCRE2_LIBRARIES
- HINTS ${PC_PCRE2_LIBDIR}
- ${PC_PCRE2_LIBRARY_DIRS}
- )
-+endif()
-
- include(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 REQUIRED_VARS PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS VERSION_VAR PC_PCRE2_VERSION)
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/gtk3-link-libraries.patch b/dependencies/vcpkg_overlay_ports/wxwidgets/gtk3-link-libraries.patch
deleted file mode 100644
index fe2736b..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/gtk3-link-libraries.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake
-index d2939a1..daf33fe 100644
---- a/build/cmake/modules/FindGTK3.cmake
-+++ b/build/cmake/modules/FindGTK3.cmake
-@@ -47,6 +47,7 @@ include(CheckSymbolExists)
- set(CMAKE_REQUIRED_INCLUDES ${GTK3_INCLUDE_DIRS})
- check_symbol_exists(GDK_WINDOWING_WAYLAND "gdk/gdk.h" wxHAVE_GDK_WAYLAND)
- check_symbol_exists(GDK_WINDOWING_X11 "gdk/gdk.h" wxHAVE_GDK_X11)
-+set(GTK3_LIBRARIES "${GTK3_LINK_LIBRARIES}" CACHE INTERNAL "")
- include(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
-
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/install-layout.patch b/dependencies/vcpkg_overlay_ports/wxwidgets/install-layout.patch
deleted file mode 100644
index e55381d..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/install-layout.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake
-index 32bd959..74f31ed 100644
---- a/build/cmake/functions.cmake
-+++ b/build/cmake/functions.cmake
-@@ -418,7 +418,7 @@ macro(wx_add_library name)
- set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short})
-
- # Setup install
-- set(runtime_dir "lib")
-+ set(runtime_dir "bin")
- if(WIN32 AND NOT WIN32_MSVC_NAMING)
- # configure puts the .dll in the bin directory
- set(runtime_dir "bin")
-diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake
-index 3ff14ab..7bd00d3 100644
---- a/build/cmake/init.cmake
-+++ b/build/cmake/init.cmake
-@@ -146,7 +146,7 @@ if(WIN32)
- endif()
- endif()
-
--if(WIN32_MSVC_NAMING)
-+if(0)
- if(wxBUILD_SHARED)
- set(lib_suffix "_dll")
- else()
-diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake
-index 84cb9f5..e2f460a 100644
---- a/build/cmake/install.cmake
-+++ b/build/cmake/install.cmake
-@@ -48,7 +48,7 @@ else()
-
- install(DIRECTORY DESTINATION "bin")
- install(CODE "execute_process( \
-- COMMAND ${CMAKE_COMMAND} -E create_symlink \
-+ COMMAND ${CMAKE_COMMAND} -E copy \
- ${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID} \
- ${CMAKE_INSTALL_PREFIX}/bin/wx-config \
- )"
-diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt
-index d6b3465..870897b 100644
---- a/build/cmake/utils/CMakeLists.txt
-+++ b/build/cmake/utils/CMakeLists.txt
-@@ -38,7 +38,7 @@ if(wxUSE_XRC)
- endif()
-
- wx_install(CODE "execute_process( \
-- COMMAND ${CMAKE_COMMAND} -E create_symlink \
-+ COMMAND ${CMAKE_COMMAND} -E copy \
- ${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX} \
- ${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \
- )"
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/nanosvg-ext-depend.patch b/dependencies/vcpkg_overlay_ports/wxwidgets/nanosvg-ext-depend.patch
deleted file mode 100644
index 029b8c7..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/nanosvg-ext-depend.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff --git a/build/cmake/lib/nanosvg.cmake b/build/cmake/lib/nanosvg.cmake
-index 401bf48..b9e4b57 100644
---- a/build/cmake/lib/nanosvg.cmake
-+++ b/build/cmake/lib/nanosvg.cmake
-@@ -16,9 +16,9 @@ elseif(wxUSE_NANOSVG)
- set(NANOSVG_INCLUDE_DIRS )
- set(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL TRUE)
-
-- find_package(NanoSVG REQUIRED)
-+ find_package(unofficial-nanosvg CONFIG REQUIRED)
-
-- foreach(TARGETNAME NanoSVG::nanosvg NanoSVG::nanosvgrast unofficial::nanosvg)
-+ foreach(TARGETNAME unofficial::nanosvg::nanosvg)
- if(NOT TARGET ${TARGETNAME})
- continue()
- endif()
-diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake
-index 49c536a..5630526 100644
---- a/build/cmake/options.cmake
-+++ b/build/cmake/options.cmake
-@@ -114,7 +114,7 @@ wx_add_thirdparty_library(wxUSE_EXPAT EXPAT "use expat for XML parsing" DEFAULT_
- wx_add_thirdparty_library(wxUSE_LIBJPEG JPEG "use libjpeg (JPEG file format)")
- wx_add_thirdparty_library(wxUSE_LIBPNG PNG "use libpng (PNG image format)")
- wx_add_thirdparty_library(wxUSE_LIBTIFF TIFF "use libtiff (TIFF file format)")
--wx_add_thirdparty_library(wxUSE_NANOSVG NanoSVG "use NanoSVG for rasterizing SVG")
-+wx_add_thirdparty_library(wxUSE_NANOSVG unofficial-nanosvg "use NanoSVG for rasterizing SVG")
-
- wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF)
- set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression")
-diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in
-index 6ef5a6e..248a701 100644
---- a/build/cmake/wxWidgetsConfig.cmake.in
-+++ b/build/cmake/wxWidgetsConfig.cmake.in
-@@ -1,5 +1,8 @@
- @PACKAGE_INIT@
-
-+include(CMakeFindDependencyMacro)
-+find_dependency(unofficial-nanosvg CONFIG)
-+
- # determine target from compiler, platform and library type
- if(WIN32 AND NOT CYGWIN AND NOT MSYS)
- if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/portfile.cmake b/dependencies/vcpkg_overlay_ports/wxwidgets/portfile.cmake
deleted file mode 100644
index 984fc08..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/portfile.cmake
+++ /dev/null
@@ -1,236 +0,0 @@
-vcpkg_from_github(
- OUT_SOURCE_PATH SOURCE_PATH
- REPO wxWidgets/wxWidgets
- REF v3.2.0
- SHA512 0bb40ccab51f5e83a38feeaf462c9d1852f821d19592328327f829890d89a3abb2a991c43cdbac55da8f5ee40aab8bd5fea6abcd052198302770292f92f9f9ad
- HEAD_REF master
- PATCHES
- install-layout.patch
- relocatable-wx-config.patch
- fix-libs-export.patch
- fix-pcre2.patch
- gtk3-link-libraries.patch
-)
-
-if(VCPKG_TARGET_IS_LINUX)
- message(WARNING [[
-Port wxwidgets currently requires the following packages from the system package manager:
- pkg-config
- GTK 3
- libsecret
- libgcrypt
- libsystemd
-These development packages can be installed on Ubuntu systems via
- sudo apt-get install pkg-config libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev
-]])
- foreach(conflicting_port IN ITEMS freetype glib)
- if(EXISTS "${CURRENT_INSTALLED_DIR}/share/${conflicting_port}/copyright")
- message(FATAL_ERROR "Port ${conflicting_port} must not be installed when building ${PORT}:${TARGET_TRIPLET}.")
- endif()
- endforeach()
-endif()
-
-vcpkg_check_features(
- OUT_FEATURE_OPTIONS FEATURE_OPTIONS
- FEATURES
- sound wxUSE_SOUND
- fonts wxUSE_PRIVATE_FONTS
-)
-
-set(OPTIONS_RELEASE "")
-if(NOT "debug-support" IN_LIST FEATURES)
- list(APPEND OPTIONS_RELEASE "-DwxBUILD_DEBUG_LEVEL=0")
-endif()
-
-set(OPTIONS "")
-if(VCPKG_TARGET_IS_WINDOWS AND (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm"))
- list(APPEND OPTIONS
- -DwxUSE_OPENGL=OFF
- -DwxUSE_STACKWALKER=OFF
- )
-endif()
-
-if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_OSX)
- list(APPEND OPTIONS -DwxUSE_WEBREQUEST_CURL=OFF)
-else()
- list(APPEND OPTIONS -DwxUSE_WEBREQUEST_CURL=ON)
-endif()
-
-if(DEFINED ENV{PKG_CONFIG})
- set(PKGCONFIG "$ENV{PKG_CONFIG}")
-elseif(VCPKG_TARGET_IS_LINUX AND NOT VCPKG_CROSSCOMPILING)
- # wxWidgets on Linux currently needs to find the system's `gtk+-3.0.pc`.
- # vcpkg's port pkgconf would prevent this lookup.
- find_program(system_pkg_config NAMES pkg-config)
- if(system_pkg_config)
- set(PKGCONFIG "${system_pkg_config}")
- endif()
- if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
- list(APPEND OPTIONS -DPKG_CONFIG_ARGN=--static)
- endif()
-endif()
-vcpkg_find_acquire_program(PKGCONFIG)
-
-# This may be set to ON by users in a custom triplet.
-# The use of 'wxUSE_STL' and 'WXWIDGETS_USE_STD_CONTAINERS' (ON or OFF) are not API compatible
-# which is why they must be set in a custom triplet rather than a port feature.
-if(NOT DEFINED WXWIDGETS_USE_STL)
- #set(WXWIDGETS_USE_STL OFF)
-endif()
-
-if(NOT DEFINED WXWIDGETS_USE_STD_CONTAINERS)
- set(WXWIDGETS_USE_STD_CONTAINERS OFF)
-endif()
-
-vcpkg_cmake_configure(
- SOURCE_PATH "${SOURCE_PATH}"
- OPTIONS
- ${FEATURE_OPTIONS}
- -DwxUSE_REGEX=sys
- -DwxUSE_ZLIB=sys
- -DwxUSE_EXPAT=sys
- -DwxUSE_LIBJPEG=sys
- -DwxUSE_LIBPNG=sys
- -DwxUSE_LIBTIFF=sys
- -DwxUSE_SECRETSTORE=FALSE
- -DwxUSE_STL=ON
- -DwxUSE_STD_CONTAINERS=${WXWIDGETS_USE_STD_CONTAINERS}
- -DwxBUILD_DISABLE_PLATFORM_LIB_DIR=ON
- -DwxUSE_LIBLZMA=OFF
- -DwxUSE_JOYSTICK=OFF
- -DwxUSE_SOCKETS=OFF
- -DwxUSE_IPV6=OFF
- -DwxUSE_FS_ZIP=OFF
- -DwxUSE_FS_ARCHIVE=OFF
- -DwxUSE_FS_INET=OFF
- -DwxUSE_ARCHIVE_STREAMS=OFF
- -DwxUSE_ZIPSTREAM=OFF
- -DwxUSE_TARSTREAM=OFF
- -DwxUSE_PROTOCOL=OFF
- -DwxUSE_PROTOCOL_FTP=OFF
- -DwxUSE_PROTOCOL_HTTP=OFF
- -DwxUSE_URL=OFF
- -DwxUSE_SOUND=OFF
- -DwxUSE_WEBVIEW=OFF
- -DwxUSE_RICHTEXT=OFF
- -DwxUSE_SVG=OFF
- -DwxUSE_GIF=OFF
- -DwxUSE_PNM=OFF
- -DwxUSE_PCX=OFF
- -DwxUSE_WEBREQUEST=OFF
- -DwxUSE_ACTIVEX=OFF
- -DwxUSE_REGEX=OFF
- -DwxUSE_NANOSVG=OFF
- -DwxUSE_NANOSVG_EXTERNAL=OFF
- ${OPTIONS}
- "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
- # The minimum cmake version requirement for Cotire is 2.8.12.
- # however, we need to declare that the minimum cmake version requirement is at least 3.1 to use CMAKE_PREFIX_PATH as the path to find .pc.
- -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON
- OPTIONS_RELEASE
- ${OPTIONS_RELEASE}
-)
-
-vcpkg_cmake_install()
-vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/wxWidgets)
-
-# The CMake export is not ready for use: It lacks a config file.
-file(REMOVE_RECURSE
- ${CURRENT_PACKAGES_DIR}/lib/cmake
- ${CURRENT_PACKAGES_DIR}/debug/lib/cmake
-)
-
-set(tools wxrc)
-if(NOT VCPKG_TARGET_IS_WINDOWS OR NOT VCPKG_HOST_IS_WINDOWS)
- list(APPEND tools wxrc-3.2)
- file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
- file(RENAME "${CURRENT_PACKAGES_DIR}/bin/wx-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wx-config")
- if(NOT VCPKG_BUILD_TYPE)
- file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug")
- file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/wx-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/wx-config")
- endif()
-endif()
-vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN)
-
-# do the copy pdbs now after the dlls got moved to the expected /bin folder above
-vcpkg_copy_pdbs()
-
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/msvc")
-file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
-file(GLOB_RECURSE INCLUDES "${CURRENT_PACKAGES_DIR}/include/*.h")
-if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/mswu/wx/setup.h")
- list(APPEND INCLUDES "${CURRENT_PACKAGES_DIR}/lib/mswu/wx/setup.h")
-endif()
-if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h")
- list(APPEND INCLUDES "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h")
-endif()
-foreach(INC IN LISTS INCLUDES)
- file(READ "${INC}" _contents)
- if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
- string(REPLACE "defined(WXUSINGDLL)" "0" _contents "${_contents}")
- else()
- string(REPLACE "defined(WXUSINGDLL)" "1" _contents "${_contents}")
- endif()
- # Remove install prefix from setup.h to ensure package is relocatable
- string(REGEX REPLACE "\n#define wxINSTALL_PREFIX [^\n]*" "\n#define wxINSTALL_PREFIX \"\"" _contents "${_contents}")
- file(WRITE "${INC}" "${_contents}")
-endforeach()
-
-if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/include/wx/setup.h")
- file(GLOB_RECURSE WX_SETUP_H_FILES_DBG "${CURRENT_PACKAGES_DIR}/debug/lib/*.h")
- file(GLOB_RECURSE WX_SETUP_H_FILES_REL "${CURRENT_PACKAGES_DIR}/lib/*.h")
-
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
- vcpkg_replace_string("${WX_SETUP_H_FILES_REL}" "${CURRENT_PACKAGES_DIR}" "")
-
- string(REPLACE "${CURRENT_PACKAGES_DIR}/lib/" "" WX_SETUP_H_FILES_REL "${WX_SETUP_H_FILES_REL}")
- string(REPLACE "/setup.h" "" WX_SETUP_H_REL_RELATIVE "${WX_SETUP_H_FILES_REL}")
- endif()
- if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
- vcpkg_replace_string("${WX_SETUP_H_FILES_DBG}" "${CURRENT_PACKAGES_DIR}" "")
-
- string(REPLACE "${CURRENT_PACKAGES_DIR}/debug/lib/" "" WX_SETUP_H_FILES_DBG "${WX_SETUP_H_FILES_DBG}")
- string(REPLACE "/setup.h" "" WX_SETUP_H_DBG_RELATIVE "${WX_SETUP_H_FILES_DBG}")
- endif()
-
- configure_file("${CMAKE_CURRENT_LIST_DIR}/setup.h.in" "${CURRENT_PACKAGES_DIR}/include/wx/setup.h" @ONLY)
-endif()
-
-file(GLOB configs LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/lib/wx/config/*" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/wx-config")
-foreach(config IN LISTS configs)
- vcpkg_replace_string("${config}" "${CURRENT_INSTALLED_DIR}" [[${prefix}]])
-endforeach()
-file(GLOB configs LIST_DIRECTORIES false "${CURRENT_PACKAGES_DIR}/debug/lib/wx/config/*" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/wx-config")
-foreach(config IN LISTS configs)
- vcpkg_replace_string("${config}" "${CURRENT_INSTALLED_DIR}/debug" [[${prefix}]])
-endforeach()
-
-# For CMake multi-config in connection with wrapper
-if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h")
- file(INSTALL "${CURRENT_PACKAGES_DIR}/debug/lib/mswud/wx/setup.h"
- DESTINATION "${CURRENT_PACKAGES_DIR}/lib/mswud/wx"
- )
-endif()
-
-if(NOT "debug-support" IN_LIST FEATURES)
- if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_HOST_IS_WINDOWS)
- vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/wx/debug.h" "#define wxDEBUG_LEVEL 1" "#define wxDEBUG_LEVEL 0")
- else()
- vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/wx-3.2/wx/debug.h" "#define wxDEBUG_LEVEL 1" "#define wxDEBUG_LEVEL 0")
- endif()
-endif()
-
-if("example" IN_LIST FEATURES)
- file(INSTALL
- "${CMAKE_CURRENT_LIST_DIR}/example/CMakeLists.txt"
- "${SOURCE_PATH}/samples/popup/popup.cpp"
- "${SOURCE_PATH}/samples/sample.xpm"
- DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/example"
- )
- vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/example/popup.cpp" "../sample.xpm" "sample.xpm")
-endif()
-
-configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
-
-file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
-file(INSTALL "${SOURCE_PATH}/docs/licence.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/relocatable-wx-config.patch b/dependencies/vcpkg_overlay_ports/wxwidgets/relocatable-wx-config.patch
deleted file mode 100644
index 8a5e7c4..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/relocatable-wx-config.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-diff --git a/wx-config.in b/wx-config.in
-index 441f88c..b326867 100755
---- a/wx-config.in
-+++ b/wx-config.in
-@@ -91,7 +91,7 @@ EOF
-
-
- # Contentious tools determined by configure.
--EGREP="@EGREP@"
-+EGREP="grep -E" # no absolute path from host
-
-
- # For the people who know what they want, or think they do:
-@@ -402,8 +402,23 @@ is_cross() { [ "x@cross_compiling@" = "xyes" ]; }
-
-
- # Determine the base directories we require.
--prefix=${input_option_prefix-${this_prefix:-@prefix@}}
--exec_prefix=${input_option_exec_prefix-${input_option_prefix-${this_exec_prefix:-@exec_prefix@}}}
-+vcpkg_prefix=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
-+case "$vcpkg_prefix" in
-+ */lib/wx/config)
-+ vcpkg_prefix=${vcpkg_prefix%/*/*/*}
-+ ;;
-+ */tools/wxwidgets/debug)
-+ vcpkg_prefix=${vcpkg_prefix%/*/*/*}/debug
-+ ;;
-+ */tools/wxwidgets)
-+ vcpkg_prefix=${vcpkg_prefix%/*/*}
-+ ;;
-+esac
-+if [ -n "@MINGW@" -a -n "@CMAKE_HOST_WIN32@" ]; then
-+ vcpkg_prefix=$(cygpath -m "$vcpkg_prefix")
-+fi
-+prefix=${input_option_prefix-${this_prefix:-$vcpkg_prefix}}
-+exec_prefix=${input_option_exec_prefix-${input_option_prefix-${this_exec_prefix:-$prefix}}}
- wxconfdir="@libdir@/wx/config"
-
- installed_configs=`cd "$wxconfdir" 2> /dev/null && ls | grep -v "^inplace-"`
-@@ -940,6 +949,9 @@ prefix=${this_prefix-$prefix}
- exec_prefix=${this_exec_prefix-$exec_prefix}
-
- includedir="@includedir@"
-+if [ "@CMAKE_BUILD_TYPE@" = "Debug" ] ; then
-+ includedir="${includedir%/debug/include}/include"
-+fi
- libdir="@libdir@"
- bindir="@bindir@"
-
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/setup.h.in b/dependencies/vcpkg_overlay_ports/wxwidgets/setup.h.in
deleted file mode 100644
index b927735..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/setup.h.in
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifdef _DEBUG
-#include "../../debug/lib/@WX_SETUP_H_DBG_RELATIVE@/setup.h"
-#else
-#include "../../lib/@WX_SETUP_H_REL_RELATIVE@/setup.h"
-#endif
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/usage b/dependencies/vcpkg_overlay_ports/wxwidgets/usage
deleted file mode 100644
index bf1043e..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/usage
+++ /dev/null
@@ -1,4 +0,0 @@
-The package wxwidgets provides CMake targets:
-
- find_package(wxWidgets CONFIG REQUIRED)
- target_link_libraries(main PRIVATE wx::core wx::base)
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/vcpkg-cmake-wrapper.cmake b/dependencies/vcpkg_overlay_ports/wxwidgets/vcpkg-cmake-wrapper.cmake
deleted file mode 100644
index b605525..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/vcpkg-cmake-wrapper.cmake
+++ /dev/null
@@ -1,77 +0,0 @@
-cmake_policy(PUSH)
-cmake_policy(SET CMP0012 NEW)
-cmake_policy(SET CMP0054 NEW)
-
-get_filename_component(_vcpkg_wx_root "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
-set(wxWidgets_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
-set(WX_ROOT_DIR "${_vcpkg_wx_root}" CACHE INTERNAL "")
-unset(_vcpkg_wx_root)
-
-if(WIN32 AND CMAKE_HOST_WIN32)
- # Find all libs with "32" infix which is unknown to FindwxWidgets.cmake
- function(z_vcpkg_wxwidgets_find_base_library BASENAME)
- find_library(WX_${BASENAME}d wx${BASENAME}32ud NAMES wx${BASENAME}d PATHS "${wxWidgets_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
- find_library(WX_${BASENAME} wx${BASENAME}32u NAMES wx${BASENAME} PATHS "${wxWidgets_ROOT_DIR}/lib" NO_DEFAULT_PATH REQUIRED)
- endfunction()
- function(z_vcpkg_wxwidgets_find_suffix_library BASENAME)
- foreach(lib IN LISTS ARGN)
- find_library(WX_${lib}d NAMES wx${BASENAME}32ud_${lib} PATHS "${wxWidgets_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
- find_library(WX_${lib} NAMES wx${BASENAME}32u_${lib} PATHS "${wxWidgets_ROOT_DIR}/lib" NO_DEFAULT_PATH)
- endforeach()
- endfunction()
- z_vcpkg_wxwidgets_find_base_library(base)
- z_vcpkg_wxwidgets_find_suffix_library(base net odbc xml)
- z_vcpkg_wxwidgets_find_suffix_library(msw core adv aui html media xrc dbgrid gl qa richtext stc ribbon propgrid webview)
- if(WX_stc AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
- z_vcpkg_wxwidgets_find_base_library(scintilla)
- endif()
- # Force FindwxWidgets.cmake win32 mode for all windows targets built on windows
- set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}")
- set(CMAKE_CROSSCOMPILING 0)
- set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
-else()
- # FindwxWidgets.cmake unix mode, single-config
- if(MINGW)
- # Force FindwxWidgets.cmake unix mode for mingw cross builds
- set(_vcpkg_wxwidgets_backup_crosscompiling "${CMAKE_CROSSCOMPILING}")
- set(CMAKE_CROSSCOMPILING 1)
- endif()
- set(_vcpkg_wxconfig "")
- if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR "Debug" IN_LIST MAP_IMPORTED_CONFIG_${CMAKE_BUILD_TYPE})
- # Debug
- set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/debug/lib" CACHE INTERNAL "")
- file(GLOB _vcpkg_wxconfig LIST_DIRECTORIES false "${wxWidgets_LIB_DIR}/wx/config/*")
- endif()
- if(NOT _vcpkg_wxconfig)
- # Release or fallback
- set(wxWidgets_LIB_DIR "${wxWidgets_ROOT_DIR}/lib" CACHE INTERNAL "")
- file(GLOB _vcpkg_wxconfig LIST_DIRECTORIES false "${wxWidgets_LIB_DIR}/wx/config/*")
- endif()
- set(wxWidgets_CONFIG_EXECUTABLE "${_vcpkg_wxconfig}" CACHE INTERNAL "")
- unset(_vcpkg_wxconfig)
-endif()
-set(WX_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "")
-
-_find_package(${ARGS})
-
-if(DEFINED _vcpkg_wxwidgets_backup_crosscompiling)
- set(CMAKE_CROSSCOMPILING "${_vcpkg_wxwidgets_backup_crosscompiling}")
- unset(_vcpkg_wxwidgets_backup_crosscompiling)
-endif()
-
-if(WIN32 AND CMAKE_HOST_WIN32 AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT "wx::core" IN_LIST wxWidgets_LIBRARIES)
- find_package(EXPAT QUIET)
- find_package(JPEG QUIET)
- find_package(PNG QUIET)
- find_package(TIFF QUIET)
- find_package(ZLIB QUIET)
- list(APPEND wxWidgets_LIBRARIES
- ${EXPAT_LIBRARIES}
- ${JPEG_LIBRARIES}
- ${PNG_LIBRARIES}
- ${TIFF_LIBRARIES}
- ${ZLIB_LIBRARIES}
- )
-endif()
-
-cmake_policy(POP)
diff --git a/dependencies/vcpkg_overlay_ports/wxwidgets/vcpkg.json b/dependencies/vcpkg_overlay_ports/wxwidgets/vcpkg.json
deleted file mode 100644
index 3f04aec..0000000
--- a/dependencies/vcpkg_overlay_ports/wxwidgets/vcpkg.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
- "name": "wxwidgets",
- "version": "3.2.0",
- "port-version": 1,
- "description": [
- "Widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. ",
- "Set WXWIDGETS_USE_STL in a custom triplet to build with the wxUSE_STL build option.",
- "Set WXWIDGETS_USE_STD_CONTAINERS in a custom triplet to build with the wxUSE_STD_CONTAINERS build option."
- ],
- "homepage": "https://github.com/wxWidgets/wxWidgets",
- "license": "LGPL-2.0-or-later WITH WxWindows-exception-3.1",
- "supports": "!uwp",
- "dependencies": [
- {
- "name": "curl",
- "default-features": false,
- "platform": "!windows & !osx"
- },
- "expat",
- "libpng",
- "tiff",
- {
- "name": "vcpkg-cmake",
- "host": true
- },
- {
- "name": "vcpkg-cmake-config",
- "host": true
- },
- "zlib"
- ],
- "default-features": [
- "debug-support",
- "sound"
- ],
- "features": {
- "debug-support": {
- "description": "Enable wxWidgets debugging support hooks even for release builds (wxDEBUG_LEVEL 1)"
- },
- "example": {
- "description": "Example source code and CMake project"
- },
- "fonts": {
- "description": "Enable to use the font functionality of wxWidgets",
- "dependencies": [
- {
- "name": "fontconfig",
- "platform": "!windows & !osx"
- },
- {
- "name": "pango",
- "platform": "!windows & !osx"
- }
- ]
- },
- "sound": {
- "description": "Build wxSound support",
- "dependencies": [
- {
- "name": "sdl2",
- "default-features": false,
- "platform": "!windows & !osx"
- }
- ]
- }
- }
-}
@romatthe
Copy link
Author

See the derivation for rustdesk on how to potentially "simulate" vcpkg behavior.

@romatthe
Copy link
Author

Note: the libraries packages by vcpkg sometimes ship with things included that the regular distribution does not (for example, files for CMake compatibility, etc.). The curl package seems to do for example, as does imgui. Both seem to contain assets for working with CMake.

@baduhai
Copy link

baduhai commented Aug 26, 2022

I think that your attempt to completely get rid of vcpkg is probably the best way to go about this. Simulating vcpkg's functionality feels super hacky. Though it might be inevitable, as I have found some possible issues:

  • Cemu targets wxWidgets 3.2.0 and the latest available version in nixpkgs (even unstable) is 3.1.5.
  • The cubeb audio backend isn't available in nixpkgs, it would have to either be wrapped, as is done with the firefox derivation, or use sdl instead. However, it is unclear whether cemu uses sdl as audio backend or just for controller support, from what I understand, it's only for controller support.
  • Cemu uses a part of libavcodec specifically for x264 decoding; ih264d. This is distributed by nixpks as part of ffmpeg, so we can either have ffmpeg as a dependency, or we can build and wrap ih264d. Not yet sure which would be easiest.
  • ZArchvie is another dependency of cemu not distributed by nixpkgs, this one would definitely have to be wrapped.

I'm slowly writing a new derivation that combines yours and my efforts, and I'll post my progress here soon.

@baduhai
Copy link

baduhai commented Aug 26, 2022

This is a supposedly working PKGBUILD for Arch Linux that we can use as reference.

@baduhai
Copy link

baduhai commented Aug 26, 2022

  • The cubeb audio backend isn't available in nixpkgs, it would have to either be wrapped, as is done with the firefox derivation, or use sdl instead. However, it is unclear whether cemu uses sdl as audio backend or just for controller support, from what I understand, it's only for controller support.

Looks like there is a better way of managing cubeb, see how the citra derivation handles it.

@baduhai
Copy link

baduhai commented Aug 26, 2022

Alright, this is my progress so far. I'm currently stuck on getting cmake to recognise the system version of curl and imgui.

default.nix:

{ lib
, clang12Stdenv
, fetchFromGitHub
, cmake
, ninja
, vulkan-headers
, vulkan-loader
, gtk3
, libsecret
, libgcrypt
, systemd
, freeglut
, nasm
, wxGTK31
, fmt
, curl
, pugixml
, imgui
, rapidjson
, boost
, libzip
, glslang
, zlib
, zstd
, discord-rpc
, SDL2
}:

clang12Stdenv.mkDerivation rec {
  name = "cemu-wiiu";
  version = "2.0";

  src = fetchFromGitHub {
    owner = "cemu-project";
    repo = "Cemu";
    rev = "v${version}";
    sha256 = "5DgG+EgKLXtLWS1u01j8GM8c+h5Uv/l/dS3x/t4qIW4=";
    fetchSubmodules = true;
  };
  
  patches = [ ./cmake.patch ];

  nativeBuildInputs = [ cmake ninja ];

  cmakeFlags = [
    "-DCMAKE_BUILD_TYPE=release"
    "-DCMAKE_MAKE_PROGRAM=${ninja}/bin/ninja"
    "-DENABLE_CUBEB=0"
  ];

  buildInputs = [
    vulkan-headers
    vulkan-loader
    gtk3
    libsecret
    libgcrypt
    systemd
    freeglut
    nasm
    wxGTK31
    fmt
    curl
    pugixml
    imgui
    rapidjson
    boost
    libzip
    glslang
    zlib
    zstd
    discord-rpc
    SDL2
  ];

  meta = with lib; {
    description = "Cemu is a Wii U emulator";
    homepage = "https://cemu.info";
    license = licenses.mpl20;
    platforms = platforms.linux;
  };
}

cmake.patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6104c17..46d6d18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,14 +7,6 @@ if (PUBLIC_RELEASE)
   set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO
 endif()
 
-if(WIN32)
-set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
-endif()
-
-set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
-set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
-  CACHE STRING "Vcpkg toolchain file")
-
 project(Cemu VERSION 0.1)
 set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -23,38 +15,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
-IF(MSVC)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GT") # fiber safe optimizations
-ENDIF()
-
-IF(MSVC AND PUBLIC_RELEASE)
-    message(STATUS "Using additional optimization flags for MSVC")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Oi /Ot") # enable intrinsic functions, favor speed
-ENDIF()
-
 option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
 option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
 option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
 
-if(WIN32)
-    option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
-endif()
 
 # input backends
-if(WIN32)
-    option(ENABLE_XINPUT "Enables the usage of XInput" ON)
-    option(ENABLE_DIRECTINPUT "Enables the usage of DirectInput" ON)
-    add_definitions(-DHAS_DIRECTINPUT)
-endif()
 option(ENABLE_SDL "Enables the SDLController backend" ON)
 
 # audio backends
-if(WIN32)
-option(ENABLE_DIRECTAUDIO "Enables the directaudio backend" ON)
-option(ENABLE_XAUDIO "Enables the xaudio backend" ON)
-endif()
 option(ENABLE_CUBEB "Enabled cubeb backend" ON)
 
 option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
@@ -74,13 +43,14 @@ if(ENABLE_VULKAN)
     find_package(Vulkan REQUIRED)
     include_directories("${Vulkan_INCLUDE_DIRS}")
 endif()
+
 if(ENABLE_OPENGL)
     find_package(OpenGL REQUIRED)
 endif()
+
 if(ENABLE_DISCORD_RPC)
     add_definitions(-DENABLE_DISCORD_RPC)
-    add_subdirectory(dependencies/discord-rpc EXCLUDE_FROM_ALL)
-    target_include_directories(discord-rpc INTERFACE ./dependencies/discord-rpc/include)
+    find_package(DiscordRPC REQUIRED)
 endif()
 
 if(ENABLE_WXWIDGETS)
@@ -90,25 +60,6 @@ endif()
 find_package(OpenSSL REQUIRED)
 find_package(X11)
 
-# find a better way to handle this
-link_libraries(${Boost_LIBRARIES})
-link_libraries(${X11_LIBRARIES})
-link_libraries(SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
-if(ENABLE_WXWIDGETS)
-link_libraries(wx::core wx::base)
-endif()
-
-if(ENABLE_CUBEB)
-    option(BUILD_TESTS "" OFF)
-    option(BUILD_TOOLS "" OFF)
-    option(BUNDLE_SPEEX "" OFF)
-    set(USE_WINMM OFF CACHE BOOL "")
-    add_subdirectory(dependencies/cubeb)
-    set_property(TARGET cubeb PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-    link_libraries(cubeb)
-    add_compile_definitions(HAS_CUBEB=1)
-endif()
-
 add_subdirectory(dependencies/ih264d)
 add_subdirectory(dependencies/ZArchive)

@baduhai
Copy link

baduhai commented Aug 27, 2022

Yeah, I'm not getting anywhere... This is the current state of my derivation and patch:

{ lib
, clang12Stdenv
, fetchFromGitHub
, cmake
, ninja
, vulkan-headers
, vulkan-loader
, gtk3
, libsecret
, libgcrypt
, systemd
, freeglut
, nasm
, wxGTK31
, fmt
, curl
, pugixml
, imgui
, rapidjson
, boost
, libzip
, glslang
, zlib
, zstd
, SDL2
}:

let zstd-static = zstd.overrideAttrs (oldAttrs: rec { static = true; });
in clang12Stdenv.mkDerivation rec {
  name = "cemu-wiiu";
  version = "2.0";

  src = fetchFromGitHub {
    owner = "cemu-project";
    repo = "Cemu";
    rev = "v${version}";
    sha256 = "5DgG+EgKLXtLWS1u01j8GM8c+h5Uv/l/dS3x/t4qIW4=";
    fetchSubmodules = true;
  };

  patches = [ ./cmake.patch ];

  nativeBuildInputs = [ cmake ninja ];

  cmakeFlags = [
    "-DCMAKE_BUILD_TYPE=release"
    "-DCMAKE_MAKE_PROGRAM=${ninja}/bin/ninja"
    "-DENABLE_CUBEB=0"
    "-DENABLE_DISCORD_RPC=0"
  ];

  buildInputs = [
    vulkan-headers
    vulkan-loader
    gtk3
    libsecret
    libgcrypt
    systemd
    freeglut
    nasm
    wxGTK31
    fmt
    curl
    pugixml
    imgui
    rapidjson
    boost
    libzip
    glslang
    zlib
    zstd-static
    SDL2
  ];

  meta = with lib; {
    description = "Cemu is a Wii U emulator";
    homepage = "https://cemu.info";
    license = licenses.mpl20;
    platforms = platforms.linux;
  };
}

and:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6104c17..a48fca6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,14 +7,6 @@ if (PUBLIC_RELEASE)
   set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO
 endif()
 
-if(WIN32)
-set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
-endif()
-
-set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
-set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
-  CACHE STRING "Vcpkg toolchain file")
-
 project(Cemu VERSION 0.1)
 set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -23,50 +15,27 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
-IF(MSVC)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GT") # fiber safe optimizations
-ENDIF()
-
-IF(MSVC AND PUBLIC_RELEASE)
-    message(STATUS "Using additional optimization flags for MSVC")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Oi /Ot") # enable intrinsic functions, favor speed
-ENDIF()
-
 option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
 option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
 option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
 
-if(WIN32)
-    option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
-endif()
 
 # input backends
-if(WIN32)
-    option(ENABLE_XINPUT "Enables the usage of XInput" ON)
-    option(ENABLE_DIRECTINPUT "Enables the usage of DirectInput" ON)
-    add_definitions(-DHAS_DIRECTINPUT)
-endif()
 option(ENABLE_SDL "Enables the SDLController backend" ON)
 
 # audio backends
-if(WIN32)
-option(ENABLE_DIRECTAUDIO "Enables the directaudio backend" ON)
-option(ENABLE_XAUDIO "Enables the xaudio backend" ON)
-endif()
 option(ENABLE_CUBEB "Enabled cubeb backend" ON)
 
 option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
 
 find_package(SDL2 CONFIG REQUIRED)
-find_package(CURL CONFIG REQUIRED)
+find_package(CURL REQUIRED)
 find_package(pugixml CONFIG REQUIRED)
-find_package(imgui CONFIG REQUIRED)
+#find_package(imgui CONFIG REQUIRED)
 find_package(RapidJSON CONFIG REQUIRED)
 find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
 find_package(libzip REQUIRED)
-find_package(glslang REQUIRED)
+#find_package(glslang REQUIRED)
 find_package(ZLIB REQUIRED)
 find_package(zstd CONFIG REQUIRED)
 
@@ -74,41 +43,23 @@ if(ENABLE_VULKAN)
     find_package(Vulkan REQUIRED)
     include_directories("${Vulkan_INCLUDE_DIRS}")
 endif()
+
 if(ENABLE_OPENGL)
     find_package(OpenGL REQUIRED)
 endif()
+
 if(ENABLE_DISCORD_RPC)
     add_definitions(-DENABLE_DISCORD_RPC)
-    add_subdirectory(dependencies/discord-rpc EXCLUDE_FROM_ALL)
-    target_include_directories(discord-rpc INTERFACE ./dependencies/discord-rpc/include)
+    find_package(discord-rpc REQUIRED)
 endif()
 
 if(ENABLE_WXWIDGETS)
-    find_package(wxWidgets CONFIG REQUIRED)
+    find_package(wxWidgets REQUIRED)
 endif()
 
 find_package(OpenSSL REQUIRED)
 find_package(X11)
 
-# find a better way to handle this
-link_libraries(${Boost_LIBRARIES})
-link_libraries(${X11_LIBRARIES})
-link_libraries(SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
-if(ENABLE_WXWIDGETS)
-link_libraries(wx::core wx::base)
-endif()
-
-if(ENABLE_CUBEB)
-    option(BUILD_TESTS "" OFF)
-    option(BUILD_TOOLS "" OFF)
-    option(BUNDLE_SPEEX "" OFF)
-    set(USE_WINMM OFF CACHE BOOL "")
-    add_subdirectory(dependencies/cubeb)
-    set_property(TARGET cubeb PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-    link_libraries(cubeb)
-    add_compile_definitions(HAS_CUBEB=1)
-endif()
-
 add_subdirectory(dependencies/ih264d)
 add_subdirectory(dependencies/ZArchive)

I'm stuck on build ZArchive:

CMake Error at dependencies/ZArchive/CMakeLists.txt:33 (target_link_libraries):
  Target "zarchive" links to:

    zstd::libzstd_static

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

@baduhai
Copy link

baduhai commented Aug 27, 2022

Looks like a PKGBUILD has been puplished to the AUR.

@romatthe
Copy link
Author

Yup, that static libzstd / zarchive issue is exactly what I'm stuck on as well. Tried it a few times over the weekend, goes to show how little experience I have with debugging these CMake issues. I had a quick look at the PKGBUILD as well, but it didn't give me any new insights either.

If we want to continue working on this, we should probably look into how zstd is packaged on vcpkg, which scares me a little. But it might provide some insight.

@baduhai
Copy link

baduhai commented Aug 29, 2022

Alright, I've made some good progress(zarchive is no longer an issue!), maybe you can make some progress from where I'm at, @romatthe.

Remaining issues:

  • Cubeb is disabled with a cmake flag, as I haven't yet figured how to intgrate it.
  • Neither cmake nor pkg-config can find discord-rpc.
  • Neither cmake nor pkg-config can find imgui.
  • Neither cmake nor pkg-config can find glslang.
  • Building fails with a wxwidgets related error, even when using -DENABLE_WXWIDGETS=0.

default.nix:

{ lib
, clang12Stdenv
, fetchFromGitHub
, cmake
, ninja
, vulkan-headers
, vulkan-loader
, gtk3
, libsecret
, libgcrypt
, systemd
, freeglut
, nasm
, wxGTK31
, fmt
, curl
, pugixml
, imgui
, rapidjson
, boost
, libzip
, glslang
, zlib
, zstd
, SDL2
, pkg-config
}:

let
  pkgs = import <nixpkgs> {};
  
  derivations = pkgs.writeText "zarchive" ''
    pkgs: {
      zarchive = pkgs.stdenv.mkDerivation rec{
        name = "zarchive";
  
        src = pkgs.fetchFromGitHub {
          owner = "Exzap";
          repo = "ZArchive";
          rev = "48914a07df3c213333c580bb5e5bb3393442ca5b";
          sha256 = "MN8P1zqvOPmXcOgpw4Y0c8AvPQS3nY/HBnwS2HPEsts=";
        };
  
        nativeBuildInputs = [ pkgs.cmake ];
  
        buildInputs = [ pkgs.zstd ];
      };
    }
  '';

  imported-derivation = import derivations;

  zarchive = (imported-derivation pkgs).zarchive;
in clang12Stdenv.mkDerivation rec {
  name = "cemu-wiiu";
  version = "2.0";

  src = fetchFromGitHub {
    owner = "cemu-project";
    repo = "Cemu";
    rev = "v${version}";
    sha256 = "5DgG+EgKLXtLWS1u01j8GM8c+h5Uv/l/dS3x/t4qIW4=";
    fetchSubmodules = true;
  };

  patches = [ ./cmake.patch ];

  nativeBuildInputs = [ cmake ninja pkg-config ];

  cmakeFlags = [
    "-DCMAKE_BUILD_TYPE=release"
    "-DCMAKE_MAKE_PROGRAM=${ninja}/bin/ninja"
    "-DENABLE_CUBEB=0"
    "-DENABLE_DISCORD_RPC=0"
  ];

  buildInputs = [
    vulkan-headers
    vulkan-loader
    gtk3
    libsecret
    libgcrypt
    systemd
    freeglut
    nasm
    wxGTK31
    fmt
    curl
    pugixml
    imgui
    rapidjson
    boost
    libzip
    glslang
    zlib
    SDL2
    zstd
    zarchive
  ];

  meta = with lib; {
    description = "Cemu is a Wii U emulator";
    homepage = "https://cemu.info";
    license = licenses.mpl20;
    platforms = platforms.linux;
  };
}

cmake.patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6104c17..2c85c6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,14 +7,6 @@ if (PUBLIC_RELEASE)
   set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) # enable LTO
 endif()
 
-if(WIN32)
-set(VCPKG_TARGET_TRIPLET "x64-windows-static" CACHE STRING "")
-endif()
-
-set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
-set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
-  CACHE STRING "Vcpkg toolchain file")
-
 project(Cemu VERSION 0.1)
 set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -23,50 +15,30 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
-IF(MSVC)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GT") # fiber safe optimizations
-ENDIF()
-
-IF(MSVC AND PUBLIC_RELEASE)
-    message(STATUS "Using additional optimization flags for MSVC")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Oi /Ot") # enable intrinsic functions, favor speed
-ENDIF()
-
 option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
 option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
 option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
 
-if(WIN32)
-    option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
-endif()
 
 # input backends
-if(WIN32)
-    option(ENABLE_XINPUT "Enables the usage of XInput" ON)
-    option(ENABLE_DIRECTINPUT "Enables the usage of DirectInput" ON)
-    add_definitions(-DHAS_DIRECTINPUT)
-endif()
 option(ENABLE_SDL "Enables the SDLController backend" ON)
 
 # audio backends
-if(WIN32)
-option(ENABLE_DIRECTAUDIO "Enables the directaudio backend" ON)
-option(ENABLE_XAUDIO "Enables the xaudio backend" ON)
-endif()
 option(ENABLE_CUBEB "Enabled cubeb backend" ON)
 
 option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
 
+find_package(PkgConfig REQUIRED)
+
 find_package(SDL2 CONFIG REQUIRED)
-find_package(CURL CONFIG REQUIRED)
+pkg_check_modules(CURL libcurl REQUIRED)
 find_package(pugixml CONFIG REQUIRED)
-find_package(imgui CONFIG REQUIRED)
+#find_package(imgui CONFIG REQUIRED)
+#pkg_check_modules(IMGUI imgui REQUIRED)
 find_package(RapidJSON CONFIG REQUIRED)
 find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
 find_package(libzip REQUIRED)
-find_package(glslang REQUIRED)
+#find_package(glslang REQUIRED)
 find_package(ZLIB REQUIRED)
 find_package(zstd CONFIG REQUIRED)
 
@@ -74,30 +46,23 @@ if(ENABLE_VULKAN)
     find_package(Vulkan REQUIRED)
     include_directories("${Vulkan_INCLUDE_DIRS}")
 endif()
+
 if(ENABLE_OPENGL)
     find_package(OpenGL REQUIRED)
 endif()
+
 if(ENABLE_DISCORD_RPC)
     add_definitions(-DENABLE_DISCORD_RPC)
-    add_subdirectory(dependencies/discord-rpc EXCLUDE_FROM_ALL)
-    target_include_directories(discord-rpc INTERFACE ./dependencies/discord-rpc/include)
+    find_package(discord-rpc REQUIRED)
 endif()
 
 if(ENABLE_WXWIDGETS)
-    find_package(wxWidgets CONFIG REQUIRED)
+    find_package(wxWidgets REQUIRED)
 endif()
 
 find_package(OpenSSL REQUIRED)
 find_package(X11)
 
-# find a better way to handle this
-link_libraries(${Boost_LIBRARIES})
-link_libraries(${X11_LIBRARIES})
-link_libraries(SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
-if(ENABLE_WXWIDGETS)
-link_libraries(wx::core wx::base)
-endif()
-
 if(ENABLE_CUBEB)
     option(BUILD_TESTS "" OFF)
     option(BUILD_TOOLS "" OFF)
@@ -109,8 +74,8 @@ if(ENABLE_CUBEB)
     add_compile_definitions(HAS_CUBEB=1)
 endif()
 
+pkg_check_modules(ZARCHIVE zarchive REQUIRED)
 add_subdirectory(dependencies/ih264d)
-add_subdirectory(dependencies/ZArchive)
 
 add_subdirectory(src)
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 005cfa2..9fabd76 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -80,13 +80,16 @@ set_target_properties(CemuBin PROPERTIES
         OUTPUT_NAME "Cemu"
         )
 
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(CURL libcurl REQUIRED)
+
 target_link_libraries(CemuBin PRIVATE CemuCommon CemuComponents CemuCafe CemuConfig CemuGui CemuAudio CemuInput CemuUtil)
 target_link_libraries(CemuBin PRIVATE CemuAsm)
 target_link_libraries(CemuBin PRIVATE OpenSSL::SSL)
 target_link_libraries(CemuBin PRIVATE ZLIB::ZLIB)
 target_link_libraries(CemuBin PRIVATE ${wxWidgets_LIBRARIES})
-target_link_libraries(CemuBin PRIVATE CURL::libcurl)
-target_link_libraries(CemuBin PRIVATE imgui::imgui)
+target_link_libraries(CemuBin PRIVATE ${CURL_LIBRARIES})
+#target_link_libraries(CemuBin PRIVATE imgui::imgui)
 target_link_libraries(CemuBin PRIVATE pugixml pugixml::static pugixml::pugixml)
 
 if(ENABLE_CEMUHOOK)

@baduhai
Copy link

baduhai commented Aug 29, 2022

There are a lot of improvements going into cemu related to building on Linux, it may be a good idea to try to build from master, or to wait for a 2.1 release with Linux fixes and build quality of life improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment