mirror of
https://github.com/cemu-project/vcpkg.git
synced 2024-11-27 21:20:21 +00:00
[sdl2] Prevent exports in static build
This commit is contained in:
parent
a42da34a07
commit
dc4998bf70
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(SDL2_image)
|
||||
project(SDL2_image C)
|
||||
|
||||
### configuration ###
|
||||
|
||||
@ -27,24 +27,26 @@ set(WEBP_DYNAMIC \"libwebp-4.dll\")
|
||||
|
||||
add_library(SDL2_image
|
||||
IMG.c
|
||||
IMG_bmp.c
|
||||
IMG_gif.c
|
||||
IMG_jpg.c
|
||||
IMG_lbm.c
|
||||
IMG_pcx.c
|
||||
IMG_png.c
|
||||
IMG_pnm.c
|
||||
IMG_tga.c
|
||||
IMG_tif.c
|
||||
IMG_webp.c
|
||||
IMG_xcf.c
|
||||
IMG_xpm.c
|
||||
IMG_xv.c
|
||||
IMG_xxx.c
|
||||
)
|
||||
IMG_bmp.c
|
||||
IMG_gif.c
|
||||
IMG_jpg.c
|
||||
IMG_lbm.c
|
||||
IMG_pcx.c
|
||||
IMG_png.c
|
||||
IMG_pnm.c
|
||||
IMG_tga.c
|
||||
IMG_tif.c
|
||||
IMG_webp.c
|
||||
IMG_xcf.c
|
||||
IMG_xpm.c
|
||||
IMG_xv.c
|
||||
IMG_xxx.c
|
||||
)
|
||||
|
||||
set_target_properties(SDL2_image PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
|
||||
|
||||
foreach(FORMAT ${SUPPORTED_FORMATS})
|
||||
add_definitions(-DLOAD_${FORMAT})
|
||||
add_definitions(-DLOAD_${FORMAT})
|
||||
endforeach(FORMAT)
|
||||
|
||||
# SDL
|
||||
@ -59,27 +61,27 @@ target_link_libraries(SDL2_image ${SDL_LIBRARY})
|
||||
|
||||
# external dependencies
|
||||
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||
find_package(${DEPENDENCY})
|
||||
|
||||
if(NOT DEFINED ${DEPENDENCY}_FLAG)
|
||||
set(${DEPENDENCY}_FLAG ${DEPENDENCY})
|
||||
endif()
|
||||
|
||||
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG})
|
||||
if(${DEPENDENCY}_FOUND)
|
||||
message(STATUS " --> linking statically.")
|
||||
target_link_libraries(SDL2_image ${${DEPENDENCY}_LIBRARIES})
|
||||
elseif(DEFINED ${DEPENDENCY}_DYNAMIC)
|
||||
message(STATUS " --> linking dynamically.")
|
||||
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}_DYNAMIC=${${DEPENDENCY}_DYNAMIC})
|
||||
set(RUNTIME_DEPENDENCIES ON)
|
||||
else()
|
||||
message(STATUS " --> skipping.")
|
||||
endif()
|
||||
find_package(${DEPENDENCY})
|
||||
|
||||
if(NOT DEFINED ${DEPENDENCY}_FLAG)
|
||||
set(${DEPENDENCY}_FLAG ${DEPENDENCY})
|
||||
endif()
|
||||
|
||||
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG})
|
||||
if(${DEPENDENCY}_FOUND)
|
||||
message(STATUS " --> linking statically.")
|
||||
target_link_libraries(SDL2_image ${${DEPENDENCY}_LIBRARIES})
|
||||
elseif(DEFINED ${DEPENDENCY}_DYNAMIC)
|
||||
message(STATUS " --> linking dynamically.")
|
||||
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}_DYNAMIC=${${DEPENDENCY}_DYNAMIC})
|
||||
set(RUNTIME_DEPENDENCIES ON)
|
||||
else()
|
||||
message(STATUS " --> skipping.")
|
||||
endif()
|
||||
endforeach(DEPENDENCY)
|
||||
|
||||
if(DEFINED RUNTIME_DEPENDENCIES)
|
||||
include_directories(VisualC/external/include)
|
||||
include_directories(VisualC/external/include)
|
||||
endif()
|
||||
|
||||
|
||||
@ -94,16 +96,16 @@ install(FILES SDL_image.h DESTINATION include/SDL2 CONFIGURATIONS Release)
|
||||
message(STATUS "Link-time dependencies:")
|
||||
message(STATUS " " ${SDL_LIBRARY})
|
||||
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||
if(${DEPENDENCY}_FOUND)
|
||||
message(STATUS " " ${DEPENDENCY})
|
||||
endif()
|
||||
if(${DEPENDENCY}_FOUND)
|
||||
message(STATUS " " ${DEPENDENCY})
|
||||
endif()
|
||||
endforeach(DEPENDENCY)
|
||||
|
||||
if(DEFINED RUNTIME_DEPENDENCIES)
|
||||
message(STATUS "Run-time dependencies:")
|
||||
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||
if(NOT ${DEPENDENCY}_FOUND AND DEFINED ${DEPENDENCY}_DYNAMIC)
|
||||
message(STATUS " " ${${DEPENDENCY}_DYNAMIC})
|
||||
endif()
|
||||
endforeach(DEPENDENCY)
|
||||
endif()
|
||||
message(STATUS "Run-time dependencies:")
|
||||
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||
if(NOT ${DEPENDENCY}_FOUND AND DEFINED ${DEPENDENCY}_DYNAMIC)
|
||||
message(STATUS " " ${${DEPENDENCY}_DYNAMIC})
|
||||
endif()
|
||||
endforeach(DEPENDENCY)
|
||||
endif()
|
||||
|
@ -1,5 +1,5 @@
|
||||
Source: sdl2-image
|
||||
Version: 2.0.1
|
||||
Version: 2.0.1-1
|
||||
Build-Depends: sdl2, libpng, libjpeg-turbo, tiff, libwebp
|
||||
Description: SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV
|
||||
|
||||
|
@ -25,6 +25,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindWEBP.cmake DESTINATION ${SOURCE_PATH}/cm
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
# OPTIONS
|
||||
# OPTIONS_RELEASE -DOPTIMIZE=1
|
||||
# OPTIONS_DEBUG -DDEBUGGABLE=1
|
||||
|
@ -76,6 +76,7 @@ add_library(SDL2_mixer
|
||||
native_midi/native_midi_common.c
|
||||
native_midi/native_midi_win32.c)
|
||||
|
||||
set_target_properties(SDL2_mixer PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
|
||||
target_compile_definitions(SDL2_mixer PRIVATE ${SDL_MIXER_DEFINES})
|
||||
target_include_directories(SDL2_mixer PRIVATE ${SDL_MIXER_INCLUDES} ./native_midi)
|
||||
target_link_libraries(SDL2_mixer ${SDL_MIXER_LIBRARIES} Winmm)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: sdl2-mixer
|
||||
Version: 2.0.1
|
||||
Version: 2.0.1-1
|
||||
Description: Multi-channel audio mixer library for SDL.
|
||||
Build-Depends: sdl2, libflac, smpeg2, libmodplug, libvorbis
|
||||
|
@ -8,6 +8,7 @@ find_library(SDL_LIBRARY SDL2)
|
||||
|
||||
add_library(SDL2_net SDLnet.c SDLnetselect.c SDLnetTCP.c SDLnetUDP.c)
|
||||
|
||||
set_target_properties(SDL2_net PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
|
||||
target_compile_definitions(SDL2_net PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
target_include_directories(SDL2_net PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
|
||||
target_link_libraries(SDL2_net ${SDL_LIBRARY} ws2_32 iphlpapi)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: sdl2-net
|
||||
Version: 2.0.1
|
||||
Version: 2.0.1-1
|
||||
Description: Networking library for SDL
|
||||
Build-Depends: sdl2
|
||||
|
@ -7,6 +7,7 @@ find_package(FreeType REQUIRED)
|
||||
|
||||
add_library(SDL2_ttf SDL_ttf.c)
|
||||
|
||||
set_target_properties(SDL2_ttf PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
|
||||
target_include_directories(SDL2_ttf PRIVATE ${SDL_INCLUDE_DIR}/SDL2 ${FREETYPE_INCLUDE_DIR_ft2build})
|
||||
target_link_libraries(SDL2_ttf ${SDL_LIBRARY} ${FREETYPE_LIBRARY})
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: sdl2-ttf
|
||||
Version: 2.0.14
|
||||
Version: 2.0.14-1
|
||||
Description: A library for rendering TrueType fonts with SDL
|
||||
Build-Depends: sdl2, freetype
|
||||
|
@ -1,3 +1,3 @@
|
||||
Source: sdl2
|
||||
Version: 2.0.5-2
|
||||
Version: 2.0.5-3
|
||||
Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
|
||||
|
16
ports/sdl2/export-symbols-only-in-shared-build.patch
Normal file
16
ports/sdl2/export-symbols-only-in-shared-build.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/include/begin_code.h b/include/begin_code.h
|
||||
index 04e78c6..16464f5 100644
|
||||
--- a/include/begin_code.h
|
||||
+++ b/include/begin_code.h
|
||||
@@ -58,8 +58,10 @@
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllimport)
|
||||
# endif
|
||||
-# else
|
||||
+# elif defined(SDL2_EXPORTS)
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
+# else
|
||||
+# define DECLSPEC
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
@ -11,6 +11,7 @@ vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/dont-ignore-default-libs.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/export-symbols-only-in-shared-build.patch
|
||||
)
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
|
||||
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(SMPEG2)
|
||||
project(SMPEG2 CXX)
|
||||
|
||||
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
|
||||
find_library(SDL_LIBRARY SDL2)
|
||||
@ -42,6 +42,7 @@ add_library(smpeg2
|
||||
MPEGsystem.cpp
|
||||
smpeg.cpp)
|
||||
|
||||
set_target_properties(smpeg2 PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
|
||||
target_link_libraries(smpeg2 ${SDL_LIBRARY})
|
||||
|
||||
install(TARGETS smpeg2
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: smpeg2
|
||||
Version: 2.0.0
|
||||
Version: 2.0.0-1
|
||||
Description: SDL MPEG Player Library
|
||||
Build-Depends: sdl2
|
||||
|
@ -17,6 +17,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS_DEBUG
|
||||
-DSMPEG_SKIP_HEADERS=ON)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user