build(cross): macOS cross compilation
macos cross compilation now works. macos binaries can be compiled on linux with osxcross installed and built
This commit is contained in:
@@ -30,4 +30,4 @@ liblogging = fourdst_sp.get_variable('liblogging')
|
||||
|
||||
if not get_option('unity-safe')
|
||||
libplugin = fourdst_sp.get_variable('libplugin')
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
cmake = import('cmake')
|
||||
|
||||
subdir('fourdst')
|
||||
|
||||
subdir('python')
|
||||
subdir('fourdst')
|
||||
subdir('sundials')
|
||||
|
||||
subdir('cppad')
|
||||
|
||||
16
build-config/python/meson.build
Normal file
16
build-config/python/meson.build
Normal file
@@ -0,0 +1,16 @@
|
||||
py_installation = import('python').find_installation('python3', pure: false)
|
||||
|
||||
|
||||
if meson.is_cross_build() and host_machine.system() == 'darwin'
|
||||
py_ver = get_option('python-target-version')
|
||||
message('Cross build on Darwin, using python version ' + py_ver)
|
||||
py_inc_dir = include_directories('../../cross/python_includes/python-' + py_ver + '/include/python' + py_ver)
|
||||
py_dep = declare_dependency(include_directories: py_inc_dir)
|
||||
py_module_prefix = ''
|
||||
py_module_suffic = 'so'
|
||||
meson.override_dependency('python3', py_dep)
|
||||
else
|
||||
py_dep = py_installation.dependency()
|
||||
py_module_prefix = ''
|
||||
py_module_suffic = 'so'
|
||||
endif
|
||||
@@ -6,9 +6,8 @@ cvode_cmake_options.add_cmake_defines({
|
||||
'CMAKE_C_FLAGS' : '-Wno-deprecated-declarations',
|
||||
'BUILD_SHARED_LIBS' : 'OFF',
|
||||
'BUILD_STATIC_LIBS' : 'ON',
|
||||
'CMAKE_BUILD_WITH_INSTALL_RPATH': 'ON',
|
||||
'EXAMPLES_ENABLE_C': 'OFF',
|
||||
'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'
|
||||
'CMAKE_POSITION_INDEPENDENT_CODE': true
|
||||
|
||||
})
|
||||
|
||||
@@ -22,29 +21,56 @@ cvode_sp = cmake.subproject(
|
||||
options: cvode_cmake_options,
|
||||
)
|
||||
|
||||
# For the core SUNDIALS library (SUNContext, etc.)
|
||||
sundials_core_dep = cvode_sp.dependency('sundials_core_static')
|
||||
sundials_core_tgt = cvode_sp.target('sundials_core_static')
|
||||
sundials_cvode_tgt = cvode_sp.target('sundials_cvode_static')
|
||||
sundials_nvecserial_tgt = cvode_sp.target('sundials_nvecserial_static')
|
||||
sundials_sunmatrixdense_tgt = cvode_sp.target('sundials_sunmatrixdense_static')
|
||||
sundials_sunlinsoldense_tgt = cvode_sp.target('sundials_sunlinsoldense_static')
|
||||
|
||||
# For the CVODE integrator library
|
||||
sundials_cvode_dep = cvode_sp.dependency('sundials_cvode_static')
|
||||
cvode_objs = [
|
||||
sundials_core_tgt.extract_all_objects(recursive: true),
|
||||
sundials_cvode_tgt.extract_all_objects(recursive: true),
|
||||
sundials_nvecserial_tgt.extract_all_objects(recursive: true),
|
||||
sundials_sunmatrixdense_tgt.extract_all_objects(recursive: true),
|
||||
sundials_sunlinsoldense_tgt.extract_all_objects(recursive: true),
|
||||
]
|
||||
|
||||
# For the serial NVector library
|
||||
sundials_nvecserial_dep = cvode_sp.dependency('sundials_nvecserial_static')
|
||||
sundials_core_includes = cvode_sp.include_directories('sundials_core_static')
|
||||
sundials_cvode_includes = cvode_sp.include_directories('sundials_cvode_static')
|
||||
sundials_nvecserial_includes = cvode_sp.include_directories('sundials_nvecserial_static')
|
||||
sundials_sunmatrixdense_includes = cvode_sp.include_directories('sundials_sunmatrixdense_static')
|
||||
sundials_sunlinsoldense_includes = cvode_sp.include_directories('sundials_sunlinsoldense_static')
|
||||
|
||||
# For the dense matrix library
|
||||
sundials_sunmatrixdense_dep = cvode_sp.dependency('sundials_sunmatrixdense_static')
|
||||
cvode_includes = [
|
||||
sundials_core_includes,
|
||||
sundials_cvode_includes,
|
||||
sundials_nvecserial_includes,
|
||||
sundials_sunmatrixdense_includes,
|
||||
sundials_sunlinsoldense_includes
|
||||
]
|
||||
|
||||
# For the dense linear solver library
|
||||
sundials_sunlinsoldense_dep = cvode_sp.dependency('sundials_sunlinsoldense_static')
|
||||
|
||||
cvode_dep = declare_dependency(
|
||||
dependencies: [
|
||||
sundials_core_dep,
|
||||
sundials_cvode_dep,
|
||||
sundials_nvecserial_dep,
|
||||
sundials_sunmatrixdense_dep,
|
||||
sundials_sunlinsoldense_dep,
|
||||
],
|
||||
empty_cvode_file = configure_file(
|
||||
output: 'cvode_dummy_ar.cpp',
|
||||
command: ['echo'],
|
||||
capture: true
|
||||
)
|
||||
|
||||
|
||||
|
||||
libcvode_static = static_library(
|
||||
'cvode-static',
|
||||
empty_cvode_file,
|
||||
objects: cvode_objs,
|
||||
include_directories: cvode_includes,
|
||||
pic: true,
|
||||
install: false
|
||||
)
|
||||
|
||||
|
||||
cvode_dep = declare_dependency(
|
||||
link_with: libcvode_static,
|
||||
include_directories: cvode_includes,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@ kinsol_cmake_options.add_cmake_defines({
|
||||
'CMAKE_C_FLAGS' : '-Wno-deprecated-declarations',
|
||||
'BUILD_SHARED_LIBS' : 'OFF',
|
||||
'BUILD_STATIC_LIBS' : 'ON',
|
||||
'CMAKE_BUILD_WITH_INSTALL_RPATH': 'ON',
|
||||
'EXAMPLES_ENABLE_C' : 'OFF',
|
||||
'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'
|
||||
'CMAKE_POSITION_INDEPENDENT_CODE': true
|
||||
})
|
||||
|
||||
kinsol_cmake_options.add_cmake_defines({
|
||||
@@ -22,11 +21,31 @@ kinsol_sp = cmake.subproject(
|
||||
options: kinsol_cmake_options,
|
||||
)
|
||||
|
||||
sundials_kinsol_shared = kinsol_sp.dependency('sundials_kinsol_static')
|
||||
sundials_kinsol_static_tgt = kinsol_sp.target('sundials_kinsol_obj_static')
|
||||
kinsol_includes = kinsol_sp.include_directories('sundials_kinsol_obj_static')
|
||||
|
||||
kinsol_dep = declare_dependency(
|
||||
dependencies: [
|
||||
sundials_kinsol_shared,
|
||||
]
|
||||
kinsol_objs = [sundials_kinsol_static_tgt.extract_all_objects(recursive: false)]
|
||||
|
||||
empty_kinsol_file = configure_file(
|
||||
output: 'kinsol_dummy_ar.cpp',
|
||||
command: ['echo'],
|
||||
capture: true
|
||||
)
|
||||
|
||||
|
||||
libkinsol_static = static_library(
|
||||
'kinsol_static',
|
||||
empty_kinsol_file,
|
||||
objects: kinsol_objs,
|
||||
include_directories: kinsol_includes,
|
||||
pic: true,
|
||||
install: false
|
||||
)
|
||||
|
||||
|
||||
kinsol_dep = declare_dependency(
|
||||
link_with: libkinsol_static,
|
||||
include_directories: kinsol_includes
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@ sundials_dep = declare_dependency(
|
||||
cvode_dep,
|
||||
kinsol_dep,
|
||||
],
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user