cmake_minimum_required(VERSION 3.16) project(i2pdtunnelwizard LANGUAGES CXX C) set(HTML_TEMPLATE_FILE "${CMAKE_SOURCE_DIR}/htmldata.cpp") if(NOT EXISTS "${HTML_TEMPLATE_FILE}") file(WRITE "${HTML_TEMPLATE_FILE}" "// This file was created automatically by CMake\n") endif() function(add_html_content html_file const_name) file(READ "${html_file}" HTML_CONTENT) # string(REPLACE "\n" " " HTML_CONTENT "${HTML_CONTENT}") string(REGEX REPLACE " + " " " HTML_CONTENT "${HTML_CONTENT}") string(REGEX REPLACE "^ +| +$" "" HTML_CONTENT "${HTML_CONTENT}") file(READ "${HTML_TEMPLATE_FILE}" TEMPLATE_CONTENT) if("${TEMPLATE_CONTENT}" MATCHES "${const_name}") message(STATUS "${const_name} already defined") else() file(APPEND "${HTML_TEMPLATE_FILE}" "const char* ${const_name} = R\"(") file(APPEND "${HTML_TEMPLATE_FILE}" "${HTML_CONTENT}") file(APPEND "${HTML_TEMPLATE_FILE}" ")\";\n") endif() endfunction() add_html_content("${CMAKE_SOURCE_DIR}/html/start.html" "HTML_START") add_html_content("${CMAKE_SOURCE_DIR}/html/main.html" "HTML_MAIN") add_html_content("${CMAKE_SOURCE_DIR}/html/b33_server.html" "HTML_B33_SERVER") add_html_content("${CMAKE_SOURCE_DIR}/html/error.html" "HTML_ERROR") add_html_content("${CMAKE_SOURCE_DIR}/html/config.html" "HTML_CONFIG") add_html_content("${CMAKE_SOURCE_DIR}/html/form_server_without_b33" "HTML__FORM_SERVER_WITHOUT_B33") add_html_content("${CMAKE_SOURCE_DIR}/html/form_server_b33_with_auth" "HTML__FORM_SERVER_B33_WITH_AUTH") add_html_content("${CMAKE_SOURCE_DIR}/html/form_client" "HTML__FORM_CLIENT") add_html_content("${CMAKE_SOURCE_DIR}/html/tr_client_outproxy" "HTML__TD_OUTPROXY") add_html_content("${CMAKE_SOURCE_DIR}/html/tr_http_server_hostoverride" "HTML__TD_HTTP_SERVER_HOSTOVERRIDE") add_html_content("${CMAKE_SOURCE_DIR}/html/tr_irc_server_webpassword" "HTML__TD_IRC_SERVER_WEBPASSWORD") add_html_content("${CMAKE_SOURCE_DIR}/html/tr_client_b33" "HTML__TD_CLIENT_B33") set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(i2pdtunnelwizard main.cpp "${HTML_TEMPLATE_FILE}" htmldata.h versionnumber.h tunnelconstructor.h tunnelconstructor.cpp notepad.h notepad.cpp tunneltype.h randomstringgenerator.h randomstringgenerator.cpp randomstringgenerator.h randomstringgenerator.cpp http/crow.h http/crow/app.h http/crow/ci_map.h http/crow/common.h http/crow/compression.h http/crow/exceptions.h http/crow/http_connection.h http/crow/http_parser_merged.h http/crow/http_request.h http/crow/http_response.h http/crow/http_server.h http/crow/json.h http/crow/logging.h http/crow/middleware.h http/crow/middleware_context.h http/crow/mime_types.h http/crow/multipart.h http/crow/multipart_view.h http/crow/mustache.h http/crow/parser.h http/crow/query_string.h http/crow/returnable.h http/crow/routing.h http/crow/settings.h http/crow/socket_adaptors.h http/crow/task_timer.h http/crow/utility.h http/crow/version.h http/crow/websocket.h http/crow/middlewares/cookie_parser.h http/crow/middlewares/cors.h http/crow/middlewares/session.h http/crow/middlewares/utf-8.h http/httpserver.h http/httpserver.cpp http/languagehandlermiddleware.h http/languagehandlermiddleware.cpp x25519/cbackend/bitness.h x25519/cbackend/burn.c x25519/cbackend/burn.h x25519/cbackend/burnstack.c x25519/cbackend/burnstack.h x25519/cbackend/compat.h x25519/cbackend/ed.c x25519/cbackend/ed.h x25519/cbackend/ed25519-sha512.c x25519/cbackend/ed_lookup32.h x25519/cbackend/ed_lookup64.h x25519/cbackend/eddsa.h x25519/cbackend/fld.c x25519/cbackend/fld.h x25519/cbackend/limb.h x25519/cbackend/sc.c x25519/cbackend/sc.h x25519/cbackend/sha512.c x25519/cbackend/sha512.h x25519/cbackend/x25519.c x25519/cbackend/x25519.h x25519/x25519cpp.cpp x25519/x25519cpp.h codec/data/access.hpp codec/data/raw_result_buffer.hpp codec/detail/base32.hpp codec/detail/base64.hpp codec/detail/codec.hpp codec/detail/config.hpp codec/detail/stream_codec.hpp codec/base32_rfc4648.hpp codec/base64_i2p.hpp codec/parse_error.hpp) include(GNUInstallDirs) install(TARGETS i2pdtunnelwizard LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )