ELENA-LANG / elena-lang

ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
https://elena-lang.github.io/
MIT License
236 stars 26 forks source link

Create a CMake files to each C++ project #506

Closed bencz closed 2 months ago

arakov commented 4 years ago

closing after merge

bencz commented 3 years ago

Hi, I saw on todo about using Cmake to build the compiler on Linux... well, the current cmake works only for windows... It's necessary to 'recreate' the current cmake script to work for windows, and linux ( x86-x64, ppc64, arm ... )

My proposal would be something: on root folder:

cmake_minimum_required(VERSION 3.16)
project(elena)

add_subdirectory("${PROJECT_SOURCE_DIR}/elenasrc2/elenasm/cmake" "${PROJECT_SOURCE_DIR}/bin")
add_subdirectory("${PROJECT_SOURCE_DIR}/elenasrc2/elc/cmake" "${PROJECT_SOURCE_DIR}/bin")
.....

The elenasm/cmake/CMakeLists.txt ( example only )

cmake_minimum_required(VERSION 3.16)
project(elenasm)

if(UNIX)
    EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
    message( STATUS "Architecture: ${ARCHITECTURE}" )
endif()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")

if(UNIX)
    # some includes and lib samples....
    if( ${ARCHITECTURE} STREQUAL "ppc64" )
        include_directories("./libs/chilkat-9.5.0-ppc64-linux/include")
        link_directories("./libs/chilkat-9.5.0-ppc64-linux/lib")
    elseif( ${ARCHITECTURE} STREQUAL "ppc64le" )
        include_directories("./libs/chilkat-9.5.0-ppc64le-linux/include")
        link_directories("./libs/chilkat-9.5.0-ppc64le-linux/lib")
    endif()
endif()

add_executable(elenasm ../cfparser.cpp ../inlineparser.cpp ../session.cpp)

if(UNIX)
    target_link_libraries(elenasm resolv pthread)
endif()

if(MINGW)
    target_link_libraries(elenasm -static-libgcc -static-libstdc++)
else(MSVC)
endif()
arakov commented 3 years ago

Hi, I will try to import make file from codeblocks to simplify the matter

arakov commented 3 years ago

I'm not familiar with make syntax, I always prefer UI to do the stuff :)

bencz commented 3 years ago

I don't think it's possible to convert the codeblocks project to CMake ... anyway, I'm going to write the cmake script for Linux and Windows

bencz commented 3 years ago

You will probably have to make some modifications to the script for Linux, to adjust the correct files

arakov commented 3 years ago

There is a tool cbp2make. I will try to use it.

arakov commented 3 years ago

I generated make files for codeblocks. In general I would prefer to use make over cmake. We could of course support both

bencz commented 3 years ago

the cbp2make works well..., I saw the make files.... About use visual tools, that ppc64le VM that I created for you, has support for XForwarding, so, you can install and use graphical programs on it, you just need to use some other SSH terminal, like this one, https://mobaxterm.mobatek.net/ , so, when you connect to the terminal, you can install codeblocks and open it....

bencz commented 3 years ago

Well, anyway, I will create CMakes for the project as well, so that it is possible to use the CLion IDE ... and do remote debugging

arakov commented 3 years ago

👍