Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-06 Thread Weixiong Zheng
Oh! I see. After your post, I went back to macro_deal_ii_add_test.cmake and did find quotes around the ${CMAKE_CURRENT_SOURCE_DIR}. So I added the quotes in the definition and realized I can get rid of using BOOST_PP_STRINGIZE. Thanks! 在 2018年2月6日星期二 UTC-8上午10:01:01,Wolfgang Bangerth写道: > > On

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-06 Thread Wolfgang Bangerth
On 02/06/2018 10:28 AM, Weixiong Zheng wrote: > #define SOURCE_DIR /Users/GrillCheese/UCB/Research/xtrans/tests/mesh Thanks sir, I got confused a bit. So you meant even with quotes around it, the macro in *.cc code will still not be interpreted as a string? What I'm saying is that a

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-06 Thread Weixiong Zheng
在 2018年2月6日星期二 UTC-8上午8:33:43,Wolfgang Bangerth写道: > > On 02/05/2018 11:37 PM, Weixiong Zheng wrote: > > > > What I've tried is to > > ADD_DEFINITION(-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}) in the > > CMakeLists.txt in the test directory. I tried tesing SOURCE_DIR in *.cc > > file like: st

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-06 Thread Weixiong Zheng
Thanks, sir. I'd try that. Weixiong 在 2018年2月6日星期二 UTC-8上午8:33:43,Wolfgang Bangerth写道: > > On 02/05/2018 11:37 PM, Weixiong Zheng wrote: > > > > What I've tried is to > > ADD_DEFINITION(-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}) in the > > CMakeLists.txt in the test directory. I tried tesing

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-06 Thread Wolfgang Bangerth
On 02/05/2018 11:37 PM, Weixiong Zheng wrote: What I've tried is to ADD_DEFINITION(-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}) in the CMakeLists.txt in the test directory. I tried tesing SOURCE_DIR in *.cc file like: std::cout << SOURCE_DIR << std::endl; When I did "make", screen printout sho

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-05 Thread Weixiong Zheng
A might-be-sloppy resolution I came out is to use boost to transform SOURCE_DIR macro to string, which is #include ... void test () { ... std::string string_from_macro = BOOST_PP_STRINGIZE(SOURCE_DIR); ... } It worked, but as what I said, in a sloppy way. I'd be happy to see what you guys

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-05 Thread Weixiong Zheng
Thanks Matthias, What I've tried is to ADD_DEFINITION(-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}) in the CMakeLists.txt in the test directory. I tried tesing SOURCE_DIR in *.cc file like: std::cout << SOURCE_DIR << std::endl; When I did "make", screen printout shows: ":2:20: note: expanded from

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-05 Thread Weixiong Zheng
在 2018年2月5日星期一 UTC-8下午8:55:19,Wolfgang Bangerth写道: > > On 02/05/2018 09:15 PM, Weixiong Zheng wrote: > > > > I am trying to get unit test work for my project. It works until > reaching the > > point of reading input data. I tried to specify the directory using > getcwd() > > though it didn'

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-05 Thread Matthias Maier
On Mon, Feb 5, 2018, at 22:15 CST, Weixiong Zheng wrote: > Hello All, > > I am trying to get unit test work for my project. It works until reaching > the point of reading input data. I tried to specify the directory using > getcwd() though it didn't work with ctest. I noticed there was anothe

Re: [deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-05 Thread Wolfgang Bangerth
On 02/05/2018 09:15 PM, Weixiong Zheng wrote: I am trying to get unit test work for my project. It works until reaching the point of reading input data. I tried to specify the directory using getcwd() though it didn't work with ctest. I noticed there was another user having the same issue and

[deal.II] SOURCE_DIR for input data reading in user project unit testing

2018-02-05 Thread Weixiong Zheng
Hello All, I am trying to get unit test work for my project. It works until reaching the point of reading input data. I tried to specify the directory using getcwd() though it didn't work with ctest. I noticed there was another user having the same issue and the resolution was to use SOURCE_DIR