Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build cores in parellel #129

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion templates/addon/depends/common/{{ game.name }}/CMakeLists.txt.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ include(ExternalProject)

string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)

# Jenkins CI jobs can have this env var set
# Use it if available
if(DEFINED ENV{BUILDTHREADS})
set(build_job_count -j$ENV{BUILDTHREADS})
message(STATUS "Using $ENV{BUILDTHREADS} threads from ENV var BUILDTHREADS")
else()
# Most likely a non CI build, so do a best attempt just using ProcessorCount
include(ProcessorCount)
ProcessorCount(cpu_count)
if(NOT cpu_count EQUAL 0)
set(build_job_count -j${cpu_count})
message(STATUS "Using ${cpu_count} threads deduced by ProcessorCount")
endif()
endif()

set(LIBRETRO_BINARY_DIR {{ config.binary_dir | default(makefile.dir) }})
set(LIBRETRO_SONAME {{ library.soname }}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(LIBRETRO_JNISONAME {{ library.jnisoname }}${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand All @@ -24,9 +39,9 @@ if(CORE_SYSTEM_NAME STREQUAL windows)
set(MSYSTEM MINGW32)
endif()
set(BUILD_COMMAND ${MINGW_MAKE}
-j$ENV{NUMBER_OF_PROCESSORS}
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
GIT_VERSION=
MSYSTEM=${MSYSTEM}
Expand All @@ -36,6 +51,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL linux)
set(BUILD_COMMAND $(MAKE)
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
GIT_VERSION=
platform=unix
Expand All @@ -49,6 +65,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL osx)
set(BUILD_COMMAND $(MAKE)
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
arch=${ARCH}
CROSS_COMPILE=1
Expand All @@ -68,6 +85,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL ios OR CORE_SYSTEM_NAME STREQUAL darwin_embedde
set(BUILD_COMMAND IOSSDK=${CMAKE_OSX_SYSROOT} $(MAKE)
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
GIT_VERSION=
platform=${PLATFORM}
Expand All @@ -77,6 +95,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL ios OR CORE_SYSTEM_NAME STREQUAL darwin_embedde
set(BUILD_COMMAND IOSSDK=${CMAKE_OSX_SYSROOT} $(MAKE)
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
GIT_VERSION=
platform=tvos-arm64
Expand All @@ -97,6 +116,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL android)
endif()
set(BUILD_COMMAND GNUMAKE=$(MAKE) ${NDKROOT}/ndk-build
-C {{ makefile.jni }}
${build_job_count}
${LIBRETRO_DEBUG}
APP_ABI=${PLATFORM}
APP_SHORT_COMMANDS=true
Expand All @@ -119,6 +139,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL android)
set(BUILD_COMMAND PATH=${TOOLCHAIN_DIR}:$ENV{PATH} $(MAKE)
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
GIT_VERSION=
platform=${PLATFORM}
Expand All @@ -130,6 +151,7 @@ elseif(CORE_SYSTEM_NAME STREQUAL freebsd)
set(BUILD_COMMAND $(MAKE)
-C {{ makefile.dir }}
-f {{ makefile.file }}
${build_job_count}
${LIBRETRO_DEBUG}
GIT_VERSION=
platform=unix
Expand Down
Loading