diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-04-24 21:12:10 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-04-24 21:17:18 +0200 |
| commit | ef0a4fdf9b85692e03a0f13ac4439c37a8b6d4aa (patch) | |
| tree | 51b13bf42083d5a66748cdd2cf8b0ae06ad01264 | |
| parent | d1e03c7453f4f168c6f0bb567427b0e5f049ba26 (diff) | |
Build static on Linux.
| -rw-r--r-- | Makefile | 14 | ||||
| -rw-r--r-- | blockdev/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | cscript | 2 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 2 |
4 files changed, 21 insertions, 5 deletions
@@ -19,19 +19,29 @@ COMMON_DEFINITIONS = \ -DVERSION_MINOR=$(VERSION_MINOR) \ -DVERSION_PATCH=$(VERSION_PATCH) \ -DVERSION=$(VERSION) \ - -DLWEXT4_BUILD_SHARED_LIB=ON \ define generate_common rm -R -f build_$(1) mkdir build_$(1) cd build_$(1) && cmake -G"Unix Makefiles" \ $(COMMON_DEFINITIONS) \ + -DLWEXT4_BUILD_SHARED_LIB=ON \ + $(2) \ + -DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake .. +endef + +define generate_common_static + rm -R -f build_$(1) + mkdir build_$(1) + cd build_$(1) && cmake -G"Unix Makefiles" \ + $(COMMON_DEFINITIONS) \ + -DLWEXT4_BUILD_SHARED_LIB=OFF \ $(2) \ -DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake .. endef generic: - $(call generate_common,$@) + $(call generate_common_static,$@) osx: $(call generate_common,$@) diff --git a/blockdev/CMakeLists.txt b/blockdev/CMakeLists.txt index e79cbb4..e45f134 100644 --- a/blockdev/CMakeLists.txt +++ b/blockdev/CMakeLists.txt @@ -9,5 +9,11 @@ else() endif() aux_source_directory(. BLOCKDEV_SRC) -add_library(blockdev SHARED ${BLOCKDEV_SRC}) + +if(LWEXT4_BUILD_SHARED_LIB) + add_library(blockdev SHARED ${BLOCKDEV_SRC}) +else() + add_library(blockdev STATIC ${BLOCKDEV_SRC}) +endif() + @@ -21,7 +21,7 @@ def build(target, options): if target.platform == 'linux': type = 'generic' blockdev = 'linux' - ext = 'so' + ext = 'a' device = 'dev' elif target.platform == 'osx': if target.bits == 64: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b82fcf..527664a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,4 +19,4 @@ endif() if (DEFINED INSTALL_LIB) INSTALL(TARGETS lwext4 DESTINATION /usr/local/lib) INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/include/. DESTINATION /usr/local/include/lwext4) -endif()
\ No newline at end of file +endif() |
