Passing custom build/link flags to cmake

586 views
Skip to first unread message

Andrew Henderson

unread,
Apr 15, 2015, 12:18:32 PM4/15/15
to dynamor...@googlegroups.com
Hello all. I've been working on getting DynamoRIO to build for 32-bit ARM-based Android platforms. I've tried a few different cross-compile toolchains and took the Android NDK ndk-build system through its paces. ndk-build doesn't give me enough control over the compile flags, though, so I used the Android NDK toolchain (and I tried one of the Linaro ARM cross compilers, too) with regular makefiles to get DynamoRIO building with the abbreviated/missing headers included in the Android NDK. Now, I am integrating that back into the original cmake build system.

I am passing a custom toolchain file into cmake and using the Unix Makefiles generator. In my toolchain file, I specify a variety of flags for cmake to use:

SET(MAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID -mhard-float -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a8 -fsigned-char --sysroot=${CMAKE_FIND_ROOT_PATH} -Wl,--fix-cortex-a8" CACHE STRING "" FORCE)

My problem is that these standard defines are wiped clean in cmake/DynamoRIOConfig.cmake. I really don't want to hack on DynamoRIOConfig.cmake to add in the additional Android logic if I can help it. Is there a "back door" set of variables that is already there that I can use to pass my custom CMAKE_C_FLAGS and CMAKE_EXE_LINKER_FLAGS info into the final CMAKE_*_FLAGS variables that cmake uses to construct the make files?

Andrew

  

Derek Bruening

unread,
Apr 15, 2015, 6:45:51 PM4/15/15
to dynamor...@googlegroups.com
For building DR itself, today there is not any explicit support for specifying compiler or linker flags externally.  The default flags from CMake gave us a lot of trouble in the past for our unusual build needs and we ended up finding that clearing them was safest.  Preprocessor defines are expected to be in configure.h in general, not passed on the command line.  Something like the target float flags makes sense to be parametrized, but today there is no option for that (never needed for x86).

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To post to this group, send email to dynamor...@googlegroups.com.
Visit this group at http://groups.google.com/group/dynamorio-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages