Skip to content

Commit

Permalink
full vcpkg test
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Aug 23, 2024
1 parent f81395a commit dc28f03
Show file tree
Hide file tree
Showing 19 changed files with 461 additions and 651 deletions.
136 changes: 0 additions & 136 deletions .cmake/FindIconv.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions .cmake/configure_and_install_pc_file.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function(configure_and_install_pc_file name version)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "\${prefix}")
set(libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
set(VERSION "${version}")

configure_file(${name}.pc.in ${PROJECT_BINARY_DIR}/${name}.pc @ONLY)
Expand Down
45 changes: 24 additions & 21 deletions .cmake/create_targets_both_lib_types.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ function(create_targets_both_lib_types basename)
add_library(${lib_shared} SHARED $<TARGET_OBJECTS:${lib_objlib}>)
add_library(${lib_static} STATIC $<TARGET_OBJECTS:${lib_objlib}>)

include(CheckIPOSupported)
check_ipo_supported(RESULT lto_supported OUTPUT error)
if(lto_supported)
set_target_properties(${lib_objlib} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE
)
else()
message(STATUS "IPO/LTO not supported: <${error}>")
endif()

# Internal deps
foreach(idep ${ARGN})
add_dependencies(${lib_objlib} ${idep}_objlib)
Expand All @@ -22,11 +34,19 @@ function(create_targets_both_lib_types basename)
set(INTERNAL_DEP_INC_DIR ${PROJECT_SOURCE_DIR}/../../lib${idep}/trunk/src)
endif()
target_include_directories(${lib_objlib} PRIVATE ${INTERNAL_DEP_INC_DIR})
if(TRY_STATIC_LIBS)
target_link_libraries(${lib_shared} "${INTERNAL_DEP_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${idep}${CMAKE_STATIC_LIBRARY_SUFFIX}")
if (WIN32 AND NOT VCPKG_TARGET_TRIPLET MATCHES "-static")
if (CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
target_link_libraries(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}/$<CONFIG>")
else()
target_link_libraries(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}")
endif()
target_link_libraries(${lib_shared} PRIVATE ${idep})
else()
target_link_directories(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}")
target_link_libraries(${lib_shared} "${idep}")
if (CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
target_link_libraries(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}/$<CONFIG>/${CMAKE_STATIC_LIBRARY_PREFIX}${idep}${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
target_link_libraries(${lib_shared} PRIVATE "${INTERNAL_DEP_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${idep}${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
endif()
endforeach()

Expand All @@ -46,23 +66,6 @@ function(create_targets_both_lib_types basename)
# Defines
target_compile_definitions(${lib_objlib} PRIVATE PACKAGE="${PROJECT_NAME}" VERSION="${PROJECT_VERSION}")

# CFLAGS and include dirs
if(TRY_STATIC_LIBS)
target_compile_options(${lib_objlib} PRIVATE ${DEPS_STATIC_CFLAGS})
else()
target_compile_options(${lib_objlib} PRIVATE ${DEPS_CFLAGS})
endif()
target_include_directories(${lib_objlib} PRIVATE src)

# Link-related properties, flags...
if(TRY_STATIC_LIBS)
target_link_directories(${lib_shared} PRIVATE ${TRY_STATIC_DEPS_LIBSDIRS})
target_link_libraries(${lib_shared} ${TRY_STATIC_DEPS_LDFLAGS_OTHER} ${TRY_STATIC_DEPS_LIBS})
else()
target_link_directories(${lib_shared} PRIVATE ${DEPS_LIBRARY_DIRS})
target_link_libraries(${lib_shared} ${DEPS_LDFLAGS_OTHER} ${DEPS_LIBRARIES})
endif()

# Stuff to install and developer-related things
install(TARGETS ${lib_shared} ${lib_static}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand Down
95 changes: 0 additions & 95 deletions .cmake/try_static_libs.cmake

This file was deleted.

Loading

0 comments on commit dc28f03

Please sign in to comment.