Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting cmake conversion #221

Open
wants to merge 44 commits into
base: cmake-conversion
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3a75778
added timeline to conversion
Nov 15, 2023
ad3f258
added conversion list
Nov 15, 2023
e04c2bd
updated conversion list
Nov 15, 2023
acd5af2
excluded build folders
Nov 15, 2023
5a5e134
Converted lemon to cmake
Nov 15, 2023
b9489a3
changed required version of lemon cmake
Nov 15, 2023
99821e7
updated targetlist
Nov 16, 2023
59dc10f
added cmake files to gitignore
Nov 16, 2023
ef9629b
Merge branch 'utwente-fmt:master' into to-cmake
Codermann63 Nov 19, 2023
673e32c
updated conversion status
Nov 19, 2023
2a9ee16
Merge branch 'to-cmake' of https://github.com/Codermann63/ltsmin into…
Nov 19, 2023
651b39c
Added installation bash script
Nov 22, 2023
bf5bc76
Cleaned up install script
Codermann63 Nov 28, 2023
05e999f
added lemon to root CMakeLists
Codermann63 Nov 29, 2023
c622dc8
converting src/ce to cmake
Codermann63 Dec 3, 2023
88b1da9
push for meeting
Codermann63 Dec 4, 2023
8458edd
made an early draft of src/hre and src/ce CMakeLists
Codermann63 Dec 6, 2023
fd6dd26
Flex and lemon conversion implemented
Codermann63 Dec 8, 2023
3eb9e92
Cmake conversion to work with ltl2ba
Codermann63 Dec 8, 2023
52977ff
Converting ltsmin-lib to cmake
Codermann63 Dec 18, 2023
4b6c1c8
Made ce optional
Codermann63 Dec 18, 2023
3839fb8
Merge branch 'utwente-fmt:master' into to-cmake
Codermann63 Jan 2, 2024
0843167
Begin conversion to cmake of lts-sym
Codermann63 Jan 2, 2024
ac954e1
Merge branch 'to-cmake' of https://github.com/codermann63/ltsmin into…
Codermann63 Jan 2, 2024
3fe7324
converted vset-lib to cmake
Codermann63 Jan 5, 2024
45ce819
converted util-lib to cmake
Codermann63 Jan 5, 2024
6c1018f
Implemented an executable for pins2lts-sym
Codermann63 Jan 6, 2024
a289d0a
added spg-lib to cmake
Codermann63 Jan 7, 2024
a13a735
added bignum with cmake
Codermann63 Jan 7, 2024
fabf0b3
implemented executable for pins2lts-sym
Codermann63 Jan 10, 2024
761b6e4
implemented the executable of eft2lts-sym
Codermann63 Jan 10, 2024
47929de
implemented executable of pnml2lts-sym
Codermann63 Jan 10, 2024
407f4cb
implemented executable dve2lts-sym
Codermann63 Jan 10, 2024
f3411d5
Cleanup
Codermann63 Jan 12, 2024
614b6af
added bitset_test
Codermann63 Jan 12, 2024
b35510a
minor name changes
Codermann63 Jan 12, 2024
87a7e47
implemented tests in cmake
Codermann63 Jan 15, 2024
6785154
removed unnecassary cmake_minimum_required
Codermann63 Jan 15, 2024
33df8a6
minor changes
Codermann63 Jan 16, 2024
c2def83
minor variability development
Codermann63 Jan 17, 2024
022d51e
changed name of install script
Codermann63 Jan 17, 2024
4eb8a74
added install targets
Codermann63 Jan 17, 2024
6c72233
added some variablility management and fixed some old syntax errors
Codermann63 Jan 19, 2024
a9c4192
have sylvan
Jan 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TAGS
*.sum
*.plist
*.dSYM
config.h.in
# config.h.in Removed for cmake compilation
.libs/
.metadata/
.project
Expand Down Expand Up @@ -67,3 +67,20 @@ testsuite/wine.exp
/examples/*.lps
/examples/abp.pbes
nbproject

#Build files
build/*

# Cmake files
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

149 changes: 149 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
cmake_minimum_required(VERSION 3.21)



project(ltsmin
VERSION 3.0.3
DESCRIPTION "TODO"
HOMEPAGE_URL "https://github.com/utwente-fmt/ltsmin"
LANGUAGES C CXX
)

Set(CMAKE_CXX_STANDARD 11)
Set(CMAKE_CXX_STANDARD_REQUIRED True)
set(PACKAGE_STRING "${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_VERSION}")
set(PACKAGE_BUGREPORT "[email protected]")
include(CTest)
set(CMAKE_MODULE_PATH cmake_modules/)

# update submodules:
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()

if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ltl2ba/CMakeLists.txt" OR
NOT EXISTS "${PROJECT_SOURCE_DIR}/scoop/Makefile.am" OR
NOT EXISTS "${PROJECT_SOURCE_DIR}/spins/spins.sh")
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()






###### CONFIGURATION ######

#check OS https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/How-To-Write-Platform-Checks
if (WIN32)
set(_WIN32 ON)
elseif (UNIX)
set(__linux__ ON)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(_APPLE_ ON)
else ()
message(FATAL_ERROR "OS not accounted for in this program")
endif()



configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_SOURCE_DIR}/ltl2ba/config.h)

####### cmake configuration output ######
#This will output which modules are active when executing the cmake command
message("cmake configuration:")
message("====================")
###ASCIIDOC
#TODO check if this actually finds asciidoc
find_program(ASCIIDOC asciidoc)
string(COMPARE NOTEQUAL ${ASCIIDOC} "ASCIIDOC-NOTFOUND" have_asciidoc)
if(${have_asciidoc})
message("ASCIIDOC = ON")
else()
message("ASCIIDOC = NOT FOUND. Asciidoc is needed for building documentation.")
endif()
###BIGNUM
#TODO: implement some kind of check here
option(with_bignum "variable to disable bignum" ON)
message("BIGNUM = ${with_bignum}")
###BUDDY
###CADP
###CC
###CXX
###LIBDDD
###MCRL
###MCRL2
###MPICC
###MPICXX
###OPAAL
###PBES
###SCOOP
###SPINS
###SPOT


option(without-spot "variable to disable spot" ON) #TODO when find_package(SPOT) works. Then change option default value to OFF
message(${without-spot})
if(${without-spot})
set(have_spot OFF)
else()
#TODO: Implement a FindSPOT.cmake in CMAKE_MODULE_PATH.
message("TODO: Implement a FindSPOT.cmake in CMAKE_MODULE_PATH.")
find_package(SPOT)
#TODO: have_spot should depend if the package was found or not
set(have_spot ON)
endif()

if(${have_spot})
message("SPOT = ON. (override with -Dwithout-spot)")
else()
message("SPOT = OFF. Spot not found, or disabled")
endif()
###XMLTO
###BOOST
###VIENNACL
###PNML
###PROB
###SDD
###SYLVAN

option(without-sylvan "variable to disable sylvan" OFF)
if(${without-sylvan})
set(SYLVAN_FOUND OFF)
else()
find_package(LACE)
find_package(SYLVAN)
#set( ON)
endif()

if(${SYLVAN_FOUND})
set(HAVE_SYLVAN ON)
message("SYLVAN = ON. (override with -Dwithout-sylvan=1)")
else()
message("SYLVAN = OFF. SYLVAN not found, or disabled")
endif()
message("====================")


#TODO add options for examples, tests and documentation


##### MAKE PROJECT
#TODO get sylvan(?) via FetchContent? or make it a submodule
add_subdirectory(src)
add_subdirectory(lib)
add_subdirectory(lemon)
add_subdirectory(ltl2ba)


66 changes: 66 additions & 0 deletions Conversion-to-cmake.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
TODO make hint about:
vector_set.c:(.text+0x1199): undefined reference to `bn_init'
./src/bignum/bignum.h:35:extern void bn_init_copy (bn_int_t *a, bn_int_t *b);

GENERAL NOTES:
- TODO: Check if flex installation in install script (install.sh) is good enough. Maybe a make error? If no error when running make, delete this note.
- root/lib should not be necessary with cmake, as it is used to increase portability between systems. Cmake should be able to do that itself. https://cmake.org/pipermail/cmake/2018-January/066885.html
- Files that might be needed from root/lib: verify.h
- TODO: find a way to get CACHE_LINE_SIZE, CACHE_LINE & LTSMIN_PATHNAME_MAX and specify it in src/hre/config.h.in
-TODO in src/hre/config.h.in figure out a way "__assume(cond)" should be define with cmakedefine
- TODO in src/hre/config.h.in what to do with /* Enable GNU extensions on systems that have them. */
NEW DEPENDENCIES?
- LTDL was given with automake in src/m4/ltdl.m4. cmake can't use this. an other dependency is needed. As standard i think linux comes with an ltdl library
- CMAKE TUTORIAL: to configure the project you can define cmake variables in the command line. Example: "cmake .. -DWITH_SPINS=1" defines the WITH_SPINS variable to be 1.
- It saves the definition in a cache. That means if you in the future do not want WITH_SPINS defined, then you need to delete the build folder
- CMAKE find_package(X): the mcr project has multiple findX files in the cmake folder (https://github.com/alaarman/mcf)
----------------root-----------------


---------------src/hre----------------
TODO: FILE:git_version.h is generated. Figure our how
config.h.in need to use #cmakedefine in order for cmake to create the config.h dynamically. You need to SET(__linux__ ON) at some point in order for __linux__ to be defined.
TODO: FILE:config.h.in Right now __linux__ is hard coded: make a way to dynamically check and set operating system version. I don't know where it is done in the automake version
TODO: FILE:config.h.in check if _GNU_SOURCE is defined correctly


---------------src/ce---------------- OPTIONAL
TODO: this is not done. is an optional modules that only is create if HAVE_CE is ON.

---------------src/ltmin-libs----------------
.lemon and .l files are used for generation of .c and .h files with lemon and flex
TODO: It looks like on the old automake code that generating lex files is optional. Look into this.


---------------lemon---------------------
Lemon is used to generate files from .lemon files (eg. src/ltsmin-libs/ltsmin-grammar.lemon)
It uses lempar.c to generate these files, BUT not a compiled version of lempar.c. Therefore lempar.c is copied into the binary directory. I'm unsure if this is the best approach

---------------ltl2ba--------------------
NOTE: root/ltl2ba/config.h file is created with the root/config.h.in. This file is currently empty. Unsure if it's needed.
SUGGESTION: this config.h should maybe be the same as root/src/hre/config.h

---------------src/pins-lib: --------------------

---------------src/pins2lts-sym---------------------
TODO MISSING IMPLEMENTATION: lpo2lts-sym
TODO MISSING IMPLEMENTATION: lps2lts-sym
TODO MISSING IMPLEMENTATION: mapa2lts-sym
TODO MISSING IMPLEMENTATION: pbe2lts-sym
TODO MISSING IMPLEMENTATION: prom2lts-sym
TODO MISSING IMPLEMENTATION: prob2lts-sym

---------------src/vset-lib---------------------
Note: a lot of optional content. I've tried to copy the options from the automake script

---------------src/util-lib---------------------
TODO: Unsure if util-lib should link to hre
---------------src/dm---------------------
TODO: In the Makefile.am there is specified a debug and nonddebug library. MAYBE CHANGE SO CMAKE HAS DEBUG AND NON-DEBUG
----------------src/bignum
TODO: implement variablity in #if defined(HAVE_GMP_H) and #elif defined(HAVE_TOMMATH_H)
---------------src/---------------------




Empty file added config.h.in
Empty file.
47 changes: 47 additions & 0 deletions install_on_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Update
sudo apt update -y
sudo apt upgrade -y

# Required dependencies when installing from github:
sudo apt install git -y
sudo apt install make -y
sudo apt install automake -y
sudo apt install libtool -y
sudo apt install flex -y
sudo apt install bison -y
sudo apt install pkgconf -y
sudo apt install cmake -y

# Required dependencies
sudo apt install libpopt-dev -y
sudo apt install zlib1g-dev -y
sudo apt install openjdk-11-jdk -y
sudo apt install ant -y

########################### install sylvan & sylvan dependencies #############################
#TODO: make sylvan a submodule
sudo apt install libgmp-dev -y
sudo apt install libhwloc-dev -y
git clone https://github.com/Codermann63/sylvan.git
cd sylvan
mkdir build
cd build
cmake ..
make
sudo make install
cd ../..

########################## PNML dependencies ##############################
sudo apt install xml2 -y
sudo apt install libxml2-dev -y

################################# install LTSMIN from github #################################
git clone https://github.com/utwente-fmt/ltsmin.git
cd ltsmin
git submodule update --init
./ltsminreconf
./configure
make
sudo make install
8 changes: 8 additions & 0 deletions lemon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.12)


add_executable(lemon lemon.c)

#lemon needs lempar.c to generate .lemons files. lempar.c is a templatefile and should not be compiled, just copied to the binaries
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/lempar.c
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
17 changes: 17 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

add_library(general-lib STATIC write.c)

target_sources(general-lib
PUBLIC
verify.h)


find_library(MATH_LIBRARY m REQUIRED)
if(MATH_LIBRARY)
target_link_libraries(general-lib PUBLIC ${MATH_LIBRARY})
endif()


target_include_directories(general-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/hre)
add_dependencies(general-lib hre)
44 changes: 44 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# LIB DEPENDENCIES (transitive depends on relations)
#
# vset-lib ----> bignum-lib
# |
# |
# v
# HRE <------> HRE-IO
# ^
# |
# v
# util-lib
# ^
# |
# |
# ltsmin-lib <---> lts-io <---- lts-lib
# ^ ^
# | \
# | \
# | \
# | mc-lib
# | \
# | v
# pins-lib ----> dm-lib
#
#

Option(have_ce "variable to check if CE is enabled" OFF) # TODO change when actual variability management has been made
if (have_ce)
add_subdirectory(ce)
endif()
add_subdirectory(hre)
add_subdirectory(pins-lib)
add_subdirectory(ltsmin-lib)
add_subdirectory(pins2lts-sym)
add_subdirectory(vset-lib)
add_subdirectory(util-lib)
add_subdirectory(lts-io)
add_subdirectory(dm)
add_subdirectory(mc-lib)
add_subdirectory(spg-lib)
add_subdirectory(bignum)
add_subdirectory(hre-io)
add_subdirectory(andl-lib)
add_subdirectory(tests)
Loading