Commit 1d87b51a authored by Joe Snyder's avatar Joe Snyder
Browse files

Add option for adding DEFINE flag

Add a CMake option to toggle a -D flag to the CMAKE_CXX_FLAGS.
Prove that it goes into CastXML and changes the definition of the
"summer" function.
parent 040dcaae
......@@ -9,15 +9,20 @@ if (GENERATE_WRAPPING)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
find_program(CastXML_EXECUTABLE NAMES castxml)
message(\"${CMAKE_CXX_FLAGS_DEBUG}\")
option(DEFINE_TEST_PARAM "Adds a define parameter to swap definitions of the 'summer' function" OFF)
if (DEFINE_TEST_PARAM)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-DTESTFLAG")
endif()
message(\"${CMAKE_CXX_FLAGS}\")
execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/generator.py "-s" ${CMAKE_CURRENT_SOURCE_DIR}
"-g" ${CastXML_EXECUTABLE}
"-cf" \"${CMAKE_CXX_FLAGS_DEBUG}\"
"-cf" \"${CMAKE_CXX_FLAGS}\"
"-o" ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE generator_return)
execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/generator.py "-s" ${CMAKE_CURRENT_SOURCE_DIR}
"-g" ${CastXML_EXECUTABLE}
"-cf" \"${CMAKE_CXX_FLAGS_DEBUG}\"
"-cf" \"${CMAKE_CXX_FLAGS}\"
"-o" ${CMAKE_CURRENT_SOURCE_DIR}
-n
OUTPUT_VARIABLE generator_return OUTPUT_STRIP_TRAILING_WHITESPACE)
......
......@@ -37,8 +37,16 @@ float test<T>::adder(float t1, int t2)
return t1 + t2;
};
template <typename T>
float test<T>::summer(float t1, int t2, int t3)
{
return t1+ t2 + t3;
};
\ No newline at end of file
#ifdef TESTFLAG
template <typename T>
float test<T>::summer(float t1, int t2, int t3)
{
return t1+ t2 + t3;
};
#else
template <typename T>
float test<T>::summer(float t1, int t2)
{
return t1+ t2;
};
#endif
\ No newline at end of file
......@@ -28,7 +28,11 @@ class test
test(const T& val1, float val2);
float adder(float t1, float t2);
float adder(float t1, int t2 = 0);
static float summer(float t1, int t2 = 0, int t3 = 14);
#ifdef TESTFLAG
static float summer(float t1, int t2 = 0, int t3 = 14);
#else
static float summer(float t1, int t2 = 0);
#endif
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment