aboutsummaryrefslogtreecommitdiff
path: root/third-party/cmake/BuildMsgpack.cmake
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2015-12-20 04:50:20 +0000
committerRui Abreu Ferreira <raf-ep@gmx.com>2016-08-07 21:57:28 +0100
commitdb7fdcd0bab8d5333bc89ab90ff256fcbdccde96 (patch)
tree341c6a8ca774164bc65dbbea720d293378d09f03 /third-party/cmake/BuildMsgpack.cmake
parentf53c8258bed7354678e5e355efa2acc471deb11a (diff)
downloadrneovim-db7fdcd0bab8d5333bc89ab90ff256fcbdccde96.tar.gz
rneovim-db7fdcd0bab8d5333bc89ab90ff256fcbdccde96.tar.bz2
rneovim-db7fdcd0bab8d5333bc89ab90ff256fcbdccde96.zip
MSVC: Build third-party dependencies as release DLLs
Using /MT was causing issues when building luarocks, revert it, use the dynammic runtime and generate release DLLs for the dependencies. Some refactoring was required because for linking cmake looks for the import libraries (.lib) but on runtime executables we need the .dll files to be in the same folder. The DLLs are placed in the bin/ folder in order for nvim.exe to run during the build and tests. The install target installs the DLLs with the nvim binary - uses GetPrerequisites to find runtime DLLs. Some minor issues that required adjustments: - [MSVC] FindMsgpack.cmake now looks for msgpack_import.lib instead of msgpack.lib - The lua-client fails to find libuv.lib, instead it looks for uv.lib, added second copy of the file to the install command. - [MSVC] CMAKE_BUILD_TYPE affects the output paths, default to Release. Part of these changes are credited to @jasonwilliams200OK who fixed the third-party recipes to consistently use the same build type.
Diffstat (limited to 'third-party/cmake/BuildMsgpack.cmake')
-rw-r--r--third-party/cmake/BuildMsgpack.cmake15
1 files changed, 9 insertions, 6 deletions
diff --git a/third-party/cmake/BuildMsgpack.cmake b/third-party/cmake/BuildMsgpack.cmake
index 4b6b361e85..211a2f72aa 100644
--- a/third-party/cmake/BuildMsgpack.cmake
+++ b/third-party/cmake/BuildMsgpack.cmake
@@ -37,10 +37,11 @@ set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
-DMSGPACK_BUILD_TESTS=OFF
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1} -fPIC")
-set(MSGPACK_BUILD_COMMAND ${CMAKE_COMMAND} --build .)
-set(MSGPACK_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install)
+set(MSGPACK_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE})
+set(MSGPACK_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
if(MINGW AND CMAKE_CROSSCOMPILING)
get_filename_component(TOOLCHAIN ${CMAKE_TOOLCHAIN_FILE} REALPATH)
@@ -50,6 +51,7 @@ if(MINGW AND CMAKE_CROSSCOMPILING)
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
# Pass toolchain
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
# Hack to avoid -rdynamic in Mingw
-DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="")
elseif(MSVC)
@@ -60,12 +62,13 @@ elseif(MSVC)
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1}"
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
# Make sure we use the same generator, otherwise we may
# accidentaly end up using different MSVC runtimes
- -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
- # Use static runtime
- -DCMAKE_C_FLAGS_DEBUG="-MTd"
- -DCMAKE_C_FLAGS_RELEASE="-MT")
+ -DCMAKE_GENERATOR=${CMAKE_GENERATOR})
+ # Place the DLL in the bin folder
+ set(MSGPACK_INSTALL_COMMAND ${MSGPACK_INSTALL_COMMAND}
+ COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_INSTALL_DIR}/lib/msgpack.dll ${DEPS_INSTALL_DIR}/bin)
endif()
BuildMsgpack(CONFIGURE_COMMAND ${MSGPACK_CONFIGURE_COMMAND}