2022-11-07 22:24:24 +00:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 20:36:27 +00:00
|
|
|
add_subdirectory( thirdparty/ZVulkan )
|
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
project(zdray)
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
include(CheckFunctionExists)
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
set(ZDRAY_SOURCES
|
2017-08-03 20:13:30 +00:00
|
|
|
src/main.cpp
|
2017-08-03 18:25:54 +00:00
|
|
|
src/commandline/getopt.c
|
|
|
|
src/commandline/getopt1.c
|
2021-11-15 23:30:54 +00:00
|
|
|
src/commandline/getopt.h
|
2023-10-16 14:46:16 +00:00
|
|
|
src/framework/binfile.cpp
|
|
|
|
src/framework/binfile.h
|
2018-11-03 17:16:14 +00:00
|
|
|
src/framework/halffloat.cpp
|
2021-10-14 15:12:05 +00:00
|
|
|
src/framework/zstring.cpp
|
|
|
|
src/framework/zstrformat.cpp
|
|
|
|
src/framework/utf8.cpp
|
|
|
|
src/framework/utf8.h
|
2021-11-15 23:30:54 +00:00
|
|
|
src/framework/tarray.h
|
|
|
|
src/framework/templates.h
|
|
|
|
src/framework/zdray.h
|
|
|
|
src/framework/xs_Float.h
|
|
|
|
src/framework/halffloat.h
|
2023-10-04 20:22:54 +00:00
|
|
|
src/framework/vectors.h
|
|
|
|
src/framework/matrix.cpp
|
|
|
|
src/framework/matrix.h
|
|
|
|
src/framework/bounds.cpp
|
|
|
|
src/framework/bounds.h
|
2023-10-10 20:15:00 +00:00
|
|
|
src/framework/textureid.cpp
|
|
|
|
src/framework/textureid.h
|
2017-08-03 18:25:54 +00:00
|
|
|
src/blockmapbuilder/blockmapbuilder.cpp
|
2021-11-15 23:30:54 +00:00
|
|
|
src/blockmapbuilder/blockmapbuilder.h
|
2017-08-03 18:25:54 +00:00
|
|
|
src/level/level.cpp
|
|
|
|
src/level/level_udmf.cpp
|
2018-11-03 17:22:04 +00:00
|
|
|
src/level/level_light.cpp
|
2022-06-21 13:20:18 +00:00
|
|
|
src/level/level_slopes.cpp
|
2021-11-15 23:30:54 +00:00
|
|
|
src/level/doomdata.h
|
|
|
|
src/level/level.h
|
|
|
|
src/level/workdata.h
|
2017-08-03 18:25:54 +00:00
|
|
|
src/parse/sc_man.cpp
|
2021-11-15 23:30:54 +00:00
|
|
|
src/parse/sc_man.h
|
2017-08-03 18:25:54 +00:00
|
|
|
src/wad/wad.cpp
|
2021-11-15 23:30:54 +00:00
|
|
|
src/wad/wad.h
|
2017-08-03 18:25:54 +00:00
|
|
|
src/nodebuilder/nodebuild.cpp
|
|
|
|
src/nodebuilder/nodebuild_events.cpp
|
|
|
|
src/nodebuilder/nodebuild_extract.cpp
|
|
|
|
src/nodebuilder/nodebuild_gl.cpp
|
|
|
|
src/nodebuilder/nodebuild_utility.cpp
|
|
|
|
src/nodebuilder/nodebuild_classify_nosse2.cpp
|
2021-11-15 23:30:54 +00:00
|
|
|
src/nodebuilder/nodebuild.h
|
2023-10-04 20:22:54 +00:00
|
|
|
src/lightmapper/hw_levelmesh.cpp
|
|
|
|
src/lightmapper/hw_levelmesh.h
|
2024-01-16 11:43:37 +00:00
|
|
|
src/lightmapper/hw_levelmeshlight.h
|
|
|
|
src/lightmapper/hw_levelmeshportal.h
|
|
|
|
src/lightmapper/hw_levelmeshsurface.h
|
|
|
|
src/lightmapper/hw_lightmaptile.h
|
|
|
|
src/lightmapper/flatvertices.h
|
|
|
|
src/lightmapper/hw_materialstate.h
|
|
|
|
src/lightmapper/hw_surfaceuniforms.h
|
2023-10-04 20:22:54 +00:00
|
|
|
src/lightmapper/hw_collision.cpp
|
|
|
|
src/lightmapper/hw_collision.h
|
|
|
|
src/lightmapper/vk_renderdevice.cpp
|
|
|
|
src/lightmapper/vk_renderdevice.h
|
2024-01-16 11:43:37 +00:00
|
|
|
src/lightmapper/vk_levelmesh.cpp
|
|
|
|
src/lightmapper/vk_levelmesh.h
|
|
|
|
src/lightmapper/vk_lightmapper.cpp
|
|
|
|
src/lightmapper/vk_lightmapper.h
|
2023-10-04 20:22:54 +00:00
|
|
|
src/lightmapper/doom_levelmesh.cpp
|
|
|
|
src/lightmapper/doom_levelmesh.h
|
|
|
|
src/lightmapper/gpuraytracer.cpp
|
|
|
|
src/lightmapper/gpuraytracer.h
|
2023-10-05 21:03:28 +00:00
|
|
|
src/lightmapper/stacktrace.cpp
|
|
|
|
src/lightmapper/stacktrace.h
|
2023-10-05 22:34:04 +00:00
|
|
|
src/lightmapper/glsl/binding_lightmapper.glsl.h
|
|
|
|
src/lightmapper/glsl/binding_raytrace.glsl.h
|
|
|
|
src/lightmapper/glsl/binding_textures.glsl.h
|
|
|
|
src/lightmapper/glsl/frag_blur.glsl.h
|
|
|
|
src/lightmapper/glsl/frag_copy.glsl.h
|
|
|
|
src/lightmapper/glsl/frag_raytrace.glsl.h
|
|
|
|
src/lightmapper/glsl/frag_resolve.glsl.h
|
2024-02-28 21:32:43 +00:00
|
|
|
src/lightmapper/glsl/montecarlo.glsl.h
|
2023-10-05 22:34:04 +00:00
|
|
|
src/lightmapper/glsl/polyfill_rayquery.glsl.h
|
|
|
|
src/lightmapper/glsl/trace_ambient_occlusion.glsl.h
|
2024-02-28 21:32:43 +00:00
|
|
|
src/lightmapper/glsl/trace_bounce.glsl.h
|
2023-10-05 22:34:04 +00:00
|
|
|
src/lightmapper/glsl/trace_levelmesh.glsl.h
|
|
|
|
src/lightmapper/glsl/trace_light.glsl.h
|
|
|
|
src/lightmapper/glsl/trace_sunlight.glsl.h
|
|
|
|
src/lightmapper/glsl/vert_copy.glsl.h
|
|
|
|
src/lightmapper/glsl/vert_raytrace.glsl.h
|
|
|
|
src/lightmapper/glsl/vert_screenquad.glsl.h
|
2021-10-14 15:12:05 +00:00
|
|
|
src/models/model.cpp
|
|
|
|
src/models/model.h
|
|
|
|
src/models/model_md2.h
|
|
|
|
src/models/model_md3.h
|
|
|
|
src/models/model_obj.h
|
|
|
|
src/models/modelrenderer.h
|
|
|
|
src/models/models_md2.cpp
|
|
|
|
src/models/models_md3.cpp
|
|
|
|
src/models/models_obj.cpp
|
|
|
|
src/models/tab_anorms.h
|
2017-08-03 18:25:54 +00:00
|
|
|
src/platform/windows/resource.h
|
2018-10-26 07:15:14 +00:00
|
|
|
)
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2021-10-28 21:27:25 +00:00
|
|
|
set(THIRDPARTY_SOURCES
|
2022-07-08 20:51:41 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/thirdparty/dp_rect_pack/dp_rect_pack.h
|
2021-11-15 23:04:05 +00:00
|
|
|
${CMAKE_SOURCE_DIR}/thirdparty/miniz/miniz.h
|
|
|
|
${CMAKE_SOURCE_DIR}/thirdparty/miniz/miniz.c
|
2021-10-28 21:27:25 +00:00
|
|
|
)
|
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
set(ZDRAY_LIBS
|
|
|
|
zvulkan
|
|
|
|
)
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
source_group("src" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/.+")
|
|
|
|
source_group("src\\BlockmapBuilder" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/blockmapbuilder/.+")
|
|
|
|
source_group("src\\Commandline" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/commandline/.+")
|
|
|
|
source_group("src\\Framework" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/framework/.+")
|
|
|
|
source_group("src\\Level" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/level/.+")
|
|
|
|
source_group("src\\NodeBuilder" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/nodebuilder/.+")
|
|
|
|
source_group("src\\Parse" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/parse/.+")
|
|
|
|
source_group("src\\Platform" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/platform/.+")
|
|
|
|
source_group("src\\Platform\\Windows" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/.+")
|
|
|
|
source_group("src\\Wad" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/wad/.+")
|
2023-10-04 20:22:54 +00:00
|
|
|
source_group("src\\Lightmapper" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/lightmapper/.+")
|
2023-10-05 22:34:04 +00:00
|
|
|
source_group("src\\Lightmapper\\glsl" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/lightmapper/glsl/.+")
|
2022-11-07 22:24:24 +00:00
|
|
|
source_group("src\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/models/.+")
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
source_group("thirdparty" REGULAR_EXPRESSION "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/.+")
|
|
|
|
source_group("thirdparty\\dp_rect_pack" REGULAR_EXPRESSION "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/dp_rect_pack/.+")
|
|
|
|
source_group("thirdparty\\miniz" REGULAR_EXPRESSION "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/miniz/.+")
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
include_directories( src "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ZVulkan/include" "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty" )
|
2021-10-28 21:27:25 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
|
|
|
|
include(TargetArch)
|
|
|
|
target_architecture(TARGET_ARCHITECTURE)
|
|
|
|
if(${TARGET_ARCHITECTURE} MATCHES "x86_64")
|
|
|
|
set(ZDRAY_SOURCES ${ZDRAY_SOURCES}
|
|
|
|
src/nodebuilder/nodebuild_classify_sse1.cpp
|
|
|
|
src/nodebuilder/nodebuild_classify_sse2.cpp
|
|
|
|
)
|
|
|
|
set_source_files_properties(src/nodebuilder/nodebuild_classify_sse1.cpp PROPERTIES COMPILE_FLAGS "${SSE1_ENABLE}")
|
|
|
|
set_source_files_properties(src/nodebuilder/nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}")
|
|
|
|
else()
|
2023-12-23 14:09:52 +00:00
|
|
|
add_definitions(-DDISABLE_SSE)
|
2021-10-28 21:27:25 +00:00
|
|
|
endif()
|
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(stricmp STRICMP_EXISTS)
|
|
|
|
if(NOT STRICMP_EXISTS)
|
|
|
|
add_definitions(-Dstricmp=strcasecmp)
|
2021-11-12 16:08:15 +00:00
|
|
|
endif()
|
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
CHECK_FUNCTION_EXISTS( strnicmp STRNICMP_EXISTS )
|
|
|
|
if(NOT STRNICMP_EXISTS)
|
|
|
|
add_definitions(-Dstrnicmp=strncasecmp)
|
|
|
|
endif()
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DUNICODE -D_UNICODE)
|
|
|
|
else()
|
|
|
|
add_definitions(-DUNIX -D_UNIX)
|
|
|
|
add_link_options(-pthread)
|
|
|
|
endif()
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
if(MSVC)
|
|
|
|
# Use all cores for compilation
|
|
|
|
set(CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS}")
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
# zdbsp source code is using some ancient C code that really should be updated
|
|
|
|
set_source_files_properties(${ZDRAY_SOURCES} PROPERTIES COMPILE_FLAGS "/wd4996 -D_CRT_SECURE_NO_WARNINGS")
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
# Ignore warnings in third party code
|
|
|
|
#set_source_files_properties(${THIRDPARTY_SOURCES} PROPERTIES COMPILE_FLAGS "/wd4244 /wd4267 /wd4005 /wd4018 -D_CRT_SECURE_NO_WARNINGS")
|
|
|
|
endif()
|
2017-08-03 18:25:54 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
add_executable(zdray ${ZDRAY_SOURCES} ${THIRDPARTY_SOURCES})
|
|
|
|
target_link_libraries(zdray ${ZDRAY_LIBS})
|
|
|
|
set_target_properties(zdray PROPERTIES CXX_STANDARD 17)
|
2021-10-28 21:27:25 +00:00
|
|
|
|
2022-11-07 22:24:24 +00:00
|
|
|
if(MSVC)
|
|
|
|
set_property(TARGET zdray PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
|
|
endif()
|