all repos — mgba @ ff4406fab00c1e3288ca6e29b6e807802dae57a1

mGBA Game Boy Advance Emulator

All: Improve export headers (fixes #1738)
Vicki Pfau vi@endrift.com
Sun, 24 May 2020 22:58:50 +0000
commit

ff4406fab00c1e3288ca6e29b6e807802dae57a1

parent

dd6ba856ed63c3efccc3fe6fa1db1e386d642b18

4 files changed, 23 insertions(+), 9 deletions(-)

jump to
M CHANGESCHANGES

@@ -25,6 +25,7 @@ - GBA Video: Fix Hblank timing

- GBA Video: Fix mosaic objects drawing past the end (fixes mgba.io/i/1702) - GBA Video: Fix disabling OBJWIN in GL renderer (fixes mgba.io/i/1759) Other fixes: + - All: Improve export headers (fixes mgba.io/i/1738) - CMake: Always use devkitPro toolchain when applicable (fixes mgba.io/i/1755) - Core: Ensure ELF regions can be written before trying - Core: Fix ELF loading regression (fixes mgba.io/i/1669)
M CMakeLists.txtCMakeLists.txt

@@ -169,9 +169,9 @@ # Platform support

if(WIN32) set(WIN32_VERSION "${LIB_VERSION_MAJOR},${LIB_VERSION_MINOR},${LIB_VERSION_PATCH}") add_definitions(-D_WIN32_WINNT=0x0600) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) if(MSVC) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) add_definitions(-D_UNICODE -DUNICODE) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -municode")

@@ -820,6 +820,7 @@ endif()

if(BUILD_SHARED) add_library(${BINARY_NAME} SHARED ${SRC} ${VFS_SRC}) + set(EXPORT_DEFINES MGBA_DLL) if(BUILD_STATIC) add_library(${BINARY_NAME}-static STATIC ${SRC}) target_include_directories(${BINARY_NAME}-static BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include)

@@ -833,12 +834,10 @@ list(APPEND OS_DEFINES BUILD_STATIC)

endif() target_include_directories(${BINARY_NAME} BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) - set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}" COMPILE_OPTIONS "${FEATURE_FLAGS}") + set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES};${EXPORT_DEFINES}" COMPILE_OPTIONS "${FEATURE_FLAGS}") add_dependencies(${BINARY_NAME} version-info) - include(GenerateExportHeader) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/mgba-util) - generate_export_header(${BINARY_NAME} BASE_NAME ${BINARY_NAME} STATIC_DEFINE BUILD_STATIC EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/mgba-util/dllexports.h) target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB}) install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
M include/mgba-util/common.hinclude/mgba-util/common.h

@@ -65,12 +65,7 @@ // For PATH_MAX on modern toolchains

#include <sys/syslimits.h> #endif -#ifndef MGBA_STANDALONE #include <mgba-util/dllexports.h> -#else -#define MGBA_EXPORT -#define MGBA_NO_EXPORT -#endif #ifndef SSIZE_MAX #define SSIZE_MAX ((ssize_t) (SIZE_MAX >> 1))
A include/mgba-util/dllexports.h

@@ -0,0 +1,19 @@

+/* Copyright (c) 2013-2020 Jeffrey Pfau + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef MGBA_EXPORT_H +#define MGBA_EXPORT_H + +#if defined(BUILD_STATIC) || !defined(_MSC_VER) || defined(MGBA_STANDALONE) +#define MGBA_EXPORT +#else +#ifdef MGBA_DLL +#define MGBA_EXPORT __declspec(dllexport) +#else +#define MGBA_EXPORT __declspec(dllimport) +#endif +#endif + +#endif