Skip to content

Commit

Permalink
[glib][atk] Disable static builds, fix generation to happen outside t…
Browse files Browse the repository at this point in the history
…he source directory
  • Loading branch information
ras0219-msft committed Mar 5, 2018
1 parent 6675327 commit 26fabaf
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 23 deletions.
31 changes: 18 additions & 13 deletions ports/atk/CMakeLists.txt
Expand Up @@ -11,21 +11,26 @@ endif()

# generate atkmarshal.c and atkmarshal.h source files
# glib-genmarshal should be installed along with glib
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/atk/atkmarshal.h OR NOT EXISTS ${CMAKE_SOURCE_DIR}/atk/atkmarshal.c)
find_program(GLIB_GENMARSHAL glib-genmarshal PATH_SUFFIXES glib)
execute_process(
COMMAND ${GLIB_GENMARSHAL} --prefix=atk_marshal atkmarshal.list --header
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/atk
OUTPUT_FILE ${CMAKE_SOURCE_DIR}/atk/atkmarshal.h)
execute_process(
COMMAND ${GLIB_GENMARSHAL} --prefix=atk_marshal atkmarshal.list --body
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/atk
OUTPUT_FILE ${CMAKE_SOURCE_DIR}/atk/atkmarshal.c)
endif()
find_program(GLIB_GENMARSHAL glib-genmarshal PATH_SUFFIXES glib)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/atk)

message("Generating atkmarshal.h: ${GLIB_GENMARSHAL} --prefix=atk_marshal ${CMAKE_CURRENT_SOURCE_DIR}/atk/atkmarshal.list --header")
execute_process(
COMMAND ${GLIB_GENMARSHAL} --prefix=atk_marshal ${CMAKE_CURRENT_SOURCE_DIR}/atk/atkmarshal.list --header
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/atk
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/atk/atkmarshal.h
)

message("Generating atkmarshal.c: ${GLIB_GENMARSHAL} --prefix=atk_marshal ${CMAKE_CURRENT_SOURCE_DIR}/atk/atkmarshal.list --body")
execute_process(
COMMAND ${GLIB_GENMARSHAL} --prefix=atk_marshal ${CMAKE_CURRENT_SOURCE_DIR}/atk/atkmarshal.list --body
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/atk
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/atk/atkmarshal.c
)

configure_file(config.h.win32 ${CMAKE_SOURCE_DIR}/config.h COPYONLY)
configure_file(config.h.win32 ${CMAKE_CURRENT_BINARY_DIR}/config.h COPYONLY)
add_definitions(-DHAVE_CONFIG_H)
include_directories(. ./atk)
include_directories(. ./atk ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/atk)

find_path(GLIB_INCLUDE_DIR glib.h)
find_library(GLIB_GLIB_LIBRARY glib-${GLIB_LIB_VERSION})
Expand Down
2 changes: 1 addition & 1 deletion ports/atk/CONTROL
@@ -1,4 +1,4 @@
Source: atk
Version: 2.24.0-1
Version: 2.24.0-2
Description: GNOME Accessibility Toolkit
Build-Depends: glib, gettext
5 changes: 2 additions & 3 deletions ports/atk/portfile.cmake
@@ -1,7 +1,6 @@
# ATK uses DllMain
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(STATUS "Warning: Static building not supported. Building dynamic.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR VCPKG_CRT_LINKAGE STREQUAL "static")
message(FATAL_ERROR "ATK only supports dynamic library and crt linkage")
endif()

include(vcpkg_common_functions)
Expand Down
5 changes: 4 additions & 1 deletion ports/glib/CMakeLists.txt
Expand Up @@ -27,6 +27,8 @@ find_library(PCRE_LIBRARY pcre${PCRE_SUFFIX})
# libiconv
find_path(ICONV_INCLUDE_DIR iconv.h)
find_library(ICONV_LIBRARY NAMES iconv libiconv)
# libiconv
find_library(CHARSET_LIBRARY NAMES charset libcharset)
# libffi
find_path(FFI_INCLUDE_DIR ffi.h)
find_library(FFI_LIBRARY NAMES ffi libffi)
Expand Down Expand Up @@ -64,7 +66,7 @@ extract_vcproj_sources(win32/vs14/glib.vcxproj GLIB_SOURCES)
list(APPEND GLIB_SOURCES glib/libcharset/localcharset.c) # modified internal version with prefixed symbols
add_library(glib ${GLIB_SOURCES})
target_compile_definitions(glib PRIVATE USE_SYSTEM_PCRE ${GLIB_EXPORT_MACRO} GLIB_COMPILATION G_LOG_DOMAIN="GLib" LIBDIR)
target_link_libraries(glib ws2_32 winmm ${PCRE_LIBRARY} ${ICONV_LIBRARY} ${LIBINTL_LIBRARY})
target_link_libraries(glib ws2_32 winmm ${PCRE_LIBRARY} ${ICONV_LIBRARY} ${CHARSET_LIBRARY} ${LIBINTL_LIBRARY})
target_include_directories(glib PRIVATE ${PCRE_INCLUDE_DIR} ${ICONV_INCLUDE_DIR})
target_include_directories(glib PUBLIC ${LIBINTL_INCLUDE_DIR})
list(APPEND GLIB_TARGETS glib)
Expand Down Expand Up @@ -161,5 +163,6 @@ message(STATUS "Link-time dependencies:")
message(STATUS " " ${ZLIB_LIBRARIES})
message(STATUS " " ${PCRE_LIBRARY})
message(STATUS " " ${ICONV_LIBRARY})
message(STATUS " " ${CHARSET_LIBRARY})
message(STATUS " " ${FFI_LIBRARY})
message(STATUS " " ${LIBINTL_LIBRARY})
2 changes: 1 addition & 1 deletion ports/glib/CONTROL
@@ -1,4 +1,4 @@
Source: glib
Version: 2.52.3-1
Version: 2.52.3-2
Description: Portable, general-purpose utility library.
Build-Depends: zlib, pcre, libffi, gettext, libiconv
7 changes: 3 additions & 4 deletions ports/glib/portfile.cmake
@@ -1,12 +1,11 @@
# Glib uses winapi functions not available in WindowsStore
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "Error: UWP builds are currently not supported.")
endif()

# Glib relies on DllMain
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(STATUS "Warning: Static building not supported. Building dynamic.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR VCPKG_CRT_LINKAGE STREQUAL "static")
message(FATAL_ERROR "Glib only supports dynamic library and crt linkage")
endif()

include(vcpkg_common_functions)
Expand Down

0 comments on commit 26fabaf

Please sign in to comment.