CMake: fix ASM compile

- target_sources from correct directory
- enable_language must be used in add_executable directory
This commit is contained in:
James R 2021-05-07 18:57:46 -07:00
parent 9e7d80c2c4
commit 87afa7655a
3 changed files with 6 additions and 4 deletions

View file

@ -117,8 +117,6 @@ set(SRB2_SDL2_EXE_NAME srb2 CACHE STRING "Executable binary output name")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
add_subdirectory(src)
add_subdirectory(assets)

View file

@ -1,5 +1,7 @@
# SRB2 Core
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
# Core sources
target_sourcefile(c)
target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h)
@ -206,9 +208,13 @@ if(${SRB2_CONFIG_USEASM})
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
enable_language(ASM_NASM)
endif()
set(SRB2_USEASM ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse")
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES})
else()
set(SRB2_USEASM OFF)
target_compile_definitions(SRB2SDL2 PRIVATE -DNONX86 -DNORUSEASM)

View file

@ -56,8 +56,6 @@ endif()
if(${SDL2_FOUND})
if(${SRB2_USEASM})
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES})
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES LANGUAGE C)
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
endif()