2019-04-22 18:52:02 +02:00
|
|
|
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/)
|
2020-11-14 21:31:50 +01:00
|
|
|
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/picojson/)
|
2020-11-27 09:57:12 +01:00
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
|
|
|
endif()
|
2016-08-06 18:21:54 +02:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
|
|
|
file(GLOB_RECURSE hdrs "*.h")
|
|
|
|
file(GLOB_RECURSE srcs "*.cpp")
|
|
|
|
|
2015-07-23 10:49:53 +02:00
|
|
|
function(build_src output filename)
|
|
|
|
get_filename_component(file ${filename} NAME)
|
|
|
|
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/build/mc_${file})
|
|
|
|
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
2020-04-22 11:04:19 +02:00
|
|
|
if (USE_MATCHCOMPILER MATCHES "Verify")
|
2015-07-23 10:49:53 +02:00
|
|
|
set(verify_option "--verify")
|
|
|
|
endif()
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${outfile}
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/matchcompiler.py"
|
|
|
|
--read-dir="${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
--prefix="mc_"
|
|
|
|
--line
|
|
|
|
${verify_option}
|
|
|
|
${file}
|
|
|
|
DEPENDS ${file}
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/tools/matchcompiler.py
|
|
|
|
)
|
|
|
|
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
foreach(file ${srcs})
|
|
|
|
build_src(srcs_build ${file})
|
|
|
|
endforeach()
|
|
|
|
|
2020-04-22 11:04:19 +02:00
|
|
|
if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off")
|
2015-07-23 10:49:53 +02:00
|
|
|
set(srcs_lib ${srcs_build})
|
|
|
|
else()
|
|
|
|
set(srcs_lib ${srcs})
|
|
|
|
endif()
|
|
|
|
|
2015-11-26 20:25:09 +01:00
|
|
|
add_library(lib_objs OBJECT ${srcs_lib} ${hdrs})
|
2020-06-25 01:41:16 +02:00
|
|
|
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
|
2020-06-16 19:55:15 +02:00
|
|
|
target_precompile_headers(lib_objs PRIVATE precompiled.h)
|
|
|
|
endif()
|