From 83e325ab3cc25a0d5ab02837c6d6cce0973e48e6 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Sat, 21 May 2022 20:16:26 +0100 Subject: [PATCH] Fix CMake 32bit issues --- CMakeLists.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7162f9e..13ca114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,14 +21,12 @@ set(CMAKE_C_STANDARD 99) include_directories(include) if(NOT PLATFORM_DREAMCAST) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(FIND_LIBRARY_USE_LIB32_PATHS true) set(FIND_LIBRARY_USE_LIB64_PATHS false) endif() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 --fast-math -fexpensive-optimizations -funroll-all-loops") -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -Wall -Wextra") set( SOURCES @@ -78,6 +76,14 @@ else() endif() add_library(GLdc STATIC ${SOURCES}) + +if(NOT PLATFORM_DREAMCAST) +set_target_properties(GLdc PROPERTIES + COMPILE_OPTIONS "-m32" + LINK_OPTIONS "-m32" +) +endif() + link_libraries(m) include_directories(include) @@ -116,6 +122,11 @@ function(gen_sample sample) else() message("No such romdisk for sample: ${sample} at 'samples/${sample}/romdisk'") endif() + else() + set_target_properties(${sample} PROPERTIES + COMPILE_OPTIONS "-m32" + LINK_OPTIONS "-m32" + ) endif() endfunction()