[Libclc-dev] [PATCH 1/1] cmake: Install libraries to DATADIR from GNUInstallDirs

Tom Stellard via Libclc-dev libclc-dev at lists.llvm.org
Mon Jan 7 09:37:51 PST 2019


On 12/22/2018 12:49 AM, Jan Vesely wrote:
> On Mon, 2018-12-17 at 10:22 -0800, Tom Stellard via Libclc-dev wrote:
>> On 12/06/2018 02:40 PM, Jan Vesely via Libclc-dev wrote:
>>> This moves default installation location of device libraries to /usr/share.
>>> Note that libclc.pc was already installed to /usr/share.
>>> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
>>> ---
>>> I was not sure if this should use LIBDIR or DATADIR, but in the end the
>>> libraries are independent of CPU architecture and it can be easily
>>> overridden.
>>> I don't have a strong preference, let me know if LIBDIR looks better to
>>> you.
>>>
>>
>> There was a bug filed by one of the OS packages to put the libs in DATADIR,
>> which is why it was done that way.  The rationale was that the contents
>> are the same on all arches, so it is really an architecture independent
>> package, so it doesn't belong in LIBDIR.
> 
> thanks. that's what this patch does for cmake, does it look ok to you?
> 

LGTM, thanks.


> the defaults in configure.py are libclc.pc to $PREFIX/share/pkgconfig
> and *.bc to $PREFIX/lib/clc which was a bit confusing.
> 
> Jan
>>
>> -Tom
>>> Jan
>>>
>>>  CMakeLists.txt | 11 ++++++-----
>>>  libclc.pc.in   |  4 ++--
>>>  2 files changed, 8 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/CMakeLists.txt b/CMakeLists.txt
>>> index 41bd5f6..440eab0 100644
>>> --- a/CMakeLists.txt
>>> +++ b/CMakeLists.txt
>>> @@ -1,6 +1,7 @@
>>>  cmake_minimum_required( VERSION 3.9.2 )
>>>  
>>>  project( libclc VERSION 0.2.0 LANGUAGES CXX )
>>> +include( GNUInstallDirs )
>>>  
>>>  # List of all targets
>>>  set( LIBCLC_TARGETS_ALL
>>> @@ -145,8 +146,8 @@ endif()
>>>  
>>>  # pkg-config file
>>>  configure_file( libclc.pc.in libclc.pc @ONLY )
>>> -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION share/pkgconfig )
>>> -install( DIRECTORY generic/include/clc DESTINATION include )
>>> +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig )
>>> +install( DIRECTORY generic/include/clc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
>>>  
>>>  if( ENABLE_RUNTIME_SUBNORMAL )
>>>  	add_library( subnormal_use_default STATIC
>>> @@ -154,7 +155,7 @@ if( ENABLE_RUNTIME_SUBNORMAL )
>>>  	add_library( subnormal_disable STATIC
>>>  		generic/lib/subnormal_disable.ll )
>>>  	install( TARGETS subnormal_use_default subnormal_disable ARCHIVE
>>> -		DESTINATION lib/clc )
>>> +		DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
>>>  endif()
>>>  
>>>  find_program( PYTHON python )
>>> @@ -274,7 +275,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
>>>  				            prepare_builtins )
>>>  		add_custom_target( "prepare-${obj_suffix}" ALL
>>>  		                   DEPENDS "${obj_suffix}" )
>>> -		install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION lib/clc )
>>> +		install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
>>>  		# nvptx-- targets don't include workitem builtins
>>>  		if( NOT ${t} MATCHES ".*ptx.*--$" )
>>>  			add_test( NAME external-calls-${obj_suffix}
>>> @@ -292,7 +293,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
>>>  					   create_symlink ${obj_suffix}
>>>  					   ${alias_suffix}
>>>  			                   DEPENDS "prepare-${obj_suffix}" )
>>> -			install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION lib/clc )
>>> +			install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
>>>  		endforeach( a )
>>>  	endforeach( d )
>>>  endforeach( t )
>>> diff --git a/libclc.pc.in b/libclc.pc.in
>>> index 82e4e94..b6e06c9 100644
>>> --- a/libclc.pc.in
>>> +++ b/libclc.pc.in
>>> @@ -1,5 +1,5 @@
>>> -includedir=@CMAKE_INSTALL_PREFIX@/include
>>> -libexecdir=@CMAKE_INSTALL_PREFIX@/lib/clc
>>> +includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
>>> +libexecdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/clc
>>>  
>>>  Name: libclc
>>>  Description: Library requirements of the OpenCL C programming language
>>>
>>
>> _______________________________________________
>> Libclc-dev mailing list
>> Libclc-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev
> 



More information about the Libclc-dev mailing list