zdray/CMakeLists.txt

170 lines
5.7 KiB
Text
Raw Normal View History

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
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
src/framework/halffloat.cpp
src/framework/binfile.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
src/framework/binfile.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
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
src/lightmap/pngwriter.cpp
2021-11-15 23:30:54 +00:00
src/lightmap/pngwriter.h
src/lightmap/levelmesh.cpp
src/lightmap/levelmesh.h
src/lightmap/lightmaptexture.cpp
src/lightmap/lightmaptexture.h
2018-10-29 17:33:22 +00:00
src/lightmap/collision.cpp
2021-11-15 23:30:54 +00:00
src/lightmap/collision.h
src/lightmap/delauneytriangulator.cpp
src/lightmap/delauneytriangulator.h
src/lightmap/stacktrace.cpp
src/lightmap/stacktrace.h
src/lightmap/surfaceclip.cpp
src/lightmap/surfaceclip.h
src/lightmap/gpuraytracer.cpp
src/lightmap/gpuraytracer.h
src/lightmap/glsl_frag.h
src/lightmap/glsl_vert.h
2022-08-27 03:38:40 +00:00
src/lightmap/glsl_frag_resolve.h
2022-10-26 09:52:10 +00:00
src/lightmap/renderdoc_app.h
src/lightmap/portal.h
src/math/mat.cpp
src/math/plane.cpp
2018-11-03 17:08:45 +00:00
src/math/angle.cpp
src/math/bounds.cpp
src/math/mathlib.cpp
2021-11-15 23:30:54 +00:00
src/math/mat.h
src/math/quaternion.h
src/math/vec.h
src/math/mathlib.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/model_ue1.h
src/models/modelrenderer.h
src/models/models_md2.cpp
src/models/models_md3.cpp
src/models/models_obj.cpp
src/models/models_ue1.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
set(THIRDPARTY_SOURCES
${CMAKE_SOURCE_DIR}/thirdparty/dp_rect_pack/dp_rect_pack.h
${CMAKE_SOURCE_DIR}/thirdparty/miniz/miniz.h
${CMAKE_SOURCE_DIR}/thirdparty/miniz/miniz.c
)
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/.+")
source_group("src\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/math/.+")
source_group("src\\Lightmap" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/src/lightmap/.+")
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" )
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()
add_definitions(-DNO_SSE)
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)
2022-11-07 22:24:24 +00:00
if(MSVC)
set_property(TARGET zdray PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()