-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from denismakogon/arch
Сross-compiling for macOS aarch 64, x86_64 and Linux x86_64
- Loading branch information
Showing
6 changed files
with
504 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Avoid including toolchain file several times (bad if appending to variables like | ||
# CMAKE_CXX_FLAGS. See https://github.com/android/ndk/issues/323 | ||
include_guard() | ||
|
||
MACRO(SUBDIRLIST result curdir) | ||
FILE(GLOB children ${curdir}/*) | ||
SET(dirlist "") | ||
FOREACH(child ${children}) | ||
IF(IS_DIRECTORY ${child}) | ||
LIST(APPEND dirlist ${child}) | ||
ENDIF() | ||
ENDFOREACH() | ||
SET(${result} ${dirlist}) | ||
ENDMACRO() | ||
|
||
message(STATUS "Using Conan toolchain: ${CMAKE_CURRENT_LIST_FILE}") | ||
|
||
if(${CMAKE_VERSION} VERSION_LESS "3.15") | ||
message(FATAL_ERROR "The 'CMakeToolchain' generator only works with CMake >= 3.15") | ||
endif() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
message(STATUS "Conan toolchain: C++ Standard 17 with extensions ON") | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_EXTENSIONS ON) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR aarch64) | ||
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc) | ||
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++) | ||
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
# Extra c, cxx, linkflags and defines | ||
|
||
|
||
if(DEFINED CONAN_CXX_FLAGS) | ||
string(APPEND CMAKE_CXX_FLAGS_INIT " ${CONAN_CXX_FLAGS}") | ||
endif() | ||
if(DEFINED CONAN_C_FLAGS) | ||
string(APPEND CMAKE_C_FLAGS_INIT " ${CONAN_C_FLAGS}") | ||
endif() | ||
if(DEFINED CONAN_SHARED_LINKER_FLAGS) | ||
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${CONAN_SHARED_LINKER_FLAGS}") | ||
endif() | ||
if(DEFINED CONAN_EXE_LINKER_FLAGS) | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${CONAN_EXE_LINKER_FLAGS}") | ||
endif() | ||
|
||
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) | ||
if(_CMAKE_IN_TRY_COMPILE) | ||
message(STATUS "Running toolchain IN_TRY_COMPILE") | ||
return() | ||
endif() | ||
|
||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) | ||
|
||
# Definition of CMAKE_MODULE_PATH | ||
# the generators folder (where conan generates files, like this toolchain) | ||
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
# Definition of CMAKE_PREFIX_PATH, CMAKE_XXXXX_PATH | ||
# The Conan local "generators" folder, where this toolchain is saved. | ||
list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR} ) | ||
SUBDIRLIST(SUBDIRS "$ENV{HOME}/.conan2/p/b/") | ||
FOREACH(subdir ${SUBDIRS}) | ||
list(PREPEND CMAKE_LIBRARY_PATH "${subdir}/p/lib") | ||
list(PREPEND CMAKE_INCLUDE_PATH "${subdir}/p/include") | ||
ENDFOREACH() | ||
|
||
|
||
if (DEFINED ENV{PKG_CONFIG_PATH}) | ||
set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_LIST_DIR}:$ENV{PKG_CONFIG_PATH}") | ||
else() | ||
set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_LIST_DIR}:") | ||
endif() | ||
|
||
|
||
|
||
|
||
# Variables | ||
# Variables per configuration |
Oops, something went wrong.