2014-03-02 20:51:42 +00:00
|
|
|
|
2020-09-10 21:23:14 +00:00
|
|
|
if(DEFINED ENV{_ROSBE_ROSSCRIPTDIR})
|
|
|
|
set(CMAKE_SYSROOT $ENV{_ROSBE_ROSSCRIPTDIR}/$ENV{ROS_ARCH})
|
2014-03-02 20:51:42 +00:00
|
|
|
endif()
|
|
|
|
|
2021-04-15 01:50:12 +00:00
|
|
|
# pass variables necessary for the toolchain (needed for try_compile)
|
|
|
|
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH CLANG_VERSION)
|
|
|
|
|
2014-03-02 20:51:42 +00:00
|
|
|
# The name of the target operating system
|
|
|
|
set(CMAKE_SYSTEM_NAME Windows)
|
2020-09-10 21:23:14 +00:00
|
|
|
# The processor we are targeting
|
|
|
|
if (ARCH STREQUAL "i386")
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
|
|
|
elseif (ARCH STREQUAL "amd64")
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
|
|
|
elseif(ARCH STREQUAL "arm")
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
|
|
|
else()
|
2021-04-15 01:50:12 +00:00
|
|
|
message(FATAL_ERROR "Unsupported ARCH: ${ARCH}")
|
2020-09-10 21:23:14 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (DEFINED CLANG_VERSION)
|
|
|
|
set(CLANG_SUFFIX "-${CLANG_VERSION}")
|
|
|
|
else()
|
|
|
|
set(CLANG_SUFFIX "")
|
|
|
|
endif()
|
2014-03-02 20:51:42 +00:00
|
|
|
|
|
|
|
# Which tools to use
|
2020-09-10 21:23:14 +00:00
|
|
|
set(triplet ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32)
|
|
|
|
if (CMAKE_HOST_WIN32)
|
|
|
|
set(GCC_TOOLCHAIN_PREFIX "")
|
|
|
|
else()
|
|
|
|
set(GCC_TOOLCHAIN_PREFIX "${triplet}-")
|
2014-03-02 20:51:42 +00:00
|
|
|
endif()
|
2014-09-07 12:33:13 +00:00
|
|
|
|
2020-09-10 21:23:14 +00:00
|
|
|
set(CMAKE_C_COMPILER clang${CLANG_SUFFIX})
|
|
|
|
set(CMAKE_C_COMPILER_TARGET ${triplet})
|
|
|
|
set(CMAKE_CXX_COMPILER clang++${CLANG_SUFFIX})
|
|
|
|
set(CMAKE_CXX_COMPILER_TARGET ${triplet})
|
|
|
|
set(CMAKE_ASM_COMPILER ${GCC_TOOLCHAIN_PREFIX}gcc)
|
|
|
|
set(CMAKE_ASM_COMPILER_ID GNU)
|
|
|
|
set(CMAKE_MC_COMPILER ${GCC_TOOLCHAIN_PREFIX}windmc)
|
|
|
|
set(CMAKE_RC_COMPILER ${GCC_TOOLCHAIN_PREFIX}windres)
|
|
|
|
# set(CMAKE_AR ${triplet}-ar)
|
|
|
|
# set(CMAKE_DLLTOOL ${triplet}-dlltool)
|
|
|
|
|
|
|
|
# This allows to have CMake test the compiler without linking
|
|
|
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
|
|
|
|
|
|
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
|
2014-03-02 20:51:42 +00:00
|
|
|
set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
|
|
|
set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
|
|
|
|
2014-09-10 15:56:48 +00:00
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
|
2014-03-02 20:51:42 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries")
|
|
|
|
|
2021-04-09 08:32:12 +00:00
|
|
|
find_program (LD_EXECUTABLE ${GCC_TOOLCHAIN_PREFIX}ld)
|
|
|
|
message(STATUS "Using linker ${LD_EXECUTABLE}")
|
2021-04-06 17:23:31 +00:00
|
|
|
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
|
2020-06-14 11:49:22 +00:00
|
|
|
|
|
|
|
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-gcc.cmake")
|