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

Allow building libmgba with threads disabled #2065

Closed
wants to merge 1 commit into from
Closed
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
21 changes: 18 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ if(NOT LIBMGBA_ONLY)
set(BUILD_GLES3 OFF CACHE BOOL "Build with OpenGL|ES 3")
set(USE_EPOXY ON CACHE STRING "Build with libepoxy")
set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies")
set(DISABLE_THREADS OFF CACHE BOOL "Build without threads")
mark_as_advanced(DISABLE_THREADS)
set(DISTBUILD OFF CACHE BOOL "Build distribution packages")
if(WIN32)
set(WIN32_UNIX_PATHS OFF CACHE BOOL "Use Unix-like paths")
Expand All @@ -82,8 +84,15 @@ if(NOT LIBMGBA_ONLY)
else()
set(DISABLE_FRONTENDS ON)
set(DISABLE_DEPS ON)
set(BUILD_STATIC ON)
set(BUILD_SHARED OFF)
if(NOT DEFINED DISABLE_THREADS)
set(DISABLE_THREADS OFF)
endif()
if(NOT DEFINED BUILD_STATIC)
set(BUILD_STATIC ON)
endif()
if(NOT DEFINED BUILD_SHARED)
set(BUILD_SHARED OFF)
endif()
if(NOT DEFINED M_CORE_GBA)
set(M_CORE_GBA ON)
endif()
Expand All @@ -92,6 +101,10 @@ else()
endif()
endif()

if(DISABLE_THREADS)
add_definitions(-DDISABLE_THREADING)
endif()

file(GLOB THIRD_PARTY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/inih/*.c)
set(CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-mem.c ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fifo.c)
set(VFS_SRC)
Expand Down Expand Up @@ -200,7 +213,9 @@ if(WIN32)
file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/*.c)
source_group("Windows-specific code" FILES ${OS_SRC})
elseif(UNIX)
set(USE_PTHREADS ON)
if(NOT DISABLE_THREADS)
set(USE_PTHREADS ON)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_definitions(-D_GNU_SOURCE)
Expand Down