Fix builing of clad and related test on Windows

This commit is contained in:
Bertrand Bellenot 2018-08-09 13:31:53 +02:00 committed by sftnight
parent bba0c4b9e0
commit 5b55c52bda

View File

@ -13,31 +13,59 @@ set(CLADDIFFERENTIATOR_LIB
${_clad_byproduct_binary_dir}/tools/${CMAKE_STATIC_LIBRARY_PREFIX}cladPlugin${CMAKE_STATIC_LIBRARY_SUFFIX}
)
ExternalProject_Add(
clad
GIT_REPOSITORY https://github.com/vgvassilev/clad.git
GIT_TAG v0.2
UPDATE_COMMAND ""
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=${CLING_PLUGIN_INSTALL_PREFIX}
-DCLAD_PATH_TO_LLVM_BUILD=${LLVM_DIR}
-DCLAD_BUILD_STATIC_ONLY=ON
BUILD_BYPRODUCTS ${CLADDIFFERENTIATOR_LIB}
# Wrap download, configure and build steps in a script to log output
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
# We need the target clangBasic to be built before building clad. However, we
# support building prebuilt clang and adding clangBasic breaks this case.
# Delegate the dependency resolution to the clingInterpreter target (which
# will always depend on clangBasic).
DEPENDS clingInterpreter
if(MSVC)
if (winrtdebug)
set(_clad_build_type Debug)
else()
set(_clad_build_type Release)
endif()
ExternalProject_Add(
clad
GIT_REPOSITORY https://github.com/vgvassilev/clad.git
GIT_TAG v0.2
UPDATE_COMMAND ""
CMAKE_ARGS -G ${CMAKE_GENERATOR} -DCLAD_BUILD_STATIC_ONLY=ON
-DCMAKE_INSTALL_PREFIX=${CLING_PLUGIN_INSTALL_PREFIX}
-DCLAD_PATH_TO_LLVM_BUILD=${LLVM_DIR}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${_clad_build_type}
# Wrap download, configure and build steps in a script to log output
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
# We need the target clangBasic to be built before building clad. However, we
# support building prebuilt clang and adding clangBasic breaks this case.
# Delegate the dependency resolution to the clingInterpreter target (which
# will always depend on clangBasic).
DEPENDS clingInterpreter
)
else()
set(_clad_build_type ${CMAKE_CFG_INTDIR})
ExternalProject_Add(
clad
GIT_REPOSITORY https://github.com/vgvassilev/clad.git
GIT_TAG v0.2
UPDATE_COMMAND ""
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=${CLING_PLUGIN_INSTALL_PREFIX}
-DCLAD_PATH_TO_LLVM_BUILD=${LLVM_DIR}
-DCLAD_BUILD_STATIC_ONLY=ON
BUILD_BYPRODUCTS ${CLADDIFFERENTIATOR_LIB}
# Wrap download, configure and build steps in a script to log output
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
# We need the target clangBasic to be built before building clad. However, we
# support building prebuilt clang and adding clangBasic breaks this case.
# Delegate the dependency resolution to the clingInterpreter target (which
# will always depend on clangBasic).
DEPENDS clingInterpreter
)
endif()
# Specify include dirs for clad
ExternalProject_Get_Property(clad source_dir)
@ -52,5 +80,5 @@ foreach (lib cladPlugin cladDifferentiator)
add_library(${lib} IMPORTED STATIC GLOBAL)
add_dependencies(${lib} clad)
endforeach()
set_property(TARGET cladPlugin PROPERTY IMPORTED_LOCATION ${_CLAD_LIBRARY_PATH}/tools/${CMAKE_STATIC_LIBRARY_PREFIX}cladPlugin${CMAKE_STATIC_LIBRARY_SUFFIX})
set_property(TARGET cladDifferentiator PROPERTY IMPORTED_LOCATION ${_CLAD_LIBRARY_PATH}/lib/Differentiator/${CMAKE_STATIC_LIBRARY_PREFIX}cladDifferentiator${CMAKE_STATIC_LIBRARY_SUFFIX})
set_property(TARGET cladPlugin PROPERTY IMPORTED_LOCATION ${_CLAD_LIBRARY_PATH}/tools/${_clad_build_type}/${CMAKE_STATIC_LIBRARY_PREFIX}cladPlugin${CMAKE_STATIC_LIBRARY_SUFFIX})
set_property(TARGET cladDifferentiator PROPERTY IMPORTED_LOCATION ${_CLAD_LIBRARY_PATH}/lib/Differentiator/${_clad_build_type}/${CMAKE_STATIC_LIBRARY_PREFIX}cladDifferentiator${CMAKE_STATIC_LIBRARY_SUFFIX})