Files
Dennis Brakhane 9efa9ddcfc cmake: add build flags for using AVX2 etc., work around GCC bug (#1167)
* cmake: work around GCC bug when compiling Jolt

* cmake: add build flags for using AVX2 etc.

On linux, AVX2 was used by default for compiling Jolt,
buy not in other parts, which clang doesn't like
(specifically inlining functions using a disabled instruction set)

So now, we just define some compile time options to enable/disable
AVX2, AVX, AVX512 etc. and make the compiler use the code for
everything, not just Jolt. By default, AVX2 is used.

Furthermore, the CMakeLists files were slightly refactored to be
a bit less messy.

* silence GCC warnings

* fix clang build on window

* disable another gcc warning-turned-error

* spring initialization fix

* size_t initializaed to 0 instead of -1

* remove initialization

---------

Co-authored-by: Turánszki János <turanszkij@users.noreply.github.com>
Co-authored-by: Turánszki János <turanszkij@gmail.com>
2025-07-13 16:24:39 +02:00

38 lines
1.1 KiB
CMake

cmake_minimum_required(VERSION 3.19)
project(Template_Windows)
file(GLOB SOURCE_FILES CONFIGURE_DEPENDS "*.cpp" "*.h")
set(LIB_DXCOMPILER "dxcompiler.dll")
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(${PROJECT_NAME} PUBLIC
WickedEngine_Windows
)
if(MSVC)
add_compile_options(/MP)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE YES
)
set(PLATFORM "Windows")
add_compile_definitions(WIN32 _WINDOWS)
set(LIBDXCOMPILER_PATH "${WICKED_ROOT_DIR}/WickedEngine/${LIB_DXCOMPILER}")
set(STARTUP_LUA "${WICKED_ROOT_DIR}/Editor/startup.lua")
message("libdxcompiler found at ${LIBDXCOMPILER_PATH}")
message("startup lua found at ${STARTUP_LUA}")
# NOTE: this wont work because client never has prvileges to copy files
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBDXCOMPILER_PATH} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${STARTUP_LUA} ${CMAKE_CURRENT_BINARY_DIR}/startup.lua
)