[wip] build wxwidgets as part of the build
This commit is contained in:
parent
dcb9ccca90
commit
fcae420599
|
@ -5,3 +5,6 @@
|
|||
[submodule "third_party/googletest"]
|
||||
path = third_party/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
[submodule "third_party/wxWidgets"]
|
||||
path = third_party/wxWidgets
|
||||
url = https://github.com/wxWidgets/wxWidgets.git
|
||||
|
|
|
@ -22,7 +22,7 @@ if(TAG_RELEASE)
|
|||
include(MakeReleaseCommitAndTag)
|
||||
endif()
|
||||
|
||||
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext wxwidgets)
|
||||
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext)
|
||||
|
||||
set(VCPKG_DEPS_OPTIONAL
|
||||
sfml ENABLE_LINK
|
||||
|
@ -73,16 +73,32 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||
|
||||
project(VBA-M C CXX)
|
||||
set(VBAM_LANGUAGES C CXX)
|
||||
if(APPLE)
|
||||
list(APPEND VBAM_LANGUAGES OBJCXX)
|
||||
endif()
|
||||
|
||||
project(VBA-M ${VBAM_LANGUAGES})
|
||||
|
||||
include(CTest)
|
||||
include(FetchContent)
|
||||
include(GNUInstallDirs)
|
||||
include(Architecture)
|
||||
include(Options)
|
||||
include(Toolchain)
|
||||
include(Dependencies)
|
||||
|
||||
function(configure_vbam_target target)
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
set(target_scope "INTERFACE")
|
||||
else()
|
||||
set(target_scope "PRIVATE")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${target} ${target_scope} ${VBAM_COMPILE_DEFS})
|
||||
target_compile_options(${target} ${target_scope} ${VBAM_COMPILE_OPTS})
|
||||
target_link_options(${target} ${target_scope} ${VBAM_LINK_OPTS})
|
||||
endfunction()
|
||||
|
||||
# Disable tests when not in a git checkout.
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
set(BUILD_TESTING OFF)
|
||||
|
@ -92,10 +108,21 @@ endif()
|
|||
if(BUILD_TESTING)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(./third_party/googletest)
|
||||
add_subdirectory(third_party/googletest)
|
||||
include(GoogleTest)
|
||||
endif()
|
||||
|
||||
# Configure wxWidgets.
|
||||
if(NOT VBAM_DEPS_wxWidgets_SYSTEM)
|
||||
set(wxBUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(wxBUILD_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(wxUSE_WEBVIEW OFF CACHE BOOL "" FORCE)
|
||||
set(wxWidgets_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party/wxWidgets")
|
||||
add_subdirectory(third_party/wxWidgets)
|
||||
set(wxWidgets_LIBRARIES wx::xrc wx::xml wx::html wx::adv wx::net wx::core wx::base wx::gl)
|
||||
set(wxWidgets_INCLUDE_DIRS third_party/wxWidgets/include)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
|
||||
set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
|
||||
endif()
|
||||
|
|
|
@ -64,7 +64,7 @@ if(ENABLE_FFMPEG)
|
|||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_FFMPEG)
|
||||
list(APPEND VBAM_COMPILE_DEFS NO_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LINK)
|
||||
|
@ -80,10 +80,10 @@ if(ENABLE_LINK)
|
|||
include(CheckFunctionExists)
|
||||
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
||||
if(SEM_TIMEDWAIT)
|
||||
add_compile_definitions(HAVE_SEM_TIMEDWAIT)
|
||||
list(APPEND VBAM_COMPILE_DEFS HAVE_SEM_TIMEDWAIT)
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_LINK)
|
||||
list(APPEND VBAM_COMPILE_DEFS NO_LINK)
|
||||
endif()
|
||||
|
||||
# for now, only GBALink.cpp uses gettext() directly
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
# define the SFML_STATIC macro if static build was chosen
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
add_compile_definitions(SFML_STATIC)
|
||||
list(APPEND VBAM_COMPILE_DEFS SFML_STATIC)
|
||||
endif()
|
||||
|
||||
# define the list of search paths for headers and libraries
|
||||
|
|
|
@ -161,4 +161,23 @@ if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX))
|
|||
message(FATAL_ERROR "The SDL and wxWidgets ports can't be built when TRANSLATIONS_ONLY is enabled")
|
||||
endif()
|
||||
|
||||
if(ENABLE_WX)
|
||||
if(WIN32 OR APPLE)
|
||||
# We always build wxWidgets from source on Windows and macOS. We do not
|
||||
# support using a system wxWidgets on these platforms.
|
||||
set(VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT OFF)
|
||||
else()
|
||||
# On other platforms, we first look for a system wxWidgets, and if that
|
||||
# fails, we build from source. Note that we still prefer building from
|
||||
# source on Linux.
|
||||
find_package(wxWidgets COMPONENTS xrc xml html adv net core base gl)
|
||||
if(wxWidgets_FOUND)
|
||||
set(VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT ON)
|
||||
else()
|
||||
set(VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
option(VBAM_DEPS_wxWidgets_SYSTEM "Use system wxWidgets" ${VBAM_DEPS_wxWidgets_SYSTEM_DEFAULT})
|
||||
endif()
|
||||
|
||||
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
|
||||
|
|
|
@ -5,8 +5,8 @@ endif()
|
|||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
check_cxx_compiler_flag(/fsanitize=address MSVC_ASAN_SUPPORTED)
|
||||
if(MSVC_ASAN_SUPPORTED)
|
||||
add_compile_options(/fsanitize=address)
|
||||
add_compile_definitions(_DISABLE_VECTOR_ANNOTATION _DISABLE_STRING_ANNOTATION)
|
||||
list(APPEND VBAM_COMPILE_OPTS /fsanitize=address)
|
||||
list(APPEND VBAM_COMPILE_DEFS _DISABLE_VECTOR_ANNOTATION _DISABLE_STRING_ANNOTATION)
|
||||
else()
|
||||
message(WARNING "ASAN not available for the compiler, disabling.")
|
||||
set(ENABLE_ASAN OFF)
|
||||
|
@ -27,8 +27,8 @@ else()
|
|||
set(CMAKE_EXE_LINKER_FLAGS ${BACKUP_LINKER_FLAGS})
|
||||
|
||||
if(ASAN_SUPPORTED)
|
||||
add_compile_options(-fsanitize=address)
|
||||
add_link_options(-fsanitize=address)
|
||||
list(APPEND VBAM_COMPILE_OPTS -fsanitize=address)
|
||||
list(APPEND VBAM_LINK_OPTS -fsanitize=address)
|
||||
else()
|
||||
message(WARNING "ASAN not available for the compiler, disabling.")
|
||||
set(ENABLE_ASAN OFF)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
if(X86_32 OR X86_64)
|
||||
add_compile_options(-mfpmath=sse -msse2)
|
||||
list(APPEND VBAM_COMPILE_OPTS -mfpmath=sse -msse2)
|
||||
endif()
|
||||
|
||||
if(UPSTREAM_RELEASE)
|
||||
if(X86_64)
|
||||
# Require and optimize for Core2 level support, tune for generic.
|
||||
add_compile_options(-march=core2 -mtune=generic)
|
||||
list(APPEND VBAM_COMPILE_OPTS -march=core2 -mtune=generic)
|
||||
elseif(X86_32)
|
||||
# Optimize for pentium-mmx and tune for generic for older builds.
|
||||
add_compile_options(-march=pentium-mmx -mtune=generic)
|
||||
list(APPEND VBAM_COMPILE_OPTS -march=pentium-mmx -mtune=generic)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Common flags.
|
||||
add_compile_options(
|
||||
list(APPEND VBAM_COMPILE_OPTS
|
||||
-pipe
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
|
||||
-Wformat
|
||||
|
@ -22,9 +22,9 @@ add_compile_options(
|
|||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-Wno-unused-command-line-argument)
|
||||
list(APPEND VBAM_COMPILE_OPTS -Wno-unused-command-line-argument)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-feliminate-unused-debug-types)
|
||||
list(APPEND VBAM_COMPILE_OPTS -feliminate-unused-debug-types)
|
||||
endif()
|
||||
|
||||
# check if ssp flags are supported.
|
||||
|
@ -32,23 +32,23 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
check_cxx_compiler_flag(-fstack-protector-strong STACK_PROTECTOR_SUPPORTED)
|
||||
|
||||
if(STACK_PROTECTOR_SUPPORTED)
|
||||
add_compile_options(-fstack-protector-strong)
|
||||
list(APPEND VBAM_COMPILE_OPTS -fstack-protector-strong)
|
||||
|
||||
check_cxx_compiler_flag("--param ssp-buffer-size=4" SSP_BUFFER_SIZE_SUPPORTED)
|
||||
if(SSP_BUFFER_SIZE_SUPPORTED)
|
||||
add_compile_options(--param ssp-buffer-size=4)
|
||||
list(APPEND VBAM_COMPILE_OPTS --param ssp-buffer-size=4)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC
|
||||
add_compile_options(-fPIC)
|
||||
list(APPEND VBAM_COMPILE_OPTS -fPIC)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_options(-ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
|
||||
list(APPEND VBAM_COMPILE_OPTS -ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
|
||||
else()
|
||||
add_compile_options(-Ofast -fomit-frame-pointer)
|
||||
list(APPEND VBAM_COMPILE_OPTS -Ofast -fomit-frame-pointer)
|
||||
endif()
|
||||
|
||||
# for some reason this is necessary
|
||||
|
@ -58,17 +58,17 @@ endif()
|
|||
|
||||
if(VBAM_STATIC)
|
||||
if(APPLE)
|
||||
add_link_options(-static-libstdc++)
|
||||
list(APPEND VBAM_LINK_OPTS -static-libstdc++)
|
||||
else()
|
||||
add_link_options(-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||
list(APPEND VBAM_LINK_OPTS -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# To support LTO, this must always fail.
|
||||
add_compile_options(-Werror=odr -Werror=strict-aliasing)
|
||||
add_link_options( -Werror=odr -Werror=strict-aliasing)
|
||||
list(APPEND VBAM_COMPILE_OPTS -Werror=odr -Werror=strict-aliasing)
|
||||
list(APPEND VBAM_LINK_OPTS -Werror=odr -Werror=strict-aliasing)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Werror=lto-type-mismatch)
|
||||
add_link_options( -Werror=lto-type-mismatch)
|
||||
list(APPEND VBAM_COMPILE_OPTS -Werror=lto-type-mismatch)
|
||||
list(APPEND VBAM_LINK_OPTS -Werror=lto-type-mismatch)
|
||||
endif()
|
||||
|
|
|
@ -3,38 +3,37 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:DEBUG>:Debug>" CACHE INT
|
|||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# MSVC-specific flags (not supported by clang-cl).
|
||||
add_compile_options(/nologo)
|
||||
list(APPEND VBAM_COMPILE_OPTS /nologo)
|
||||
if (NOT CMAKE_GENERATOR MATCHES "Ninja")
|
||||
# Multi-processor compilation does not work well with Ninja.
|
||||
add_compile_options(/MP)
|
||||
list(APPEND VBAM_COMPILE_OPTS /MP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/msvc")
|
||||
|
||||
add_compile_definitions(
|
||||
_FORCENAMELESSUNION
|
||||
WIN32_LEAN_AND_MEAN
|
||||
WIN32
|
||||
_WINDOWS
|
||||
__STDC_LIMIT_MACROS
|
||||
__STDC_CONSTANT_MACROS
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_UNICODE
|
||||
UNICODE
|
||||
WINVER=0x0A00
|
||||
NTDDI_VERSION=0x0A000007
|
||||
)
|
||||
|
||||
list(APPEND VBAM_COMPILE_DEFS
|
||||
WIN32_LEAN_AND_MEAN
|
||||
WIN32
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
NOMINMAX
|
||||
)
|
||||
add_compile_options(
|
||||
list(APPEND VBAM_COMPILE_OPTS
|
||||
/W4
|
||||
/GR
|
||||
/EHsc
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_definitions(_DEBUG)
|
||||
add_compile_options(/Ob0 /Od /RTC1)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT ENABLE_ASAN)
|
||||
# Use Edit and Continue with MSVC.
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue" CACHE STRING "" FORCE)
|
||||
|
@ -42,17 +41,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
else()
|
||||
add_compile_options(/MT /Oi /Gy)
|
||||
add_compile_options(/Oi /Gy)
|
||||
add_link_options(/OPT:REF /OPT:ICF)
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "" FORCE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||
add_compile_options(/O1 /Ob1)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
add_compile_options(/O2 /Ob1)
|
||||
else()
|
||||
add_compile_options(/O2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.25")
|
||||
|
@ -67,17 +58,3 @@ if(CMAKE_VERSION VERSION_LESS "3.25")
|
|||
message(FATAL_ERROR "Unknown value for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: ${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE)
|
||||
|
||||
# We need to explicitly set all of these to override the CMake defaults.
|
||||
set(CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE STRING "" FORCE)
|
||||
|
|
|
@ -29,30 +29,30 @@ endif()
|
|||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT HTTPS)
|
||||
add_compile_definitions(NO_HTTPS)
|
||||
list(APPEND VBAM_COMPILE_DEFS NO_HTTPS)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GBA_LOGGING)
|
||||
add_compile_definitions(GBA_LOGGING )
|
||||
list(APPEND VBAM_COMPILE_DEFS GBA_LOGGING )
|
||||
endif()
|
||||
|
||||
if(ENABLE_MMX)
|
||||
add_compile_definitions(MMX)
|
||||
list(APPEND VBAM_COMPILE_DEFS MMX)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT ENABLE_ONLINEUPDATES)
|
||||
add_compile_definitions(NO_ONLINEUPDATES)
|
||||
list(APPEND VBAM_COMPILE_DEFS NO_ONLINEUPDATES)
|
||||
endif()
|
||||
|
||||
# The debugger is enabled by default
|
||||
if(ENABLE_DEBUGGER)
|
||||
add_compile_definitions(VBAM_ENABLE_DEBUGGER)
|
||||
list(APPEND VBAM_COMPILE_DEFS VBAM_ENABLE_DEBUGGER)
|
||||
endif()
|
||||
|
||||
# The ASM core is disabled by default because we don't know on which platform we are
|
||||
if(NOT ENABLE_ASM_CORE)
|
||||
add_compile_definitions(C_CORE)
|
||||
list(APPEND VBAM_COMPILE_DEFS C_CORE)
|
||||
endif()
|
||||
|
||||
# Set up "src" and generated directory as a global include directory.
|
||||
|
@ -63,26 +63,19 @@ include_directories(
|
|||
)
|
||||
|
||||
# C defines
|
||||
add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
||||
add_compile_definitions(__STDC_FORMAT_MACROS)
|
||||
add_compile_definitions(LOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
# Common compiler settings.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_definitions(DEBUG)
|
||||
else()
|
||||
add_compile_definitions(NDEBUG)
|
||||
endif()
|
||||
list(APPEND VBAM_COMPILE_DEFS HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
list(APPEND VBAM_COMPILE_DEFS PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
||||
list(APPEND VBAM_COMPILE_DEFS __STDC_FORMAT_MACROS)
|
||||
list(APPEND VBAM_COMPILE_DEFS LOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
if(APPLE)
|
||||
add_compile_definitions(MACHO)
|
||||
list(APPEND VBAM_COMPILE_DEFS MACHO)
|
||||
elseif("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||
add_compile_definitions(ELF)
|
||||
list(APPEND VBAM_COMPILE_DEFS ELF)
|
||||
endif()
|
||||
|
||||
if(X86_64)
|
||||
add_compile_definitions(__AMD64__ __X86_64__)
|
||||
list(APPEND VBAM_COMPILE_DEFS __AMD64__ __X86_64__)
|
||||
endif()
|
||||
|
||||
# Enable ASAN if requested and supported.
|
||||
|
|
|
@ -9,7 +9,6 @@ Known preprocessor switches:
|
|||
- VBAM_ENABLE_DEBUGGER: Enable remote debugging support
|
||||
- MMX: Enable MMX instruction set
|
||||
- RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version)
|
||||
- NO_OGL: Exclude OpenGL code
|
||||
- NO_D3D: Exclude Direct3D code
|
||||
- VBAM_ENABLE_XAUDIO2: Enable XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
||||
- VBAM_ENABLE_FAUDIO: Enable FAudio code (the FAudio interface is an open source multiplatform re-implementation of XAudio2)
|
||||
|
|
|
@ -16,3 +16,5 @@ target_include_directories(vbam-components-av-recording
|
|||
target_link_libraries(vbam-components-av-recording
|
||||
PUBLIC ${FFMPEG_LIBRARIES}
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-components-av-recording)
|
||||
|
|
|
@ -8,3 +8,5 @@ target_sources(vbam-components-draw-text
|
|||
target_link_libraries(vbam-components-draw-text
|
||||
PRIVATE vbam-core-base
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-components-draw-text)
|
||||
|
|
|
@ -45,3 +45,5 @@ else()
|
|||
internal/hq/c/hq_shared.h
|
||||
)
|
||||
endif()
|
||||
|
||||
configure_vbam_target(vbam-components-filters)
|
||||
|
|
|
@ -4,3 +4,5 @@ target_sources(vbam-components-filters-agb
|
|||
PRIVATE filters_agb.cpp
|
||||
PUBLIC filters_agb.h
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-components-filters-agb)
|
||||
|
|
|
@ -4,3 +4,5 @@ target_sources(vbam-components-filters-interframe
|
|||
PRIVATE interframe.cpp
|
||||
PUBLIC interframe.h
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-components-filters-interframe)
|
||||
|
|
|
@ -4,3 +4,5 @@ target_sources(vbam-components-user-config
|
|||
PRIVATE user_config.cpp
|
||||
PUBLIC user_config.h
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-components-user-config)
|
||||
|
|
|
@ -137,4 +137,6 @@ if(ENABLE_LINK)
|
|||
)
|
||||
endif()
|
||||
|
||||
configure_vbam_target(vbam-core)
|
||||
|
||||
add_subdirectory(test)
|
||||
|
|
|
@ -22,3 +22,5 @@ target_sources(vbam-core-apu
|
|||
Gb_Oscs.h
|
||||
Multi_Buffer.h
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-core-apu)
|
||||
|
|
|
@ -61,4 +61,6 @@ target_link_libraries(vbam-core-base
|
|||
PUBLIC ${ZLIB_LIBRARY}
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-core-base)
|
||||
|
||||
add_subdirectory(test)
|
||||
|
|
|
@ -10,3 +10,6 @@ add_library(vbam-core-base-test
|
|||
|
||||
target_link_libraries(vbam-core-base-test
|
||||
INTERFACE GTest::gtest)
|
||||
|
||||
configure_vbam_target(vbam-core-base-test)
|
||||
|
||||
|
|
|
@ -71,3 +71,5 @@ target_include_directories(vbam-fex
|
|||
target_link_libraries(vbam-fex
|
||||
PRIVATE ${ZLIB_LIBRARY}
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-fex)
|
||||
|
|
|
@ -11,3 +11,5 @@ target_sources(vbam-core-fake
|
|||
PRIVATE
|
||||
fake_core.cpp
|
||||
)
|
||||
|
||||
configure_vbam_target(vbam-core-fake)
|
||||
|
|
|
@ -68,6 +68,8 @@ if(WIN32)
|
|||
target_link_libraries(vbam wsock32 ws2_32 winmm version imm32 ${SDL2MAIN_LIBRARY})
|
||||
endif()
|
||||
|
||||
configure_vbam_target(vbam)
|
||||
|
||||
# Installation scripts.
|
||||
install(
|
||||
PROGRAMS ${PROJECT_BINARY_DIR}/vbam${CMAKE_EXECUTABLE_SUFFIX}
|
||||
|
|
|
@ -155,38 +155,9 @@ if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
|||
set(wxWidgets_DIR "${VCPKG_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/share/wxwidgets")
|
||||
endif()
|
||||
|
||||
set(ENABLE_OPENGL TRUE)
|
||||
find_package(wxWidgets COMPONENTS xrc xml html adv net core base gl ${wx_find_extra})
|
||||
|
||||
if(NOT wxWidgets_FOUND)
|
||||
find_package(wxWidgets COMPONENTS xrc xml html adv net core base ${wx_find_extra} REQUIRED)
|
||||
set(ENABLE_OPENGL FALSE)
|
||||
endif()
|
||||
|
||||
# Fixup wxWidgets paths for vcpkg debug builds.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||
set(wxWidgets_ROOT_DIR "${wxWidgets_ROOT_DIR}/debug" CACHE INTERNAL "wxWidgets root directory" FORCE)
|
||||
string(REGEX REPLACE "/lib$" "/debug/lib" wxWidgets_LIB_DIR "${wxWidgets_LIB_DIR}")
|
||||
set(wxWidgets_LIB_DIR "${wxWidgets_LIB_DIR}" CACHE INTERNAL "wxWidgets library directory" FORCE)
|
||||
endif()
|
||||
|
||||
# Find OpenAL (required).
|
||||
find_package(OpenAL REQUIRED)
|
||||
|
||||
# Workaround of static liblzma not being found on MSYS2.
|
||||
if(VBAM_STATIC AND MSYS)
|
||||
unset(cleaned_up_wx_libs)
|
||||
foreach(lib ${wxWidgets_LIBRARIES})
|
||||
if(lib STREQUAL "-llzma")
|
||||
set(lib "liblzma.a")
|
||||
endif()
|
||||
|
||||
list(APPEND cleaned_up_wx_libs "${lib}")
|
||||
endforeach()
|
||||
|
||||
set(wxWidgets_LIBRARIES "${cleaned_up_wx_libs}")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${wxWidgets_LIBRARIES})
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${wxWidgets_INCLUDE_DIRS})
|
||||
list(APPEND CMAKE_REQUIRED_FLAGS ${wxWidgets_CXX_FLAGS})
|
||||
|
@ -197,6 +168,7 @@ endforeach()
|
|||
# Configure common settings for wx-based targets, like linking, include
|
||||
# directories, compile options, and definitions.
|
||||
function(configure_wx_target target)
|
||||
configure_vbam_target(${target})
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(target_type STREQUAL "EXECUTABLE")
|
||||
set(target_is_executable TRUE)
|
||||
|
@ -292,12 +264,7 @@ function(configure_wx_target target)
|
|||
_add_link_libraries(${VBAM_SDL2_LIBS})
|
||||
|
||||
# OpenGL.
|
||||
if(ENABLE_OPENGL)
|
||||
_add_link_libraries(${OPENGL_LIBRARIES})
|
||||
else()
|
||||
_add_compile_definitions(NO_OGL)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Sub-projects.
|
||||
|
|
|
@ -137,11 +137,7 @@ std::array<Option, kNbOptions>& Option::All() {
|
|||
Interframe interframe = Interframe::kNone;
|
||||
bool keep_on_top = false;
|
||||
int32_t max_threads = 0;
|
||||
#if defined(NO_OGL)
|
||||
RenderMethod render_method = RenderMethod::kSimple;
|
||||
#else
|
||||
RenderMethod render_method = RenderMethod::kOpenGL;
|
||||
#endif
|
||||
double video_scale = 3;
|
||||
bool retain_aspect = true;
|
||||
|
||||
|
|
|
@ -263,9 +263,7 @@ DisplayConfig::DisplayConfig(wxWindow* parent)
|
|||
GetValidatedChild("OutputQuartz2D")->Hide();
|
||||
#endif
|
||||
|
||||
#ifdef NO_OGL
|
||||
GetValidatedChild("OutputOpenGL")->Hide();
|
||||
#elif defined(HAVE_WAYLAND_SUPPORT) && !defined(HAVE_WAYLAND_EGL)
|
||||
#if defined(HAVE_WAYLAND_SUPPORT) && !defined(HAVE_WAYLAND_EGL)
|
||||
// wxGLCanvas segfaults on Wayland before wx 3.2.
|
||||
if (IsWayland()) {
|
||||
GetValidatedChild("OutputOpenGL")->Hide();
|
||||
|
@ -276,7 +274,7 @@ DisplayConfig::DisplayConfig(wxWindow* parent)
|
|||
#else
|
||||
GetValidatedChild("OutputOpenGL")
|
||||
->SetValidator(RenderValidator(config::RenderMethod::kOpenGL));
|
||||
#endif // NO_OGL
|
||||
#endif // defined(HAVE_WAYLAND_SUPPORT) && !defined(HAVE_WAYLAND_EGL)
|
||||
|
||||
#if defined(__WXMSW__) && !defined(NO_D3D)
|
||||
// Enable the Direct3D option on Windows.
|
||||
|
|
|
@ -12,12 +12,6 @@ protected:
|
|||
virtual void DrawImage(wxWindowDC& dc, wxImage* im);
|
||||
};
|
||||
|
||||
// wx <= 2.8 may not be compiled with opengl support
|
||||
#if !wxCHECK_VERSION(2, 9, 0) && !wxUSE_GLCANVAS
|
||||
#define NO_OGL
|
||||
#endif
|
||||
|
||||
#ifndef NO_OGL
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
// shuffled parms for 2.9 indicates non-auto glcontext
|
||||
|
@ -65,6 +59,5 @@ public:
|
|||
Quartz2DDrawingPanel(wxWindow* parent, int _width, int _height);
|
||||
virtual void DrawImage(wxWindowDC& dc, wxImage* im);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // VBAM_WX_DRAWING_H_
|
||||
|
|
|
@ -1167,11 +1167,9 @@ void GameArea::OnIdle(wxIdleEvent& event)
|
|||
new Quartz2DDrawingPanel(this, basic_width, basic_height);
|
||||
break;
|
||||
#endif
|
||||
#ifndef NO_OGL
|
||||
case config::RenderMethod::kOpenGL:
|
||||
panel = new GLDrawingPanel(this, basic_width, basic_height);
|
||||
break;
|
||||
#endif
|
||||
#if defined(__WXMSW__) && !defined(NO_D3D)
|
||||
case config::RenderMethod::kDirect3d:
|
||||
panel = new DXDrawingPanel(this, basic_width, basic_height);
|
||||
|
@ -2147,17 +2145,18 @@ void BasicDrawingPanel::DrawImage(wxWindowDC& dc, wxImage* im)
|
|||
dc.DrawBitmap(bm, 0, 0);
|
||||
}
|
||||
|
||||
#ifndef NO_OGL
|
||||
// following 3 for vsync
|
||||
#ifdef __WXMAC__
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__ // should actually check for X11, but GTK implies X11
|
||||
#ifndef Status
|
||||
#define Status int
|
||||
#endif
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
@ -2415,8 +2414,6 @@ void GLDrawingPanel::DrawArea(wxWindowDC& dc)
|
|||
SwapBuffers();
|
||||
}
|
||||
|
||||
#endif // GL support
|
||||
|
||||
#if defined(__WXMSW__) && !defined(NO_D3D)
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#include <d3d9.h> // main include file
|
||||
|
|
|
@ -30,7 +30,6 @@ using std::int8_t;
|
|||
using std::int16_t;
|
||||
using std::int32_t;
|
||||
|
||||
#ifndef NO_OGL
|
||||
// glcanvas must be included before SFML for MacOSX
|
||||
// originally, this was confined to drawing.h.
|
||||
#include <wx/glcanvas.h>
|
||||
|
@ -41,7 +40,6 @@ using std::int32_t;
|
|||
#ifdef BadRequest
|
||||
#undef BadRequest
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// compatibility with wx-2.9
|
||||
// The only reason I use wxTRANSLATE at all is to get wxT as a side effect.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit eda54e82e281ce949ae44f6796ae50669f7c1924
|
Loading…
Reference in New Issue