Skip to content

Commit 1bc74fc

Browse files
committed
Add Linux X86 32 bits build files.
1 parent 0687fa6 commit 1bc74fc

File tree

9 files changed

+130
-26
lines changed

9 files changed

+130
-26
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,33 @@ jobs:
170170
with:
171171
name: viponTools_Ubuntu
172172
path: viponTools.tar.gz
173+
ubuntu-2404-32-gmake-release:
174+
runs-on: ubuntu-24.04
175+
steps:
176+
- name: Checkout
177+
uses: actions/checkout@v6
178+
- name: Set Env Variables
179+
uses: ./.github/actions/set_env_var
180+
with:
181+
shell: bash
182+
path: ${HOME}/.local/bin
183+
cpath: ${HOME}/.local/include:${CPATH}
184+
library_path: ${HOME}/.local/lib:${LIBRARY_PATH}
185+
- run: ./setup.sh
186+
- name: Configure Gmake Release
187+
run: ./configure --gmake --release --target-platform=i386-linux-gnu --output i386_release
188+
- name: Gmake Build Test Install
189+
uses: ./.github/actions/gmake_build_test_install
190+
with:
191+
shell: bash
192+
working-directory: i386_release
193+
- name: Make Achive
194+
working-directory: i386_release
195+
run: tar -czvf ../viponTools.tar.gz viponTools
196+
- uses: actions/upload-artifact@v4
197+
with:
198+
name: viponTools_Ubuntu_i386
199+
path: viponTools.tar.gz
173200
windows-ninja-debug-static:
174201
runs-on: windows-2025-vs2026
175202
steps:

cTools/libs/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ add_subdirectory(binParse)
3131
add_subdirectory(binPrinter)
3232
add_subdirectory(binDynMod)
3333
if (NOT APPLE)
34-
add_subdirectory(perfAnalysis)
34+
add_subdirectory(perfAnalysis)
3535
endif (NOT APPLE)
3636
add_subdirectory(test)
37-
add_subdirectory(x86_64)
38-
add_subdirectory(arch)
39-
add_subdirectory(mod)
37+
if (NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
38+
# !TODO: Need to solve problem with capstone and keystone 32 bits build
39+
add_subdirectory(x86_64)
40+
add_subdirectory(arch)
41+
add_subdirectory(mod)
42+
endif()
4043

cmake/toolchain/ccache.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ include_guard(GLOBAL)
2424

2525
find_program(CCACHE ccache)
2626
if(NOT CCACHE)
27-
message(SEND_ERROR "ccache not found")
27+
message(STATUS "ccache not found")
2828
else()
2929
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache")
3030
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache")

cmake/toolchain/cflags/cflags.cmake

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2021-2024 Konychev Valerii
3+
# Copyright (c) 2021-2026 Konychev Valerii
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -59,17 +59,8 @@ set(CMAKE_CXX_FLAGS ${CXX_FLAGS})
5959
set(CMAKE_CXX_FLAGS_DEBUG ${CXX_FLAGS_DEBUG})
6060
set(CMAKE_CXX_FLAGS_RELEASE ${CXX_FLAGS_RELEASE})
6161

62-
if (APPLE)
63-
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
64-
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
65-
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 17.0)
66-
# Main MacOsX linker has problem with linking MOD_CODE macro
67-
string(APPEND _LINKER_FLAGS " -ld_classic")
68-
endif ()
69-
endif ()
70-
endif ()
71-
endif (APPLE)
7262

63+
include(${CMAKE_CURRENT_LIST_DIR}/linker.cmake)
7364
if (NOT "${_LINKER_FLAGS}" STREQUAL "")
7465
string(REPLACE " " ";" LINKER_FLAGS "${_LINKER_FLAGS}")
7566
add_link_options(${LINKER_FLAGS})

cmake/toolchain/cflags/common.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2021 Konychev Valerii
3+
# Copyright (c) 2021-2026 Konychev Valerii
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -28,3 +28,12 @@ else()
2828
append_cxxflags(CXX_FLAGS -fPIC -std=gnu++20 -fcxx-exceptions -fexceptions)
2929
endif()
3030

31+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
32+
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
33+
# extra flags if need to compile and link 32-bits application
34+
set(CMAKE_REQUIRED_LINK_OPTIONS -m32 -Wl-m,elf_i386)
35+
append_cflags(C_FLAGS "-m32 -mfpmath=sse -msse2")
36+
append_cxxflags(CXX_FLAGS "-m32 -mfpmath=sse -msse2")
37+
unset(CMAKE_REQUIRED_LINK_OPTIONS)
38+
endif()
39+
endif()
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2026 Konychev Valerii
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
if (APPLE)
24+
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
25+
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
26+
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 17.0)
27+
# Main MacOsX linker has problem with linking MOD_CODE macro
28+
string(APPEND _LINKER_FLAGS " -ld_classic")
29+
endif ()
30+
endif ()
31+
endif ()
32+
endif (APPLE)
33+
34+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
35+
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
36+
string(APPEND _LINKER_FLAGS " -Wl,-m,elf_i386")
37+
endif()
38+
endif()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2026 Konychev Valerii
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
include_guard(GLOBAL)
24+
25+
set(CMAKE_SYSTEM_NAME Linux)
26+
set(CMAKE_SYSTEM_PROCESSOR i386)
27+
include(${CMAKE_CURRENT_LIST_DIR}/host-clang.cmake)

configure

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ def parseArgs():
6969
help = 'use xcode build system')
7070
parser.add_argument('--use-version', metavar = 'VERSION', nargs = '?',
7171
default = None,
72-
help = 'specify build system version'
73-
)
72+
help = 'specify build system version')
73+
parser.add_argument('--target-platform', metavar = 'TRIPLET', nargs = '?',
74+
default = 'host-system',
75+
help = 'parameter for cross platform build. Supported values: '
76+
'host-system, i386-linux-gnu')
7477

7578
return parser.parse_args()
7679

77-
7880
def finalizeArgs(args):
7981
if args.output != OUTPUT_DIR:
8082
if args.install_dir == INSTALL_DIR:
@@ -94,7 +96,6 @@ def finalizeArgs(args):
9496
if args.use_version == None:
9597
args.use_version = '18'
9698

97-
9899
def goToOutputDir(args):
99100
if not os.path.isdir(args.output):
100101
try:
@@ -104,7 +105,6 @@ def goToOutputDir(args):
104105

105106
os.chdir(args.output)
106107

107-
108108
def execCmake(args):
109109
generator = str()
110110
if args.gmake:
@@ -132,22 +132,28 @@ def execCmake(args):
132132

133133
com += [ '-DCMAKE_BUILD_TYPE={}' .format('Release' if args.release else 'Debug')
134134
, '-DVIPON_TOOLS_LIB_TYPE={}'.format('STATIC' if args.static else 'SHARED')
135-
, '-DCMAKE_TOOLCHAIN_FILE={}'.format(args.c_toolchain)
136-
, '-DCMAKE_INSTALL_PREFIX={}'.format(args.install_dir)
135+
]
136+
137+
if args.target_platform != 'host-system':
138+
path_to_toolchain = os.path.join(TOOLCHAIN_DIR,
139+
f'{args.target_platform}.cmake')
140+
com += [ f'-DCMAKE_TOOLCHAIN_FILE={path_to_toolchain}' ]
141+
else:
142+
com += ['-DCMAKE_TOOLCHAIN_FILE={}'.format(args.c_toolchain) ]
143+
144+
com += [ '-DCMAKE_INSTALL_PREFIX={}'.format(args.install_dir)
137145
, '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
138146
, ROOT
139147
]
140148

141149
execCmd(com)
142150

143-
144151
def main():
145152
args = parseArgs()
146153
finalizeArgs(args)
147154
goToOutputDir(args)
148155
execCmake(args)
149156

150-
151157
if __name__ == '__main__':
152158
main()
153159

python/vpy/installArgs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def installArgs(descr: str):
4646
parser.add_argument('--default', action = 'store_true',
4747
default = False,
4848
help = 'if flag is set, produce default install: brew, apt etc.')
49+
parser.add_argument('--plaform', metavar = 'TRIPLET', nargs = '?',
50+
default = 'host',
51+
help = 'specify target system triplet')
4952

5053
return parser.parse_args()
5154

0 commit comments

Comments
 (0)