diff --git a/.github/actions/build-package/action.yaml b/.github/actions/build-package/action.yaml index a6a3901..ce84b28 100644 --- a/.github/actions/build-package/action.yaml +++ b/.github/actions/build-package/action.yaml @@ -15,6 +15,11 @@ runs: with: perl-version: '5.32' + - name: Install additional packages + if: matrix.cfg.os == 'ubuntu-20.04' + shell: bash + run: sudo apt update && sudo apt install -y g++-9 g++-9-arm-linux-gnueabi g++-9-aarch64-linux-gnu clang++-10 + - name: Install Python deps shell: bash run: | diff --git a/build.py b/build.py index dbc7213..1afeb49 100644 --- a/build.py +++ b/build.py @@ -11,10 +11,6 @@ def main(): package_name = sys.argv[1] builder = getattr(importlib.import_module(f'packages.{package_name}.build'), 'Builder')() - - tools.log("Installing build dependencies ...") - builder.install_build_dependencies() - tools.log("Installing build dependencies ... Done") if hasattr(builder, 'source'): tools.log("Sourcing build files ...") diff --git a/scripts/tools.py b/scripts/tools.py index bf8f4b9..2131d44 100644 --- a/scripts/tools.py +++ b/scripts/tools.py @@ -12,46 +12,7 @@ def log(msg): class LibraryBuilder: def __init__(self): self.triple = os.environ.get('TRIPLE') - - # All of this is only valid for ubuntu-20.04 and windows-2022 - if self.triple == "linux-x64-gcc9": - self.cc_compiler = "gcc" - self.cxx_compiler = "g++" - self.cc_compiler_package = "gcc" - self.cxx_compiler_package = "g++" - self.toolchain_file = "" - elif self.triple == "linux-x64-clang10": - self.cc_compiler = "clang" - self.cxx_compiler = "clang++" - self.cc_compiler_package = "clang" - self.cxx_compiler_package = "clang++" - self.toolchain_file = "" - elif self.triple == "linux-armv7-gcc9": - self.cc_compiler = "" - self.cxx_compiler = "" - self.cc_compiler_package = "gcc-9-arm-linux-gnueabi" - self.cxx_compiler_package = "g++-9-arm-linux-gnueabi" - self.toolchain_file = "toolchains/gcc-armv7.cmake" - elif self.triple == "linux-aarch64-gcc9": - self.cc_compiler = "" - self.cxx_compiler = "" - self.cc_compiler_package = "gcc-9-aarch64-linux-gnu" - self.cxx_compiler_package = "g++-9-aarch64-linux-gnu" - self.toolchain_file = "toolchains/gcc-aarch64.cmake" - elif self.triple == "windows-x64-mingw64": - self.cc_compiler = "cc" - self.cxx_compiler = "c++" - self.cc_compiler_package = "" - self.cxx_compiler_package = "" - self.toolchain_file = "" - elif self.triple == "windows-x64-msvc": - self.cc_compiler = "msvc" - self.cxx_compiler = "msvc" - self.cc_compiler_package = "" - self.cxx_compiler_package = "" - self.toolchain_file = "" - else: - raise LookupError(f"Triple {self.triple} is not known to the system") + self.toolchain_file = f"toolchains/{self.triple}.cmake" self.repo_dir = os.getcwd() self.working_dir = os.path.join(self.repo_dir, 'temp', self.name) @@ -107,19 +68,6 @@ def source_git_repo(self, git_repository, git_tag): self.cmd(f'git clone {git_repository} {self.source_dir} --depth=1 --single-branch --branch={git_tag}') log(f"Sourcing git repository {git_repository}:{git_tag} ... Done") - def install_build_dependencies(self, extra_unix_dependencies = []): - if platform.system() == 'Linux': - if self.cc_compiler_package != "": - extra_unix_dependencies.append(self.cc_compiler_package) - if self.cxx_compiler_package != "": - extra_unix_dependencies.append(self.cxx_compiler_package) - - deps = ' '.join(extra_unix_dependencies) - log(f"Installing extra unix dependencies ...") - if os.system(f'apt-get update && apt-get install -y {deps}') != 0: - self.cmd(f'sudo apt-get update && sudo apt-get install -y {deps}') - log(f"Installing extra unix dependencies ... Done") - def pull_of_dependency(self, package, version): depsdir = self.get_dependency_dir(package) log(f'Fetching package {package}/{version} ...') @@ -141,13 +89,7 @@ def build_generic_cmake_project(self, cmake_args_debug = [], cmake_args_release = []): - if self.toolchain_file != None and self.toolchain_file != "": - cmake_args.append(f'-DCMAKE_TOOLCHAIN_FILE={os.path.join(self.repo_dir, self.toolchain_file)}') - else: - if self.cc_compiler != 'msvc': - cmake_args.append(f'-DCMAKE_C_COMPILER={self.cc_compiler}') - cmake_args.append(f'-DCMAKE_CXX_COMPILER={self.cxx_compiler}') - + cmake_args.append(f'-DCMAKE_TOOLCHAIN_FILE={os.path.join(self.repo_dir, self.toolchain_file)}') cmake_args.append(f'-DBUILD_SHARED_LIBS=OFF') cmake_args.append(f'-DPython_ROOT_DIR={os.path.dirname(sys.executable)}') cmake_args.append(f'-DPython3_ROOT_DIR={os.path.dirname(sys.executable)}') @@ -172,7 +114,7 @@ def build_generic_cmake_project(self, args_release.append(' '.join(cmake_args_release)) cmake_build_args = [] - if self.cc_compiler != 'msvc': + if self.triple.find('msvc') == -1: cmake_build_args.append(f'-j{os.cpu_count()}') log(f'Building Debug configuration ...') diff --git a/toolchains/gcc-armv7.cmake b/toolchains/linux-aarch64-gcc9.cmake similarity index 62% rename from toolchains/gcc-armv7.cmake rename to toolchains/linux-aarch64-gcc9.cmake index 9bd4472..a760803 100644 --- a/toolchains/gcc-armv7.cmake +++ b/toolchains/linux-aarch64-gcc9.cmake @@ -1,6 +1,6 @@ set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) -set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) +set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc-9) +set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++-9) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/toolchains/linux-armv7-gcc9.cmake b/toolchains/linux-armv7-gcc9.cmake new file mode 100644 index 0000000..38a3fb9 --- /dev/null +++ b/toolchains/linux-armv7-gcc9.cmake @@ -0,0 +1,6 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-9) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++-9) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/toolchains/gcc-aarch64.cmake b/toolchains/linux-x64-clang10.cmake similarity index 63% rename from toolchains/gcc-aarch64.cmake rename to toolchains/linux-x64-clang10.cmake index b9e7d51..f076f3c 100644 --- a/toolchains/gcc-aarch64.cmake +++ b/toolchains/linux-x64-clang10.cmake @@ -1,6 +1,6 @@ set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) -set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) +set(CMAKE_C_COMPILER clang-10) +set(CMAKE_CXX_COMPILER clang++-10) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/toolchains/linux-x64-gcc9.cmake b/toolchains/linux-x64-gcc9.cmake new file mode 100644 index 0000000..d0b9952 --- /dev/null +++ b/toolchains/linux-x64-gcc9.cmake @@ -0,0 +1,6 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_C_COMPILER gcc-9) +set(CMAKE_CXX_COMPILER g++-9) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/toolchains/mingw-linux.cmake b/toolchains/mingw-linux.cmake deleted file mode 100644 index 86756fe..0000000 --- a/toolchains/mingw-linux.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set (CMAKE_SYSTEM_NAME Linux) - -# specify the cross compiler -set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) -set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) - -# where is the target environment -set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) - -# search for programs in the build host directories -set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -# for libraries and headers in the target directories -set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/toolchains/mingw-windows.cmake b/toolchains/mingw-windows.cmake deleted file mode 100644 index 29cec60..0000000 --- a/toolchains/mingw-windows.cmake +++ /dev/null @@ -1,27 +0,0 @@ -set (CMAKE_SYSTEM_NAME Windows) - -# specify the cross compiler -set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) -set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) - -# where is the target environment -set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) - -# search for programs in the build host directories -set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -# for libraries and headers in the target directories -set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -# set the resource compiler (RHBZ #652435) -set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) -set (CMAKE_MC_COMPILER x86_64-w64-mingw32-windmc) - -# override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32 -set (Boost_THREADAPI win32) - -# These are needed for compiling lapack (RHBZ #753906) -set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran) -set (CMAKE_AR:FILEPATH x86_64-w64-mingw32-ar) -set (CMAKE_RANLIB:FILEPATH x86_64-w64-mingw32-ranlib) diff --git a/toolchains/windows-x64-mingw64.cmake b/toolchains/windows-x64-mingw64.cmake new file mode 100644 index 0000000..6e0618f --- /dev/null +++ b/toolchains/windows-x64-mingw64.cmake @@ -0,0 +1,7 @@ +set (CMAKE_SYSTEM_NAME Windows) +set (CMAKE_C_COMPILER cc) +set (CMAKE_CXX_COMPILER c++) +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) \ No newline at end of file diff --git a/toolchains/windows-x64-msvc.cmake b/toolchains/windows-x64-msvc.cmake new file mode 100644 index 0000000..2f489e6 --- /dev/null +++ b/toolchains/windows-x64-msvc.cmake @@ -0,0 +1,6 @@ +set (CMAKE_SYSTEM_NAME Windows) + +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) \ No newline at end of file