mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-15 04:13:14 +01:00
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
This commit is contained in:
@@ -40,6 +40,8 @@ execute_process(
|
||||
)
|
||||
|
||||
set(D_VERSION 1 CACHE STRING "D language version")
|
||||
set(PROGRAM_PREFIX CACHE STRING "prepended to ldc binary name")
|
||||
set(PROGRAM_SUFFIX CACHE STRING "appended to ldc binary name")
|
||||
option(USE_BOEHM_GC "use the Boehm garbage collector internally")
|
||||
option(GENERATE_OFFTI "generate complete ClassInfo.offTi arrays")
|
||||
|
||||
@@ -137,6 +139,7 @@ add_definitions(
|
||||
|
||||
if(UNIX)
|
||||
add_definitions(-DPOSIX)
|
||||
set(CONF_INST_DIR etc)
|
||||
endif(UNIX)
|
||||
|
||||
if(USE_BOEHM_GC)
|
||||
@@ -157,8 +160,11 @@ endif(CMAKE_MINOR_VERSION LESS 6)
|
||||
|
||||
add_executable(${LDC_EXE} ${LDC_SOURCE_FILES})
|
||||
|
||||
set(LDC_EXE_NAME ${PROGRAM_PREFIX}${LDC_EXE}${PROGRAM_SUFFIX})
|
||||
|
||||
set_target_properties(
|
||||
${LDC_EXE} PROPERTIES
|
||||
OUTPUT_NAME ${LDC_EXE_NAME}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
|
||||
COMPILE_FLAGS "${LLVM_CXXFLAGS} -Wno-deprecated -Wno-write-strings"
|
||||
)
|
||||
@@ -167,6 +173,7 @@ set_target_properties(
|
||||
target_link_libraries(${LDC_EXE} "${LLVM_LDFLAGS} ${LLVM_LIBS}")
|
||||
if(WIN32)
|
||||
target_link_libraries(${LDC_EXE} psapi)
|
||||
set(CONF_INST_DIR bin)
|
||||
endif(WIN32)
|
||||
|
||||
if(USE_BOEHM_GC)
|
||||
@@ -175,7 +182,10 @@ endif(USE_BOEHM_GC)
|
||||
|
||||
get_target_property(LDC_LOC ${LDC_EXE} LOCATION)
|
||||
|
||||
# TODO: install target
|
||||
# TODO: testrun
|
||||
|
||||
add_subdirectory(runtime EXCLUDE_FROM_ALL)
|
||||
install(TARGETS ${LDC_EXE} DESTINATION bin)
|
||||
|
||||
install(FILES ${PROJECT_BINARY_DIR}/bin/${LDC_EXE_NAME}.conf DESTINATION ${CONF_INST_DIR})
|
||||
|
||||
add_subdirectory(runtime)
|
||||
|
||||
@@ -28,7 +28,6 @@ get_directory_property(PROJECT_PARENT_DIR DIRECTORY ${PROJECT_SOURCE_DIR} PARENT
|
||||
set(RUNTIME_DIR ${PROJECT_PARENT_DIR}/${RUNTIME} CACHE PATH "runtime source dir" FORCE)
|
||||
|
||||
if(D_VERSION EQUAL 1)
|
||||
set(LDC_EXE ldc)
|
||||
# copy imports to runtime dir
|
||||
add_custom_command(
|
||||
OUTPUT ldc-imports
|
||||
@@ -48,7 +47,6 @@ if(D_VERSION EQUAL 1)
|
||||
file(GLOB CORE_D ${RUNTIME_DIR}/lib/common/tango/core/*.d)
|
||||
file(GLOB CORE_C ${RUNTIME_DIR}/lib/common/tango/stdc/*.c)
|
||||
elseif(D_VERSION EQUAL 2)
|
||||
set(LDC_EXE ldc2)
|
||||
set(RUNTIME_CC druntime-core)
|
||||
set(RUNTIME_GC druntime-gc-basic)
|
||||
set(RUNTIME_DC druntime-rt-ldc)
|
||||
@@ -73,9 +71,10 @@ if(NOT LDC_LOC)
|
||||
if(NOT LDC_LOC)
|
||||
message(SEND_ERROR "ldc not found")
|
||||
endif(NOT LDC_LOC)
|
||||
set(LDC_EXE_NAME ${LDC_EXE})
|
||||
endif(NOT LDC_LOC)
|
||||
|
||||
configure_file(${PROJECT_PARENT_DIR}/${LDC_EXE}.conf.in ${PROJECT_BINARY_DIR}/../bin/${LDC_EXE}.conf)
|
||||
configure_file(${PROJECT_PARENT_DIR}/${LDC_EXE}.conf.in ${PROJECT_BINARY_DIR}/../bin/${LDC_EXE_NAME}.conf)
|
||||
|
||||
# patch runtime source, uses LDC_EXE for ldc / ldc2
|
||||
find_program(PATCH_EXE patch DOC "path to patch tool")
|
||||
@@ -178,3 +177,5 @@ set_target_properties(
|
||||
|
||||
# BCLIBS is empty if BUILD_BC_LIBS is not selected
|
||||
add_custom_target(runtime DEPENDS ${LIBS} ${BCLIBS})
|
||||
|
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/../lib DESTINATION .)
|
||||
Reference in New Issue
Block a user