Skip to content

Commit

Permalink
[FIX] : fix x64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Nov 23, 2023
1 parent 1b226de commit 93c56f6
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ option(USE_PROFILER_TRACY "Enale Tracy Profiler" OFF)
option(USE_NETWORK "Enable NETWORK (Shader Inport, Versions, Changelog)" ON)
option(USE_STD_FILESYSTEM "Enable std::filesystem use for path and ImGuiFileDialog" ON)
option(USE_PACKAGE_TO_NSIS "Enable packaging to nsis isntaller or zip if false" ON)
option(BUILD_X32 "Enable the 32 bit version of NoodlesPlate (default is X64)" OFF)

if (WIN32)
# MACOS : VR is not supported
Expand Down Expand Up @@ -113,7 +114,7 @@ if(UNIX)
add_definitions(-DUNIX)
add_definitions(-DMINGW32)
elseif(WIN32)
add_definitions(-DWIN32)
add_definitions(-DWIN32)
if(MINGW)
add_definitions(-DMINGW32)
endif()
Expand All @@ -124,11 +125,21 @@ endif()
if(MSVC)
# Ignore 4055 for glad
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /IGNORE:4055")
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DMSVC)
add_definitions(-DNOMINMAX) ## for avoid issue regarding std::max and std::min
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DMSVC)
add_definitions(-DNOMINMAX) ## for avoid issue regarding std::max and std::min
if (BUILD_X32)
set(CMAKE_GENERATOR_PLATFROM=x86)
else()
set(CMAKE_GENERATOR_PLATFROM=x64)
endif()
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter")
if (BUILD_X32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
endif()
endif()

if (TARGET uninstall)
Expand Down Expand Up @@ -213,15 +224,27 @@ set_target_properties(${PROJECT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${FINAL_BI
set_target_properties(${PROJECT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${FINAL_BIN_DIR}")
set_target_properties(${PROJECT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${FINAL_BIN_DIR}")
set_target_properties(${PROJECT} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${FINAL_BIN_DIR}")

if ("${CMAKE_EXE_LINKER_FLAGS}" STREQUAL "/machine:x64")
set(ARCH x64)
add_definitions(-DVERSION_X64)
message("${PROJECT} Build X64")
else()
set(ARCH x32)
add_definitions(-DVERSION_X32)
message("${PROJECT} Build X32")

if(MSVC)
if ("${CMAKE_EXE_LINKER_FLAGS}" STREQUAL "/machine:x64")
set(ARCH x64)
add_definitions(-DVERSION_X64)
message("${PROJECT} Build X64")
else()
set(ARCH x32)
add_definitions(-DVERSION_X32)
message("${PROJECT} Build X32")
endif()
else()
if (BUILD_X32)
set(ARCH x64)
add_definitions(-DVERSION_X64)
message("${PROJECT} Build X64")
else()
set(ARCH x64)
add_definitions(-DVERSION_X64)
message("${PROJECT} Build X64")
endif()
endif()

#############################################################
Expand Down

0 comments on commit 93c56f6

Please sign in to comment.