Skip to content

Commit

Permalink
Merge 84095d2 into f8f2510
Browse files Browse the repository at this point in the history
  • Loading branch information
turleypol committed Jan 30, 2024
2 parents f8f2510 + 84095d2 commit e3d4184
Show file tree
Hide file tree
Showing 20 changed files with 222 additions and 246 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/coverity-scan.yml
Expand Up @@ -59,11 +59,14 @@ jobs:
run: |
cd bin-build
cmake .. -DNO_PCH=1
cmake --build . --target libcurl_Ext
cmake --build . --target libcurl_ext
cmake --build . --target libantlr_ext
cmake --build . --target boost_extract
cmake --build . --target kaitai_Ext
cmake --build . --target libboost_ext
cmake --build . --target libkaitai_ext
cmake --build . --target libtinyxml
cmake --build . --target libfmt_ext
cmake --build . --target libescriptgrammar
cmake --build . --target libcppdap_ext
- name: Build with cov-build
Expand Down
90 changes: 32 additions & 58 deletions CMakeLists.txt
Expand Up @@ -33,15 +33,6 @@ option(ENABLE_FLYWEIGHT_REPORT "Enables flyweight memory report in memoryusage.l
option(GCOV "Build for coverage" OFF)
mark_as_advanced(NO_PCH USE_CCACHE ENABLE_BENCHMARK ENABLE_FLYWEIGHT_REPORT GCOV)

option(BUILD_ALL "Build everything" ON)
option(ONLY_ECOMPILE "Build only ecompile" OFF)
option(ONLY_RUNECL "Build only runecl" OFF)
option(ONLY_POL "Build only pol" OFF)
option(ONLY_POLTOOL "Build only poltool" OFF)
option(ONLY_UOCONVERT "Build only uoconvert" OFF)
option(ONLY_UOTOOL "Build only uotool" OFF)
mark_as_advanced(BUILD_ALL ONLY_ECOMPILE ONLY_RUNECL ONLY_POL ONLY_POLTOOL ONLY_UOCONVERT ONLY_UOTOOL)

option(ENABLE_ASAN "Enables Address sanitizer" OFF)
option(ENABLE_USAN "Enables Undefined sanitizer" OFF)
option(ENABLE_MSAN "Enables Memory sanitizer" OFF)
Expand All @@ -59,9 +50,6 @@ mark_as_advanced(REUSE_PCH)
# misc variables to be marked as advanced
mark_as_advanced(CLANG_FORMAT_EXE ANTLR_EXECUTABLE)

if(${ONLY_ECOMPILE} OR ${ONLY_RUNECL} OR ${ONLY_POL} OR ${ONLY_POLTOOL} OR ${ONLY_UOCONVERT} OR ${ONLY_UOTOOL})
set(BUILD_ALL OFF)
endif()
if(${ENABLE_TIDY})
set(NO_PCH ON)
endif()
Expand Down Expand Up @@ -140,70 +128,56 @@ cmake_fake_target()
include(cmake/Antlr.cmake)
include(cmake/Boost.cmake)
include(cmake/Benchmark.cmake)
include(cmake/Cppdap.cmake)
include(cmake/Curl.cmake)
include(cmake/EscriptGrammarLib.cmake)
include(cmake/escript_grammar.cmake)
include(cmake/Fmt.cmake)
include(cmake/ZLib.cmake)
if (${windows})
include(cmake/StackWalker.cmake)
endif()
include(cmake/Kaitai.cmake)
if (BUILD_ALL OR ONLY_POL)
include(cmake/Curl.cmake)
include(cmake/Cppdap.cmake)
include(cmake/SQL.cmake)
endif()
include(cmake/TinyXML.cmake)
include(cmake/PicoJson.cmake)
include(cmake/StackWalker.cmake)
include(cmake/SQL.cmake)
include(cmake/TinyXML.cmake)
include(cmake/UTF8.cmake)
include(cmake/ZLib.cmake)

add_subdirectory(docs)
add_subdirectory(pol-core)

#cmake package target for creating archive
release()

if (BUILD_ALL OR ONLY_POL)
if (${CMAKE_VERSION} VERSION_GREATER "3.6.0")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT pol)
endif()
endif()
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT pol)

add_polrelease_target()

#ctest integration
if (BUILD_ALL OR (ONLY_ECOMPILE AND ONLY_RUNECL) OR (ONLY_POLTOOL AND ONLY_UOCONVERT))
message("activating test target")
enable_testing()

#splitted into each escript testfolder to allow parallel execution
if (BUILD_ALL OR (ONLY_ECOMPILE AND ONLY_RUNECL))
set(testdir ${CMAKE_CURRENT_SOURCE_DIR}/testsuite/escript)
file(GLOB children RELATIVE ${testdir} ${testdir}/*)

foreach(child ${children})
if(IS_DIRECTORY ${testdir}/${child})
string(FIND "${child}" "_" out)
if(${out} EQUAL 0)
continue()
endif()
add_test(NAME escript_${child}
COMMAND ${CMAKE_COMMAND}
-Dtestdir=${testdir}
-Dsubtest=${child}
-Decompile=${output_bin_dir}/ecompile
-Drunecl=${output_bin_dir}/runecl
-Derrfilesuffix=1
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/escripttest.cmake
WORKING_DIRECTORY ${testdir}
)
endif()
endforeach()
endif()
if (BUILD_ALL OR (ONLY_POLTOOL AND ONLY_UOCONVERT))
include(cmake/core_tests.cmake)
message("activating test target")
enable_testing()

#splitted into each escript testfolder to allow parallel execution
set(testdir ${CMAKE_CURRENT_SOURCE_DIR}/testsuite/escript)
file(GLOB children RELATIVE ${testdir} ${testdir}/*)

foreach(child ${children})
if(IS_DIRECTORY ${testdir}/${child})
string(FIND "${child}" "_" out)
if(${out} EQUAL 0)
continue()
endif()
add_test(NAME escript_${child}
COMMAND ${CMAKE_COMMAND}
-Dtestdir=${testdir}
-Dsubtest=${child}
-Decompile=${output_bin_dir}/ecompile
-Drunecl=${output_bin_dir}/runecl
-Derrfilesuffix=1
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/escripttest.cmake
WORKING_DIRECTORY ${testdir}
)
endif()
endif()
endforeach()
include(cmake/core_tests.cmake)

#clang-format target for modified and new files
find_program(
Expand Down
56 changes: 28 additions & 28 deletions cmake/Antlr.cmake
Expand Up @@ -4,7 +4,7 @@
# 2. Copy the contents of runtime/Cpp into lib/antlr
# 3. regenerate EScriptGrammar

message("* antlr")
message("* libantlr")
set(ANTLR_SOURCE_DIR "${POL_EXT_LIB_DIR}/antlr")
set(ANTLR_INSTALL_DIR "${ANTLR_SOURCE_DIR}/install")
set(ANTLR_INCLUDE_DIR "${ANTLR_INSTALL_DIR}/include/antlr4-runtime")
Expand All @@ -13,35 +13,35 @@ if (${linux})
else()
set(ANTLR_LIB "${ANTLR_INSTALL_DIR}/lib/antlr4-runtime-static.lib")
endif()

ExternalProject_Add(libantlr_ext
SOURCE_DIR ${ANTLR_SOURCE_DIR}
PREFIX antlr
LIST_SEPARATOR |
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${ANTLR_INSTALL_DIR}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DWITH_LIBCXX=Off
-DANTLR_BUILD_SHARED=Off
-DANTLR_BUILD_CPP_TESTS=Off
-DCMAKE_OSX_ARCHITECTURES=${PIPED_OSX_ARCHITECTURES}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
BINARY_DIR ${ANTLR_SOURCE_DIR}/build
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install

BUILD_BYPRODUCTS ${ANTLR_LIB}
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
LOG_OUTPUT_ON_FAILURE 1
EXCLUDE_FROM_ALL 1
)
if (NOT EXISTS ${ANTLR_LIB})
ExternalProject_Add(libantlr_ext
SOURCE_DIR ${ANTLR_SOURCE_DIR}
PREFIX antlr
LIST_SEPARATOR |
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${ANTLR_INSTALL_DIR}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DWITH_LIBCXX=Off
-DANTLR_BUILD_SHARED=Off
-DANTLR_BUILD_CPP_TESTS=Off
-DCMAKE_OSX_ARCHITECTURES=${PIPED_OSX_ARCHITECTURES}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
BINARY_DIR ${ANTLR_SOURCE_DIR}/build
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install

BUILD_BYPRODUCTS ${ANTLR_LIB}
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
LOG_OUTPUT_ON_FAILURE 1
)
file(MAKE_DIRECTORY ${ANTLR_INCLUDE_DIR}) #directory has to exist during configure
else()
message("Antlr already build")
endif()

# imported target to add include/lib dir and additional dependencies
Expand Down
51 changes: 26 additions & 25 deletions cmake/Boost.cmake
@@ -1,4 +1,4 @@
message("* boost")
message("* libboost")
set (BOOST_SOURCE_DIR "${POL_EXT_LIB_DIR}/boost_1_83_0")
# set (BOOST_STAGE_LIB_DIR "${BOOST_SOURCE_DIR}/stage/lib")

Expand All @@ -18,12 +18,12 @@ elseif (msvc)
endif()
endif()

if (NOT DEFINED BOOST_TOOLSET)
message(FATAL_ERROR "Unknown boost toolset to build")
endif()
#if (NOT DEFINED BOOST_TOOLSET)
# message(FATAL_ERROR "Unknown boost toolset to build")
#endif()

if (${windows})
set (BOOST_CONFIGURE_COMMAND "bootstrap.bat")
#if (${windows})
# set (BOOST_CONFIGURE_COMMAND "bootstrap.bat")
# set (BOOST_BUILD_COMMAND "b2.exe")
# set (BOOST_REGEX_LIB "${BOOST_STAGE_LIB_DIR}/libboost_regex.lib" )
# set (BOOST_SYSTEM_LIB "${BOOST_STAGE_LIB_DIR}/libboost_system.lib" )
Expand All @@ -33,8 +33,8 @@ if (${windows})
# else()
# set (BOOST_CXX_FLAGS "-fms-runtime-lib=static")
# endif()
else()
set (BOOST_CONFIGURE_COMMAND "./bootstrap.sh")
#else()
# set (BOOST_CONFIGURE_COMMAND "./bootstrap.sh")
# set (BOOST_BUILD_COMMAND "./b2")
# set (BOOST_REGEX_LIB "${BOOST_STAGE_LIB_DIR}/libboost_regex.a" )
# set (BOOST_SYSTEM_LIB "${BOOST_STAGE_LIB_DIR}/libboost_system.a" )
Expand All @@ -44,26 +44,27 @@ else()
# foreach(OSX_ARCHITECTURE ${CMAKE_OSX_ARCHITECTURES})
# set (BOOST_CXX_FLAGS "${BOOST_CXX_FLAGS} -arch ${OSX_ARCHITECTURE}")
# endforeach()
endif()
#endif()

set(boost_needs_extract FALSE)
set(boost_needs_build FALSE)
#set(boost_needs_build FALSE)
if (NOT EXISTS "${BOOST_SOURCE_DIR}/boost")
message(" - will extract")
ExternalProject_Add(boost_extract
URL "https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2"
SOURCE_DIR "${BOOST_SOURCE_DIR}"
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} --with-toolset=${BOOST_TOOLSET}
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS "${BOOST_SOURCE_DIR}"
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
BUILD_IN_SOURCE 1
LOG_OUTPUT_ON_FAILURE 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
)
set_target_properties (boost_extract PROPERTIES FOLDER 3rdParty)
ExternalProject_Add(libboost_ext
URL "https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2"
SOURCE_DIR "${BOOST_SOURCE_DIR}"
CONFIGURE_COMMAND "" #${BOOST_CONFIGURE_COMMAND} --with-toolset=${BOOST_TOOLSET}
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS "${BOOST_SOURCE_DIR}"
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
BUILD_IN_SOURCE 1
LOG_OUTPUT_ON_FAILURE 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
EXCLUDE_FROM_ALL 1
)
set_target_properties (libboost_ext PROPERTIES FOLDER 3rdParty)
set(boost_needs_extract TRUE)
else()
message(" - will not extract")
Expand Down Expand Up @@ -97,7 +98,7 @@ set_target_properties(libboost_headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${BOOST_SOURCE_DIR}
)
if (boost_needs_extract)
add_dependencies(libboost_headers boost_extract)
add_dependencies(libboost_headers libboost_ext)
endif()

#add_library(libboost_regex STATIC IMPORTED)
Expand Down
24 changes: 12 additions & 12 deletions cmake/Cppdap.cmake
@@ -1,4 +1,4 @@
message("* cppdap")
message("* libcppdap")

set (CPPDAP_REPOSITORY "https://github.com/KevinEady/cppdap.git")
set (CPPDAP_VERSION_REF "2a4c7cf")
Expand All @@ -25,7 +25,7 @@ set(CPPDAP_ARGS ${CPPDAP_FLAGS}
)

if(NOT EXISTS ${CPPDAP_LIB})
ExternalProject_Add(cppdap_Ext
ExternalProject_Add(libcppdap_ext
GIT_REPOSITORY ${CPPDAP_REPOSITORY}
GIT_TAG ${CPPDAP_VERSION_REF}
GIT_SHALLOW TRUE
Expand All @@ -36,20 +36,20 @@ if(NOT EXISTS ${CPPDAP_LIB})
BUILD_IN_SOURCE 1
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config Release --target install
BUILD_BYPRODUCTS ${CPPDAP_LIB}
EXCLUDE_FROM_ALL 1
)
else()
message(" cppdap already built")
message(" - already built")
endif()

add_library(cppdap STATIC IMPORTED)
set_target_properties(cppdap PROPERTIES IMPORTED_LOCATION ${CPPDAP_LIB})
set_target_properties(cppdap PROPERTIES IMPORTED_IMPLIB ${CPPDAP_LIB})

set_target_properties(cppdap PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CPPDAP_INSTALL_DIR}/include)

add_library(libcppdap STATIC IMPORTED)
set_target_properties(libcppdap PROPERTIES
IMPORTED_LOCATION ${CPPDAP_LIB}
IMPORTED_IMPLIB ${CPPDAP_LIB}
INTERFACE_INCLUDE_DIRECTORIES ${CPPDAP_INSTALL_DIR}/include
FOLDER 3rdParty
)
if(NOT EXISTS ${CPPDAP_LIB})
file(MAKE_DIRECTORY ${CPPDAP_INSTALL_DIR}/include) #directory has to exist during configure
add_dependencies(cppdap cppdap_Ext)
add_dependencies(libcppdap libcppdap_ext)
endif()

set_target_properties (cppdap PROPERTIES FOLDER 3rdParty)
11 changes: 6 additions & 5 deletions cmake/Curl.cmake
@@ -1,4 +1,4 @@
message("* curl")
message("* libcurl")
set(CURL_SOURCE_DIR "${POL_EXT_LIB_DIR}/curl-8.2.1")

set(CURL_FLAGS -DBUILD_CURL_EXE=OFF -DBUILD_TESTING=OFF -DCURL_STATICLIB=ON -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_LDAP=ON -DUSE_LIBIDN2=OFF)
Expand All @@ -13,7 +13,7 @@ else()
endif()

if(NOT EXISTS "${CURL_LIB}")
ExternalProject_Add(libcurl_Ext
ExternalProject_Add(libcurl_ext
URL "${CURL_SOURCE_DIR}/../curl-8.2.1.zip"
SOURCE_DIR "${CURL_SOURCE_DIR}"
PREFIX curl
Expand All @@ -29,11 +29,12 @@ if(NOT EXISTS "${CURL_LIB}")
LOG_INSTALL 1
LOG_OUTPUT_ON_FAILURE 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
EXCLUDE_FROM_ALL 1
)
set_target_properties (libcurl_Ext PROPERTIES FOLDER 3rdParty)
set_target_properties (libcurl_ext PROPERTIES FOLDER 3rdParty)
file(MAKE_DIRECTORY ${CURL_INSTALL_DIR}/include) #directory has to exist during configure
else()
message("Curl already build")
message(" - already build")
endif()

# imported target to add include/lib dir and additional dependencies
Expand Down Expand Up @@ -65,4 +66,4 @@ else()
set_property(TARGET libcurl
PROPERTY INTERFACE_LINK_LIBRARIES wldap32)
endif()
add_dependencies(libcurl libcurl_Ext)
add_dependencies(libcurl libcurl_ext)

0 comments on commit e3d4184

Please sign in to comment.