mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-02 04:53:19 +01:00
Extend copile support for MSVC.
- Add an option to choose between dynamic or static library version of libconfig++ - Add an option to choose linking the runtime against dynamic or static CRT library
This commit is contained in:
@@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
|
||||
|
||||
if(MSVC)
|
||||
set(LIBCONFIG_DLL OFF CACHE BOOL "Use libconfig++ DLL instead of static library")
|
||||
endif(MSVC)
|
||||
|
||||
#
|
||||
# Locate LLVM.
|
||||
#
|
||||
@@ -217,6 +221,9 @@ include_directories(
|
||||
|
||||
if(MSVC)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/vcbuild)
|
||||
if(NOT LIBCONFIG_DLL)
|
||||
add_definitions(-DLIBCONFIGXX_STATIC -DLIBCONFIG_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
|
||||
@@ -26,6 +26,9 @@ set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/d
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build as shared library or as static library")
|
||||
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "Directory where lib will be installed")
|
||||
set(D_FLAGS -g -w -d CACHE STRING "runtime build flags, separated by ;")
|
||||
if(MSVC)
|
||||
set(LINK_WITH_MSVCRT OFF CACHE BOOL "Link with MSVCRT.LIB instead of LIBCMT.LIB")
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
list(APPEND D_FLAGS -relocation-model=pic)
|
||||
@@ -387,10 +390,19 @@ endmacro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix)
|
||||
if(PHOBOS2_DIR)
|
||||
add_custom_target(phobos2)
|
||||
endif(PHOBOS2_DIR)
|
||||
build_runtime("" "" "${LD_FLAGS}" "" "${LIB_SUFFIX}")
|
||||
if(MSVC)
|
||||
if (LINK_WITH_MSVCRT)
|
||||
set(RT_CFLAGS "/MDd")
|
||||
else()
|
||||
set(RT_CFLAGS "/MTd")
|
||||
endif()
|
||||
else()
|
||||
set(RT_CFLAGS "")
|
||||
endif()
|
||||
build_runtime("" "${RT_CLAGS}" "${LD_FLAGS}" "" "${LIB_SUFFIX}")
|
||||
set(GENERATE_DI "")
|
||||
if(MULTILIB)
|
||||
build_runtime("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "" "${MULTILIB_SUFFIX}")
|
||||
build_runtime("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${RT_CFLAGS}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "" "${MULTILIB_SUFFIX}")
|
||||
endif(MULTILIB)
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user