1 2if(NOT ARCH) 3 set(ARCH i386) 4endif() 5 6if(DEFINED ENV{_ROSBE_ROSSCRIPTDIR}) 7 set(CMAKE_SYSROOT $ENV{_ROSBE_ROSSCRIPTDIR}/$ENV{ROS_ARCH}) 8endif() 9 10# The name of the target operating system 11set(CMAKE_SYSTEM_NAME Windows) 12# The processor we are targeting 13if (ARCH STREQUAL "i386") 14 set(CMAKE_SYSTEM_PROCESSOR i686) 15elseif (ARCH STREQUAL "amd64") 16 set(CMAKE_SYSTEM_PROCESSOR x86_64) 17elseif(ARCH STREQUAL "arm") 18 set(CMAKE_SYSTEM_PROCESSOR arm) 19else() 20 message(ERROR "Unsupported ARCH: ${ARCH}") 21endif() 22 23if (DEFINED CLANG_VERSION) 24 set(CLANG_SUFFIX "-${CLANG_VERSION}") 25else() 26 set(CLANG_SUFFIX "") 27endif() 28 29# Which tools to use 30set(triplet ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) 31if (CMAKE_HOST_WIN32) 32 set(GCC_TOOLCHAIN_PREFIX "") 33else() 34 set(GCC_TOOLCHAIN_PREFIX "${triplet}-") 35endif() 36 37set(CMAKE_C_COMPILER clang${CLANG_SUFFIX}) 38set(CMAKE_C_COMPILER_TARGET ${triplet}) 39set(CMAKE_CXX_COMPILER clang++${CLANG_SUFFIX}) 40set(CMAKE_CXX_COMPILER_TARGET ${triplet}) 41set(CMAKE_ASM_COMPILER ${GCC_TOOLCHAIN_PREFIX}gcc) 42set(CMAKE_ASM_COMPILER_ID GNU) 43set(CMAKE_MC_COMPILER ${GCC_TOOLCHAIN_PREFIX}windmc) 44set(CMAKE_RC_COMPILER ${GCC_TOOLCHAIN_PREFIX}windres) 45# set(CMAKE_AR ${triplet}-ar) 46# set(CMAKE_DLLTOOL ${triplet}-dlltool) 47 48# This allows to have CMake test the compiler without linking 49set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 50 51set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>") 52set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) 53set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) 54 55set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries") 56set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries") 57 58set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${CMAKE_SYSROOT}/bin/${triplet}-ld") 59set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${CMAKE_SYSROOT}/bin/${triplet}-ld") 60if (DEFINED CMAKE_SYSROOT) 61 set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib -fuse-ld=${CMAKE_SYSROOT}/bin/${GCC_TOOLCHAIN_PREFIX}ld") 62else() 63 set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib -fuse-ld=${GCC_TOOLCHAIN_PREFIX}ld") 64endif() 65