diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-01-18 16:32:46 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-01-18 16:32:46 +0000 |
| commit | 80a662035e0bc4df2e1eaf1eb5d3d4ee7d3c1082 (patch) | |
| tree | a63704db74112c924e1d5c7eb4246194691c50e6 | |
| parent | Fixed linux build error (diff) | |
| download | DiligentCore-80a662035e0bc4df2e1eaf1eb5d3d4ee7d3c1082.tar.gz DiligentCore-80a662035e0bc4df2e1eaf1eb5d3d4ee7d3c1082.zip | |
Updated combined core library build and install cmake instructions
| -rw-r--r-- | CMakeLists.txt | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e05059ee..02cee561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,26 +271,45 @@ add_subdirectory(Graphics) # Installation instructions +set(COMBINED_CORE_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}DiligentCore${CMAKE_STATIC_LIBRARY_SUFFIX}") foreach(CORE_LIB ${DILIGENT_CORE_INSTALL_LIBS_LIST}) list(APPEND CORE_LIB_TARGET_FILES $<TARGET_FILE:${CORE_LIB}>) endforeach(CORE_LIB) -set(COMBINED_CORE_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}DiligentCore${CMAKE_STATIC_LIBRARY_SUFFIX}") - if(MSVC) find_program(LIB_EXE NAMES lib.exe) if(LIB_EXE) - add_custom_target(DiligentCore-static ALL - COMMAND ${LIB_EXE} /OUT:"${COMBINED_CORE_LIB_NAME}" ${CORE_LIB_TARGET_FILES} + add_custom_command( + OUTPUT ${COMBINED_CORE_LIB_NAME} + COMMAND ${LIB_EXE} /OUT:${COMBINED_CORE_LIB_NAME} ${CORE_LIB_TARGET_FILES} DEPENDS ${DILIGENT_CORE_INSTALL_LIBS_LIST} - COMMENT "Combining core libs..." + COMMENT "Combining core libraries..." ) + add_custom_target(DiligentCore-static ALL DEPENDS ${COMBINED_CORE_LIB_NAME}) else() message("Unable to find lib.exe") endif() else() + if(PLATFORM_WIN32) + # do NOT use stock ar on MinGW + find_program(AR NAMES x86_64-w64-mingw32-gcc-ar) + else() + set(AR ${CMAKE_AR}) + endif() + + if(AR) + add_custom_command( + OUTPUT ${COMBINED_CORE_LIB_NAME} + COMMAND ${AR} -crs ${COMBINED_CORE_LIB_NAME} ${CORE_LIB_TARGET_FILES} + DEPENDS ${DILIGENT_CORE_INSTALL_LIBS_LIST} + COMMENT "Combining core libraries..." + ) + add_custom_target(DiligentCore-static ALL DEPENDS ${COMBINED_CORE_LIB_NAME}) + else() + message("ar command is not found") + endif() endif() if(TARGET DiligentCore-static) @@ -300,4 +319,6 @@ if(TARGET DiligentCore-static) set_target_properties(DiligentCore-static PROPERTIES FOLDER Core ) +else() + message("Unable to find librarian tool. Combined DiligentCore static library will not be produced.") endif() |
