[CMake] Problem making vc project

Nima Nouri nouri.f.nima at gmail.com
Thu Jul 28 01:47:13 EDT 2011


Hi
I cannot make a small stand alone example, it is a big project.
however I have checked the cmakelists. I am sending you the part that is
responsible for making the cuda file lists.


On Thu, Jul 28, 2011 at 8:03 AM, Yuri Timenkov <yuri at timenkov.ru> wrote:

> The original CMakeLists will be helpful to solve your problem. Could you
> provide a small stand-alone example reproducing your problem?
>
> On Wed, Jul 27, 2011 at 8:02 PM, Nima Nouri <nouri.f.nima at gmail.com>wrote:
>
>> Hi everybody
>>
>> I am currently trying to compile my source code on VC9.
>> Previously I was using VC8 and every thing was fine but now cmake does
>> make everything like before but only a vcproject file.
>> I have attached both files in a rar archive to this mail, the one made for
>> VC8 is larger 250KB and the one made for VC9 is the smaller 70KB.
>>
>> if you comparison the files (of course with a comparison utility like the
>> ones notepad++ have) you will find that all cuda source files are not added
>> to the build list on the VC9 file.
>> Does any one has any idea about whats causing this? and How i can fix it?
>>
>> I should add that the settings of the cmake files for both VC8 and VC9 are
>> set using the cmake internal parameters MSVC80 and MSVC90 and the
>> configurations are the same. for example
>>
>> if (MSVC80)
>> -The block of command
>> endif (MSVC80)
>>
>> if (MSVC90)
>> -The same block of command
>> endif (MSVC90)
>>
>> --
>>  Best Regards
>> N.Nouri
>>
>> Ph.D Student
>> Department of Mechanical Engineering
>> Isfahan University of Technology
>> Isfahan, Iran
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
>


-- 
Best Regards
N.Nouri

Ph.D Student
Department of Mechanical Engineering
Isfahan University of Technology
Isfahan, Iran

gpiutmd.iut.ac.ir
gpiutmd.webs.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110728/89f660b9/attachment.htm>
-------------- next part --------------
## $Id: CMakeLists.txt 2710 2010-02-08 15:44:07Z Nima $
## $URL: $
# Maintainer: Nima

#################
macro(add_libGPIUTMD_source_dir dir)
add_subdirectory(${dir})

# find all source files in this directory
file(GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.cc)
file(GLOB CU_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.cu)
file(GLOB HDRS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*.cuh)

# add them to the source group
source_group(${dir} FILES ${CU_SRCS} ${SRCS} ${HDRS})

# add them to the main libGPIUTMD list
list(APPEND _libGPIUTMD_sources ${SRCS} ${HDRS})
list(APPEND _libGPIUTMD_cu_sources ${CU_SRCS})
endmacro(add_libGPIUTMD_source_dir)
#################

set(_libGPIUTMD_sources "")
set(_libGPIUTMD_cu_sources "")

# process all subdirectories, which add source files to _libGPIUTMD_sources and _libGPIUTMD_cu_sources
set(_dir_list analyzers computes data_structures extern potentials python system updaters utils)
if (ENABLE_CUDA)
list(APPEND _dir_list computes_gpu cuda updaters_gpu)
endif (ENABLE_CUDA)

foreach (dir ${_dir_list})
add_libGPIUTMD_source_dir(${dir})
endforeach (dir)

if (ENABLE_CUDA)
if (BUILD_SHARED_LIBS)
set (_libGPIUTMD_shared SHARED)
endif (BUILD_SHARED_LIBS)
CUDA_COMPILE(_CUDA_GENERATED_FILES ${_libGPIUTMD_cu_sources} OPTIONS ${CUDA_ADDITIONAL_OPTIONS} ${_libGPIUTMD_shared})
source_group(cuda_generated FILES ${_CUDA_GENERATED_FILES})
endif (ENABLE_CUDA)

add_library (libGPIUTMD ${_libGPIUTMD_sources} ${_CUDA_GENERATED_FILES})

##################################
# change the name of the library if it is dynamic
if (NOT ENABLE_STATIC)
    # link the library to its dependancies
    target_link_libraries(libGPIUTMD ${GPIUTMD_COMMON_LIBS})

    # tweak the properties of the output to make a functional python module
    set_target_properties(libGPIUTMD PROPERTIES PREFIX "" OUTPUT_NAME "GPIUTMD")

    # .dylib is not regognized as a python module by python on Mac OS X
    if(APPLE)
        set_target_properties(libGPIUTMD PROPERTIES SUFFIX ".so")
    endif(APPLE)
    fix_cudart_rpath(libGPIUTMD)

    # set the rpath so that the lib can find other libs stashed in lib/GPIUTMD
    #set_target_properties(libGPIUTMD PROPERTIES INSTALL_RPATH "\\\$ORIGIN/../../GPIUTMD")
    if (ENABLE_EMBED_CUDA)
        set_target_properties(libGPIUTMD PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
    endif (ENABLE_EMBED_CUDA)
    
    # for non-app-bundle relocatable installs, set the install name of the lib for linking relative to bin/
    if (NOT ENABLE_APP_BUNDLE_INSTALL)
    set_target_properties(libGPIUTMD PROPERTIES INSTALL_NAME_DIR "@executable_path/../lib/GPIUTMD/python-module")
    endif (NOT ENABLE_APP_BUNDLE_INSTALL)
endif (NOT ENABLE_STATIC)

if (ENABLE_STATIC)
    # change the library name to something more sensible
    if (WIN32)
        set_target_properties(libGPIUTMD PROPERTIES OUTPUT_NAME "libGPIUTMD")
    else(WIN32)
        set_target_properties(libGPIUTMD PROPERTIES OUTPUT_NAME "GPIUTMD")
    endif(WIN32)
endif (ENABLE_STATIC)

# due to the way that app bundle installs work with relative linking, GPIUTMD.so must be installed into the bin dir, ugh!
if (ENABLE_APP_BUNDLE_INSTALL)
set(_GPIUTMD_so_install_dir ${BIN_INSTALL_DIR})
else (ENABLE_APP_BUNDLE_INSTALL)
set(_GPIUTMD_so_install_dir ${GPIUTMD_PYTHON_MODULE_DIR})
endif(ENABLE_APP_BUNDLE_INSTALL)

# install the library
install(TARGETS libGPIUTMD
        LIBRARY DESTINATION ${_GPIUTMD_so_install_dir}
        ARCHIVE DESTINATION ${LIB_BASE_INSTALL_DIR}
        )

add_subdirectory(api)



More information about the CMake mailing list