Skip to content

Commit 9c85420

Browse files
committed
Allow forcing 32 bit builds on 64 bit platforms
1 parent 6078bbd commit 9c85420

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ else()
2828
set(_lua_module_dir "${_lua_lib_dir}/lua/5.1")
2929
endif()
3030

31+
option(Build32Bit "Build 32-bit Library" OFF)
32+
3133
set(CMAKE_C_FLAGS "-O2 -g -ggdb -Wall -pedantic -std=c99")
3234
add_library(cmsgpack MODULE lua_cmsgpack.c)
3335
set_target_properties(cmsgpack PROPERTIES PREFIX "")
36+
37+
if(Build32Bit)
38+
set_target_properties(cmsgpack
39+
PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
40+
endif()
41+
3442
target_link_libraries(cmsgpack ${_MODULE_LINK})
3543
install(TARGETS cmsgpack DESTINATION "${_lua_module_dir}")
3644

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ Build and test:
8383
make
8484
lua ../test.lua
8585

86+
You can build a 32-bit module on a 64-bit platform with:
87+
88+
mkdir build; cd build
89+
cmake -DBuild32Bit=ON ..
90+
make
91+
lua ../test.lua
92+
8693
NESTED TABLES
8794
---
8895
Nested tables are handled correctly up to `LUACMSGPACK_MAX_NESTING` levels of

0 commit comments

Comments
 (0)