src/platform/cmake/devkitPro.cmake (view raw)
1if(DEFINED ENV{DEVKITPRO})
2 set(DEVKITPRO $ENV{DEVKITPRO})
3else()
4 message(FATAL_ERROR "Could not find DEVKITPRO in environment")
5endif()
6
7set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
8
9function(create_devkit DEVKIT)
10 if(DEFINED ENV{DEVKIT${DEVKIT}})
11 set(DEVKIT${DEVKIT} $ENV{DEVKIT${DEVKIT}} PARENT_SCOPE)
12 else()
13 set(DEVKIT${DEVKIT} ${DEVKITPRO}/devkit${DEVKIT} PARENT_SCOPE)
14 endif()
15
16 set(CMAKE_PROGRAM_PATH ${DEVKIT${DEVKIT}}/bin CACHE INTERNAL "program path")
17
18 set(extension)
19 if (CMAKE_HOST_WIN32)
20 set(extension .exe)
21 endif()
22
23 find_program(CMAKE_AR ${cross_prefix}gcc-ar${extension})
24 find_program(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension})
25 find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
26 find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension})
27 find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension})
28 find_program(CMAKE_LINKER ${cross_prefix}ld${extension})
29 set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
30 set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags")
31 set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
32
33 set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
34 set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
35 set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags")
36
37 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
38 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
39 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
40 set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
41endfunction()