All: Don't require dllexports.h on standalone builds (really fixes #1464)

This commit is contained in:
Vicki Pfau 2019-06-24 08:30:28 -07:00
parent e40617f850
commit fb72b70505
8 changed files with 17 additions and 10 deletions

View File

@ -855,6 +855,10 @@ if(NOT SKIP_LIBRARY)
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}" COMPILE_OPTIONS "${FEATURE_FLAGS}")
add_dependencies(${BINARY_NAME} version-info) 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}) 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}) install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
if(UNIX AND NOT APPLE AND NOT HAIKU) if(UNIX AND NOT APPLE AND NOT HAIKU)
@ -906,7 +910,7 @@ if(BUILD_LIBRETRO)
file(GLOB RETRO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/libretro/*.c) file(GLOB RETRO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/libretro/*.c)
add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC}) add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC})
add_dependencies(${BINARY_NAME}_libretro version-info) add_dependencies(${BINARY_NAME}_libretro version-info)
set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "__LIBRETRO__;COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2") set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "__LIBRETRO__;COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;MGBA_STANDALONE;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2")
target_link_libraries(${BINARY_NAME}_libretro ${OS_LIB}) target_link_libraries(${BINARY_NAME}_libretro ${OS_LIB})
if(MSVC) if(MSVC)
install(TARGETS ${BINARY_NAME}_libretro RUNTIME DESTINATION ${LIBRETRO_LIBDIR} COMPONENT ${BINARY_NAME}_libretro) install(TARGETS ${BINARY_NAME}_libretro RUNTIME DESTINATION ${LIBRETRO_LIBDIR} COMPONENT ${BINARY_NAME}_libretro)
@ -925,7 +929,7 @@ if(BUILD_OPENEMU)
BUNDLE TRUE BUNDLE TRUE
BUNDLE_EXTENSION oecoreplugin BUNDLE_EXTENSION oecoreplugin
OUTPUT_NAME ${PROJECT_NAME} OUTPUT_NAME ${PROJECT_NAME}
COMPILE_DEFINITIONS "DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=1") COMPILE_DEFINITIONS "DISABLE_THREADING;MGBA_STANDALONE;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=1")
target_link_libraries(${BINARY_NAME}-openemu ${OS_LIB} ${FOUNDATION} ${OPENEMUBASE}) target_link_libraries(${BINARY_NAME}-openemu ${OS_LIB} ${FOUNDATION} ${OPENEMUBASE})
install(TARGETS ${BINARY_NAME}-openemu LIBRARY DESTINATION ${OE_LIBDIR} COMPONENT ${BINARY_NAME}.oecoreplugin NAMELINK_SKIP) install(TARGETS ${BINARY_NAME}-openemu LIBRARY DESTINATION ${OE_LIBDIR} COMPONENT ${BINARY_NAME}.oecoreplugin NAMELINK_SKIP)
endif() endif()
@ -995,11 +999,8 @@ if(BUILD_EXAMPLE)
endif() endif()
endif() endif()
include(GenerateExportHeader)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/mgba) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/mgba)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/mgba-util)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h)
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)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h") install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba-util DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h") install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba-util DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT ${BINARY_NAME}-dev) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT ${BINARY_NAME}-dev)

View File

@ -65,6 +65,13 @@ typedef intptr_t ssize_t;
#include <sys/syslimits.h> #include <sys/syslimits.h>
#endif #endif
#ifndef MGBA_STANDALONE
#include <mgba-util/dllexports.h>
#else
#define MGBA_EXPORT
#define MGBA_NO_EXPORT
#endif
#ifndef SSIZE_MAX #ifndef SSIZE_MAX
#define SSIZE_MAX ((ssize_t) (SIZE_MAX >> 1)) #define SSIZE_MAX ((ssize_t) (SIZE_MAX >> 1))
#endif #endif

View File

@ -7,7 +7,6 @@
#define M_LOG_H #define M_LOG_H
#include <mgba-util/common.h> #include <mgba-util/common.h>
#include <mgba-util/dllexports.h>
CXX_GUARD_START CXX_GUARD_START

View File

@ -10,7 +10,11 @@
extern "C" { extern "C" {
#endif #endif
#ifdef MGBA_STANDALONE
#define MGBA_EXPORT
#else
#include <mgba-util/dllexports.h> #include <mgba-util/dllexports.h>
#endif
extern MGBA_EXPORT const char* const gitCommit; extern MGBA_EXPORT const char* const gitCommit;
extern MGBA_EXPORT const char* const gitCommitShort; extern MGBA_EXPORT const char* const gitCommitShort;

View File

@ -7,7 +7,6 @@
#define GBA_INTERFACE_H #define GBA_INTERFACE_H
#include <mgba-util/common.h> #include <mgba-util/common.h>
#include <mgba-util/dllexports.h>
CXX_GUARD_START CXX_GUARD_START

View File

@ -7,7 +7,6 @@
#define GB_IO_H #define GB_IO_H
#include <mgba-util/common.h> #include <mgba-util/common.h>
#include <mgba-util/dllexports.h>
CXX_GUARD_START CXX_GUARD_START

View File

@ -7,7 +7,6 @@
#define GBA_INPUT_H #define GBA_INPUT_H
#include <mgba-util/common.h> #include <mgba-util/common.h>
#include <mgba-util/dllexports.h>
CXX_GUARD_START CXX_GUARD_START

View File

@ -7,7 +7,6 @@
#define GBA_VIDEO_H #define GBA_VIDEO_H
#include <mgba-util/common.h> #include <mgba-util/common.h>
#include <mgba-util/dllexports.h>
CXX_GUARD_START CXX_GUARD_START