Skip to content

Commit

Permalink
Fix 32bit builds on 64bit platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph2 committed Mar 31, 2022
1 parent 872be36 commit c498209
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 5 additions & 8 deletions examples/xcpsim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.10)
project(xcpsim LANGUAGES C)


MESSAGE("CMAKE_HOST_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME}")
MESSAGE("CMAKE_HOST_SYSTEM_VERSION ${CMAKE_HOST_SYSTEM_VERSION}")
# MESSAGE("CMAKE_HOST_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME}")
# MESSAGE("CMAKE_HOST_SYSTEM_VERSION ${CMAKE_HOST_SYSTEM_VERSION}")
# MESSAGE("CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
Expand Down Expand Up @@ -101,8 +102,8 @@ if (CMAKE_HOST_WIN32)
elseif(CMAKE_HOST_UNIX)
add_executable(xcp_sim_eth ${SOURCES} "../../src/tl/eth/linuxeth.c" "../../src/tl/eth/common.c")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
add_compile_options("-m32")
link_libraries("-m32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
endif()
target_compile_definitions(xcp_sim_eth PUBLIC TP_ETHER)
target_include_directories(xcp_sim_eth PUBLIC ${INCLUDES})
Expand All @@ -111,10 +112,6 @@ elseif(CMAKE_HOST_UNIX)

if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "CYGWIN")
add_executable(xcp_sim_can ${SOURCES} "../../src/tl/can/linux_socket_can.c")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
add_compile_options("-m32")
link_libraries("-m32")
endif()
target_compile_definitions(xcp_sim_can PUBLIC TP_CAN)
target_include_directories(xcp_sim_can PUBLIC ${INCLUDES})
target_link_libraries(xcp_sim_can ${ADD_LIBS})
Expand Down
5 changes: 2 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ if (WIN32)
elseif(UNIX)
add_library(xcp_test SHARED ${SOURCES})
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
#set_target_properties(xcp_test PROPERTIES_COMPILE_FLAGS "-m32" PROPERTIES_LINK_FLAGS "-m32")
add_compile_options("-m32")
set(STATIC_LIBRARY_OPTIONS "-m32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
endif()
target_compile_definitions(xcp_test PUBLIC TP_ETHER)
target_include_directories(xcp_test PUBLIC ${INCLUDES})
Expand Down

0 comments on commit c498209

Please sign in to comment.