Skip to content
Snippets Groups Projects
Commit 98426e8f authored by NAKAMURA Takumi's avatar NAKAMURA Takumi
Browse files

[CMake][VS][XCode] Restruct the output directory layout more comfortable,...

[CMake][VS][XCode] Restruct the output directory layout more comfortable, ${BINARY_DIR}/${BUILD_MODE}/(bin|lib)

We have been seeing nasty directory layout with CMake multiconfig, such as,
  bin/Release/clang.exe
  lib/clang/3.x/...
  lib/Release/clang/3.x/.. (duplicated)

Move the layout similar to autoconf's;
  Release/bin/clang.exe
  Release/lib/clang/3.x/...

Checked on Visual Studio 10. Could you guys please confirm my change on XCode(and other multiconfig builders)?

Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, or a certain builder, for eaxample, msbuild.exe, would be confused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198205 91177308-0d34-0410-b5e6-96231b3b80d8
parent 9b94cd40
No related branches found
No related tags found
No related merge requests found
...@@ -174,8 +174,8 @@ set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING ...@@ -174,8 +174,8 @@ set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CLANG_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}) set(CLANG_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}) set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE ) if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite " message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
...@@ -306,6 +306,7 @@ macro(add_clang_library name) ...@@ -306,6 +306,7 @@ macro(add_clang_library name)
endif() endif()
add_library( ${name} ${libkind} ${srcs} ) add_library( ${name} ${libkind} ${srcs} )
add_dead_strip( ${name} ) add_dead_strip( ${name} )
set_output_directory(${name} ${CLANG_RUNTIME_OUTPUT_INTDIR} ${CLANG_LIBRARY_OUTPUT_INTDIR})
if( LLVM_COMMON_DEPENDS ) if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS ) endif( LLVM_COMMON_DEPENDS )
......
...@@ -47,14 +47,7 @@ set(files ...@@ -47,14 +47,7 @@ set(files
module.map module.map
) )
set(output_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/clang/${CLANG_VERSION}/include) set(output_dir ${CLANG_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
# If we are in an IDE that has a configuration directory, we need to
# create a second copy of the headers so that 'clang' can find them if
# it's run from the build directory.
if(MSVC_IDE OR XCODE)
set(other_output_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib/clang/${CLANG_VERSION}/include)
endif()
# Generate arm_neon.h # Generate arm_neon.h
clang_tablegen(arm_neon.h -gen-arm-neon clang_tablegen(arm_neon.h -gen-arm-neon
...@@ -69,15 +62,6 @@ foreach( f ${files} ) ...@@ -69,15 +62,6 @@ foreach( f ${files} )
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
COMMENT "Copying clang's ${f}...") COMMENT "Copying clang's ${f}...")
list(APPEND out_files ${dst}) list(APPEND out_files ${dst})
if(other_output_dir)
set(other_dst ${other_output_dir}/${f})
add_custom_command(OUTPUT ${other_dst}
DEPENDS ${src}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${other_dst}
COMMENT "Copying clang's ${f}...")
list(APPEND out_files ${other_dst})
endif()
endforeach( f ) endforeach( f )
add_custom_command(OUTPUT ${output_dir}/arm_neon.h add_custom_command(OUTPUT ${output_dir}/arm_neon.h
...@@ -86,26 +70,9 @@ add_custom_command(OUTPUT ${output_dir}/arm_neon.h ...@@ -86,26 +70,9 @@ add_custom_command(OUTPUT ${output_dir}/arm_neon.h
COMMENT "Copying clang's arm_neon.h...") COMMENT "Copying clang's arm_neon.h...")
list(APPEND out_files ${output_dir}/arm_neon.h) list(APPEND out_files ${output_dir}/arm_neon.h)
if (other_output_dir)
set(other_dst ${other_output_dir}/arm_neon.h)
add_custom_command(OUTPUT ${other_dst}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h ${other_dst}
COMMENT "Copying clang's arm_neon.h...")
list(APPEND out_files ${other_dst})
endif ()
add_custom_target(clang-headers ALL DEPENDS ${out_files}) add_custom_target(clang-headers ALL DEPENDS ${out_files})
set_target_properties(clang-headers PROPERTIES FOLDER "Misc") set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
if (other_output_dir)
if(UNIX)
add_custom_command(TARGET clang-headers POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib/clang" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/clang")
endif()
endif ()
install( install(
FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment