diff --git a/CMakeLists.txt b/CMakeLists.txt index 499ddce..895fda9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,10 @@ add_definitions(-DHAVE_CONFIG_H) if(MSVC) # avoid security warnings for e.g., fopen() used in the examples. add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DWEBP_HAVE_JUST_SDL_H) + if(BUILD_SHARED_LIBS) + add_definitions(-DWEBP_EXTERN=__declspec\(dllexport\)) + endif() else() add_definitions(-Wall) endif() @@ -342,19 +346,23 @@ if(WEBP_BUILD_ANIM_UTILS "example_util_[^ ]*") list(APPEND EXAMPLEUTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/examples/stopwatch.h) add_library(exampleutil ${EXAMPLEUTIL_SRCS}) + set_target_properties(exampleutil PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_include_directories( exampleutil PUBLIC $) + target_link_libraries(exampleutil imageioutil) parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEIOUTILS_SRCS" "imageio_util_[^ ]*") add_library(imageioutil ${IMAGEIOUTILS_SRCS}) + set_target_properties(imageioutil PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_link_libraries(imageioutil webp) # Image-decoding utility library. parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEDEC_SRCS" "imagedec_[^ ]*") add_library(imagedec ${IMAGEDEC_SRCS}) + set_target_properties(imagedec PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_link_libraries(imagedec imageioutil webpdemux @@ -365,7 +373,8 @@ if(WEBP_BUILD_ANIM_UTILS parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEENC_SRCS" "imageenc_[^ ]*") add_library(imageenc ${IMAGEENC_SRCS}) - target_link_libraries(imageenc webp) + set_target_properties(imageenc PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + target_link_libraries(imageenc imageioutil webp) set_property(TARGET exampleutil imageioutil @@ -380,7 +389,7 @@ if(WEBP_BUILD_DWEBP) parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "DWEBP_SRCS" "dwebp") add_executable(dwebp ${DWEBP_SRCS}) target_link_libraries(dwebp exampleutil imagedec imageenc) - target_include_directories(dwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(dwebp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) install(TARGETS dwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -389,13 +398,14 @@ if(WEBP_BUILD_CWEBP) parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "CWEBP_SRCS" "cwebp") add_executable(cwebp ${CWEBP_SRCS}) target_link_libraries(cwebp exampleutil imagedec webp) - target_include_directories(cwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(cwebp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) install(TARGETS cwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP) parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS" "") add_library(libwebpmux ${WEBP_MUX_SRCS}) + set_target_properties(libwebpmux PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_link_libraries(libwebpmux webp) target_include_directories(libwebpmux PRIVATE ${CMAKE_CURRENT_BINARY_DIR} @@ -411,7 +421,7 @@ if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP) "${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\ ${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\ ${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h;") - set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME webpmux) + #set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME webpmux) list(APPEND INSTALLED_LIBRARIES libwebpmux) configure_pkg_config("src/mux/libwebpmux.pc") endif() @@ -428,7 +438,7 @@ if(WEBP_BUILD_GIF2WEBP) webp libwebpmux ${WEBP_DEP_GIF_LIBRARIES}) - target_include_directories(gif2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(gif2webp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) install(TARGETS gif2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -444,7 +454,7 @@ if(WEBP_BUILD_IMG2WEBP) imageioutil webp libwebpmux) - target_include_directories(img2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(img2webp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) install(TARGETS img2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -464,6 +474,7 @@ if(WEBP_BUILD_VWEBP) webpdemux) target_include_directories(vwebp PRIVATE GLUT::GLUT + ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src ${OPENGL_INCLUDE_DIR}) install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -483,7 +494,7 @@ if(WEBP_BUILD_WEBPINFO) "webpinfo") add_executable(webpinfo ${WEBPINFO_SRCS}) target_link_libraries(webpinfo exampleutil imageioutil) - target_include_directories(webpinfo PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(webpinfo PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) install(TARGETS webpinfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -493,7 +504,7 @@ if(WEBP_BUILD_WEBPMUX) "webpmux") add_executable(webpmux ${WEBPMUX_SRCS}) target_link_libraries(webpmux exampleutil imageioutil libwebpmux webp) - target_include_directories(webpmux PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(webpmux PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) install(TARGETS webpmux RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -540,7 +551,7 @@ if(WEBP_BUILD_WEBP_JS) # JavaScript version add_executable(webp_js ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c) target_link_libraries(webp_js webpdecoder SDL) - target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) set(WEBP_HAVE_SDL 1) set_target_properties( webp_js @@ -553,7 +564,7 @@ if(WEBP_BUILD_WEBP_JS) # WASM version add_executable(webp_wasm ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c) target_link_libraries(webp_wasm webpdecoder SDL) - target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) set_target_properties( webp_wasm PROPERTIES LINK_FLAGS "-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' \ @@ -579,7 +590,7 @@ if(WEBP_BUILD_ANIM_UTILS) libwebpmux webpdemux ${WEBP_DEP_GIF_LIBRARIES}) - target_include_directories(anim_diff PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(anim_diff PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) # anim_dump include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS} ${WEBP_DEP_GIF_INCLUDE_DIRS}) @@ -595,7 +606,7 @@ if(WEBP_BUILD_ANIM_UTILS) libwebpmux webpdemux ${WEBP_DEP_GIF_LIBRARIES}) - target_include_directories(anim_dump PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src) + target_include_directories(anim_dump PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) endif() # Install the different headers and libraries.