Skip to content

Commit

Permalink
Merge pull request #20 from sillydan1/dev
Browse files Browse the repository at this point in the history
Release v3.0.5
  • Loading branch information
sillydan1 committed Jul 7, 2024
2 parents 07be55c + 8d27e99 commit 8f2e0a4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
44 changes: 29 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.18)
project(expr VERSION 3.0.3)
project(expr VERSION 3.0.4)
include(cmake/CPM.cmake)
configure_file(src/config.h.in config.h)
set(CMAKE_CXX_STANDARD 20)
Expand All @@ -29,6 +29,12 @@ set(CXX_STANDARD_REQUIRED ON)
# OPTIONS
option(ENABLE_Z3 "Enables the download and compilation of the expr::z3_driver driver. OFF by default" OFF)

get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()

# DEPENDENCIES
# library dependencies
CPMAddPackage("gh:yalibs/yaoverload@1.0.0")
Expand All @@ -40,10 +46,13 @@ CPMAddPackage("gh:yalibs/yatimer@1.0.0")
CPMAddPackage("gh:sillydan1/argvparse@1.2.3")

if(ENABLE_Z3)
include(cmake/Z3.cmake)
set(Z3_VERSION_NUMBER z3-4.12.2)
get_z3_zip_file(${Z3_VERSION_NUMBER})
CPMAddPackage(NAME z3 VERSION ${Z3_VERSION_NUMBER} URL ${z3vstr})
find_package(Z3 REQUIRED)
if(NOT Z3_FOUND)
include(cmake/Z3.cmake)
set(Z3_VERSION_NUMBER z3-4.13.0)
get_z3_zip_file(${Z3_VERSION_NUMBER})
CPMAddPackage(NAME z3 VERSION ${Z3_VERSION_NUMBER} URL ${z3vstr})
endif()
endif()

set(${PROJECT_NAME}_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "expr_BUILD_DIR" FORCE)
Expand All @@ -59,7 +68,7 @@ add_library(${PROJECT_NAME} SHARED
src/operations/pow.cpp
src/operations/boolean.cpp
src/driver/evaluator.cpp
)
)

target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -72,6 +81,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC
${argvparse_SOURCE_DIR}/include
${z3_SOURCE_DIR}/src/api/c++
${z3_SOURCE_DIR}/include
${Z3_CXX_INCLUDE_DIRS}
${Z3_C_INCLUDE_DIRS}
src/symbol
include
src)
Expand All @@ -85,25 +96,28 @@ target_include_directories(${PROJECT_NAME}_generic_driver PUBLIC
${yaoverload_SOURCE_DIR}/include
${yahashcombine_SOURCE_DIR}/include
${argvparse_SOURCE_DIR}/include
${z3_SOURCE_DIR}/src/api/c++
${z3_SOURCE_DIR}/include
${Z3_CXX_INCLUDE_DIRS}
${Z3_C_INCLUDE_DIRS}
src/symbol
include
src)

add_subdirectory(src/expr-lang)

if(ENABLE_Z3)
target_sources(${PROJECT_NAME} PUBLIC src/driver/z3/z3-driver.cpp)
target_link_directories(${PROJECT_NAME} PUBLIC ${z3_SOURCE_DIR}/bin)
target_link_libraries(${PROJECT_NAME} z3)
target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_Z3)
add_custom_target(copy_z3 COMMAND ${CMAKE_COMMAND} -E copy ${z3_SOURCE_DIR}/bin/libz3.* ${CMAKE_BINARY_DIR})
add_dependencies(${PROJECT_NAME} copy_z3)
target_sources(${PROJECT_NAME} PUBLIC src/driver/z3/z3-driver.cpp)
target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_Z3)
if(NOT Z3_FOUND)
target_link_directories(${PROJECT_NAME} PUBLIC ${z3_SOURCE_DIR}/bin)
target_link_libraries(${PROJECT_NAME} z3)
add_custom_target(copy_z3 COMMAND ${CMAKE_COMMAND} -E copy ${z3_SOURCE_DIR}/bin/libz3.* ${CMAKE_BINARY_DIR})
add_dependencies(${PROJECT_NAME} copy_z3)
else()
target_link_libraries(${PROJECT_NAME} z3::libz3)
endif()
endif()

add_executable(${PROJECT_NAME}_demo src/main.cpp)
set_target_properties(${PROJECT_NAME}_demo PROPERTIES RPATH ${z3_SOURCE_DIR}/bin)
target_link_libraries(${PROJECT_NAME}_demo ${PROJECT_NAME} expr_lang argvparse ${PROJECT_NAME}_generic_driver)
target_link_libraries(${PROJECT_NAME}_generic_driver expr_lang)

2 changes: 1 addition & 1 deletion cmake/CPM.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(CPM_DOWNLOAD_VERSION 0.38.5)
set(CPM_DOWNLOAD_VERSION 0.40.0)

if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)
Expand Down
2 changes: 1 addition & 1 deletion src/expr-lang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.18)
project(expr_lang VERSION 3.0.0)
project(expr_lang VERSION 3.0.1)
set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED ON)
find_package(FLEX REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion src/expr-lang/expr.y
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ unit:

statements:
%empty { }
| statement statements { }
| statements statement { }
;

statement:
Expand Down

0 comments on commit 8f2e0a4

Please sign in to comment.