1add_compile_options(-DLUA_CORE) 2 3set(luametatex_sources 4 source/luametatex.c 5) 6 7add_executable(luametatex ${luametatex_sources}) 8 9target_include_directories(luametatex PRIVATE 10 . 11 source/. 12 source/luacore/lua54/src 13) 14 15target_link_libraries(luametatex 16 tex 17 lua 18 mp 19 20 luarest 21 luasocket 22 luaoptional 23 24 pplib 25 miniz 26 softposit 27 potrace 28) 29 30if (LUAMETATEX_NOLDL) 31 # mingw ucrt 32else() 33 target_link_libraries(luametatex 34 ${CMAKE_DL_LIBS} 35 ) 36endif() 37 38install(TARGETS luametatex 39 EXPORT luametatex 40 RUNTIME 41 DESTINATION ${CMAKE_INSTALL_BINDIR} 42 COMPONENT luametatex_runtime 43) 44 45if (luametatex_use_mimalloc) 46 target_include_directories(luametatex PRIVATE 47 source/libraries/mimalloc/include 48 ) 49 target_link_libraries(luametatex 50 mimalloc 51 ) 52 if (LUAMETATEX_MINGW) 53 target_link_libraries(luametatex --static) 54 target_link_libraries(luametatex 55 pthread 56 psapi 57 bcrypt 58 ) 59 elseif (NOT MSVC) 60 target_link_libraries(luametatex 61 pthread 62 ) 63 endif() 64endif() 65 66if (NOT MSVC) 67 target_link_libraries(luametatex 68 m 69) 70endif() 71 72if (${CMAKE_HOST_SOLARIS}) 73 target_link_libraries(luametatex 74 rt 75 socket 76 nsl 77 resolv 78) 79endif() 80 81if (DEFINED LMT_OPTIMIZE) 82 # we strip anyway 83elseif (CMAKE_HOST_SOLARIS) 84 # no strip 85elseif (CMAKE_C_COMPILER_ID MATCHES "GNU") 86 # -g -S -d : remove all debugging symbols & sections 87 # -x : remove all non-global symbols 88 # -X : remove any compiler-generated symbols 89 add_custom_command(TARGET luametatex POST_BUILD COMMAND ${CMAKE_STRIP} -g -S -d -x luametatex${CMAKE_EXECUTABLE_SUFFIX}) 90endif() 91