Acerebral
Acerebral

Reputation: 265

Eclipse C++: Setting Compiler Options For Specific Files

I have a CUDA C++ project I am writing and compiling using Eclipse Nsight. My goal is to end up with an executable from the file that contains the main function, then to produce an individual shared library for each class in the project without needing to compile outside of the IDE. I can do this by creating a project for each class, then including all of them in the main project, but I would like a way to write all the files in a single Eclipse project and still end up with the desired artifacts. The project structure is as follows:

ClassA.h
ClassA.cu
ClassB.h
ClassB.cu
main.cpp

I am looking to compile the project and end up with the following artifacts:

ClassA.so
ClassB.so
main.exe

Ideally, I would like to know if there is a way to group specific files and set the compiler options for just that group of files. i.e.

nvcc ClassA.cu -shared -fPIC -o ClassA.so
nvcc ClassB.cu -shared -fPIC -o ClassB.so
g++  main.cpp -lClassA.so -lClassB.so -o main.exe

I know this is an unusual request, but this is part of a larger project architecture I am trying to bring from the land of emacs and compile shell scripts into the world of IDEs.

Upvotes: 0

Views: 596

Answers (1)

Eugene
Eugene

Reputation: 9474

Option A: Write and maintain a custom make file.

Option B: Create 3 projects - exe and two shared libraries.

Upvotes: 2

Related Questions