elena-lang icon indicating copy to clipboard operation
elena-lang copied to clipboard

Create a CMake files to each C++ project

Open bencz opened this issue 4 years ago • 11 comments

bencz avatar Jun 28 '20 20:06 bencz

closing after merge

arakov avatar Jun 29 '20 14:06 arakov

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()

bencz avatar Mar 24 '21 15:03 bencz

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

arakov avatar Mar 24 '21 15:03 arakov

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

arakov avatar Mar 24 '21 15:03 arakov

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 avatar Mar 24 '21 18:03 bencz

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

bencz avatar Mar 24 '21 18:03 bencz

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

arakov avatar Mar 25 '21 08:03 arakov

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

arakov avatar Mar 25 '21 09:03 arakov

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 avatar Mar 25 '21 12:03 bencz

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

bencz avatar Mar 25 '21 12:03 bencz

👍

arakov avatar Mar 25 '21 12:03 arakov