how to build a optix project on linux of CentOS 6.x

I have built the optix projects in windows platform with Visual Studio 2010, it is really convinient when compiling the optix projects. But now ,my teacher asked me to develop the optix projects in linux platform. Linux is new to me, so I don’t know how to build a optix project within linux. I have tried to solve it with CodeBlocks, but I failed.
I followed the tutorials from the internet to add the nvcc compiler to CodeBlocks, it works will for cuda projects, but when turning to optix, it failed. The main problem is CodeBlocks can’t generate .ptx file. I dont know how to configure it.
Is there someone know how to solve the problem? no matter you use CodeBlocks or not, I just want to know the efficent way of building the optix objects. Thank you very much, it has confused for a few days.

You should definitely have a look at CMake and how the SDK examples are built using it. Using this setup will allow you to compile on either Windows or Linux without much configuration effort.

Thank you very much m_sch!
Perhaps you are right, but have never compile projects with cmake, it seems a little difficult to me. Also my project is not too complicated to use cmake. I think I can edit Makefile directly, it is not too difficult, because I have learnt how to edit Makefile for gcc compiler.
I prefer IDE like visual studio 2010, it is possible to get IDE like vs2010 in linux platform to compile optix?

CMake has a gui version and also a terminal-gui-like one (ccmake) on linux. It’s not too difficult to use it, you basically just tell him where are the sources, where do you want the project files to be generated and then 1) Configure the project 2) Generate the project files (makefiles on linux, .sln solution files on Windows and something else I don’t know on Mac)

Thank you, marknv.
I have learnt how to write CMakeLists.txt for cmake, and I have successed in compiling C project, but I still don’t know how to deal with a optix project. I tried to read the CMakeLists.txt files in Optix_SDK file, but it is too complicated for me to understand. Would you please give me a easy example of how to write CMakeLists.txt for optix projects.
Take the sample1 for example please, now I copy sample1.c and draw_color.cu to my workplace, what’s the CMakeLists.txt like?

You don’t have to use CMake at all costs, you can simply compile your CUDA C files with your RT_PROGRAMs into PTX files and feed them to OptiX.

To generate PTX files from CUDA C ones: http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#supported-phases. Remember to add OptiX include directories and CUDA toolkit ones (plus anything else you want to use).

Thank you very much marknv!
I have made it.

I will post a separate topic on this issue, but just wanted to note here for people following the general theme of using OptiX on Centos that the Cmake as distributed with Centos is 2.6 and OptiX 3.5.1 requires 2.8. However the downloaded Cmake 2.8 does not compile and install correctly. It would be nice if Optix were not so fundamentally dependent on non-standard 3rd party applications that have to be the very latest version. Next time, try “make”, it works very well.