mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 09:49:00 +08:00
050e71d01d
* [various ports] remove references to CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS * [alac,benchmark,capnproto] Fix check_linkage call * [fastlz] Fix SHA512 * [coroutine] Fix dynamic build * [folly] Find double-conversion * [gamma] Use vcpkg_from_github * [librsync] Enable static builds * [netcdf-cxx4] Fix SHA512 * [octomap] Fix static build * [tidy-html5] Fix static build * [various ports] remove custom messages for shared/static builds, modernize some scripts in the meantime * [folly] Use ras0219's fix for link paths * [octomap] Fix exported targets * [uvatlas] Set tool download SHA512 * [duktape+python2] fix portfile to call configure with correct python version, manage python2 also outside win32 * [suitesparse] osx fix * [gtkmm] Call vcpkg_check_linkage after including vcpkg functions * [duktape] Resolve conflicts * [duktape] FIxed typo in Python paths * [wangle] Find zlib * [openssl-uwp] Fix SHA512 * [glib] Allow static builds on non-Windows * [suitesparse] Fix build on Windows * [multiple ports] Bump CONTROL version * [multiple ports] Fix description indent * [directxtk] Fix CONTROL file * [bde,duktape,qpid-proton] Build packages with python2 installed * [binn] remove CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS * [gdal,live555,uriparser] Fix regressions * [live555] Update to 2019.04.24
120 lines
3.6 KiB
CMake
120 lines
3.6 KiB
CMake
cmake_minimum_required(VERSION 3.9)
|
|
project(glibmm)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
find_path(GLIB_INCLUDE_DIR NAMES glib.h)
|
|
find_library(GLIB_LIBRARY NAMES glib-2.0)
|
|
find_library(GIO_LIBRARY NAMES gio-2.0)
|
|
find_library(GOBJECT_LIBRARY NAMES gobject-2.0)
|
|
find_library(GMODULE_LIBRARY NAMES gmodule-2.0)
|
|
find_library(GTHREAD_LIBRARY NAMES gthread-2.0)
|
|
find_program(GLIB_COMPILE_SCHEMAS NAMES glib-compile-schemas)
|
|
find_library(PCRE_LIBRARY NAMES pcre)
|
|
find_library(SIGC_LIBRARY NAMES sigc-2.0)
|
|
find_library(FFI_LIBRARY NAMES ffi libffi)
|
|
|
|
include_directories(${GLIB_INCLUDE_DIR})
|
|
link_libraries(
|
|
${GIO_LIBRARY}
|
|
${GOBJECT_LIBRARY}
|
|
${GMODULE_LIBRARY}
|
|
${GTHREAD_LIBRARY}
|
|
${GLIB_LIBRARY}
|
|
${PCRE_LIBRARY}
|
|
${SIGC_LIBRARY}
|
|
${FFI_LIBRARY}
|
|
)
|
|
|
|
if(APPLE)
|
|
find_library(LIBINTL_LIBRARY NAMES intl)
|
|
endif()
|
|
|
|
find_package(unofficial-iconv REQUIRED)
|
|
link_libraries(${LIBINTL_LIBRARY} unofficial::iconv::libiconv)
|
|
|
|
if(APPLE)
|
|
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
|
find_library(CORESERVICES_LIBRARY CoreServices)
|
|
find_library(FOUNDATION_LIBRARY Foundation)
|
|
link_libraries(${COREFOUNDATION_LIBRARY} ${CORESERVICES_LIBRARY} ${FOUNDATION_LIBRARY})
|
|
endif()
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
add_definitions(-DGLIBMM_DLL -DGIOMM_DLL)
|
|
else()
|
|
add_definitions(-DGLIBMM_STATIC_LIB -DGIOMM_STATIC_LIB)
|
|
endif()
|
|
|
|
if(WIN32)
|
|
add_compile_options(/FI${WARNINGS_HEADER} -DSIZEOF_WCHAR_T=2)
|
|
else()
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads REQUIRED)
|
|
link_libraries(Threads::Threads ${CMAKE_DL_LIBS})
|
|
endif()
|
|
|
|
if(WIN32)
|
|
configure_file(MSVC_Net2013/giomm/giommconfig.h ${CMAKE_BINARY_DIR}/config/gio/giommconfig.h COPYONLY)
|
|
configure_file(MSVC_Net2013/glibmm/glibmmconfig.h ${CMAKE_BINARY_DIR}/config/glib/glibmmconfig.h COPYONLY)
|
|
else()
|
|
set(ENV{GLIB_COMPILE_SCHEMAS} "${GLIB_COMPILE_SCHEMAS}")
|
|
set(ENV{GLIBMM_CFLAGS} -I${GLIB_INCLUDE_DIR})
|
|
set(ENV{GLIBMM_LIBS} "${GLIB_LIBRARY}")
|
|
set(ENV{GIOMM_CFLAGS} -I${GLIB_INCLUDE_DIR})
|
|
set(ENV{GIOMM_LIBS} "${GIO_LIBRARY}")
|
|
set(ENV{PKG_CONFIG} "echo")
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/config)
|
|
execute_process(
|
|
COMMAND "${CMAKE_SOURCE_DIR}/configure"
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/config
|
|
RESULT_VARIABLE res
|
|
)
|
|
if(NOT res EQUAL 0)
|
|
message(FATAL_ERROR "Configure failed.")
|
|
endif()
|
|
endif()
|
|
|
|
file(GLOB GLIBMM_SOURCES glib/glibmm/*.cc)
|
|
add_library(glibmm ${GLIBMM_SOURCES})
|
|
target_compile_definitions(glibmm PRIVATE -DGLIBMM_BUILD)
|
|
target_include_directories(glibmm PUBLIC glib ${CMAKE_BINARY_DIR}/config/glib)
|
|
|
|
file(GLOB GIOMM_SOURCES gio/giomm/*.cc)
|
|
if(WIN32)
|
|
list(FILTER GIOMM_SOURCES EXCLUDE REGEX "desktopappinfo.cc\$|/unix[^/]+.cc\$")
|
|
endif()
|
|
add_library(giomm ${GIOMM_SOURCES})
|
|
target_compile_definitions(giomm PRIVATE -DGIOMM_BUILD)
|
|
target_link_libraries(giomm PUBLIC glibmm)
|
|
target_include_directories(giomm PUBLIC gio ${CMAKE_BINARY_DIR}/config/gio)
|
|
|
|
install(
|
|
TARGETS glibmm giomm
|
|
RUNTIME DESTINATION bin
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
)
|
|
|
|
if(NOT DISABLE_INSTALL_HEADERS)
|
|
install(
|
|
FILES
|
|
${CMAKE_BINARY_DIR}/config/gio/giommconfig.h
|
|
gio/giomm.h
|
|
${CMAKE_BINARY_DIR}/config/glib/glibmmconfig.h
|
|
glib/glibmm.h
|
|
DESTINATION include
|
|
)
|
|
install(
|
|
DIRECTORY gio/giomm glib/glibmm
|
|
DESTINATION include
|
|
FILES_MATCHING PATTERN *.h
|
|
)
|
|
endif()
|
|
|
|
if(NOT DISABLE_EXAMPLES)
|
|
add_executable(options examples/options/main.cc)
|
|
target_link_libraries(options PRIVATE giomm)
|
|
endif()
|