Skip to content

Commit

Permalink
[#5] feat(build): add static library build option
Browse files Browse the repository at this point in the history
This patch adds the `DM_BUILD_STATIC` CMake option to allow for building dmusic as a static library.
  • Loading branch information
lmichaelis committed Jul 22, 2024
1 parent c492a12 commit 86df366
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_C_STANDARD 11)

option(DM_ENABLE_ASAN "DirectMusic: Enable sanitizers in debug builds." ON)
option(DM_BUILD_EXAMPLES "DirectMusic: Build the examples." OFF)
option(DM_BUILD_STATIC "DirectMusic: Build as a static library instead of a shared one." OFF)

add_subdirectory(vendor)

Expand Down Expand Up @@ -45,7 +46,12 @@ list(APPEND _DM_SOURCE
include(support/BuildSupport.cmake)
bs_select_cflags(${DM_ENABLE_ASAN} _DM_COMPILE_FLAGS _DM_LINK_FLAGS)

add_library(dmusic SHARED)
if (${DM_BUILD_STATIC})
add_library(dmusic STATIC)
else ()
add_library(dmusic SHARED)
endif ()

target_sources(dmusic PRIVATE ${_DM_SOURCE})
target_include_directories(dmusic PUBLIC include)
target_include_directories(dmusic PRIVATE src)
Expand Down

0 comments on commit 86df366

Please sign in to comment.