purge build system
This commit is contained in:
parent
e68f9c573f
commit
24de2bbdf5
116
CMakeLists.txt
116
CMakeLists.txt
@ -9,41 +9,27 @@ include(GNUInstallDirs)
|
||||
include(flink)
|
||||
|
||||
find_package(elfio QUIET)
|
||||
find_package(Boost COMPONENTS coroutine)
|
||||
find_package(jsoncpp)
|
||||
|
||||
if(TARGET tcc::tcc)
|
||||
set(WITH_TCC ON)
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
if(DEFINED ENV{LLVM_HOME})
|
||||
find_path (LLVM_DIR LLVM-Config.cmake $ENV{LLVM_HOME}/lib/cmake/llvm)
|
||||
endif()
|
||||
find_package(LLVM QUIET CONFIG)
|
||||
if(LLVM_FOUND)
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
||||
llvm_map_components_to_libnames(llvm_libs support core mcjit x86codegen x86asmparser)
|
||||
else()
|
||||
find_package(LLVM REQUIRED LLVMSupport LLVMCore LLVMMCJIT LLVMX86CodeGen LLVMX86AsmParser)
|
||||
endif()
|
||||
endif()
|
||||
find_package(Boost COMPONENTS coroutine REQUIRED)
|
||||
|
||||
add_subdirectory(softfloat)
|
||||
|
||||
set(LIB_SOURCES
|
||||
src/iss/plugin/instruction_count.cpp
|
||||
src/iss/arch/tgc_c.cpp
|
||||
src/vm/tcc/vm_tgc_c.cpp
|
||||
src/vm/interp/vm_tgc_c.cpp
|
||||
src/vm/fp_functions.cpp
|
||||
)
|
||||
if(WITH_TCC)
|
||||
list(APPEND LIB_SOURCES src/vm/tcc/vm_tgc_c.cpp)
|
||||
list(APPEND LIB_SOURCES
|
||||
src/vm/tcc/vm_tgc_c.cpp
|
||||
)
|
||||
endif()
|
||||
if(WITH_LLVM)
|
||||
list(APPEND LIB_SOURCES src/vm/llvm/vm_tgc_c.cpp src/vm/llvm/fp_impl.cpp)
|
||||
list(APPEND LIB_SOURCES
|
||||
src/vm/llvm/vm_tgc_c.cpp
|
||||
src/vm/llvm/fp_impl.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# library files
|
||||
@ -55,7 +41,7 @@ foreach(FILEPATH ${GEN_ISS_SOURCES})
|
||||
string(TOUPPER ${CORE} CORE)
|
||||
list(APPEND LIB_DEFINES CORE_${CORE})
|
||||
endforeach()
|
||||
message("Core defines are ${LIB_DEFINES}")
|
||||
message(STATUS "Core defines are ${LIB_DEFINES}")
|
||||
|
||||
if(WITH_LLVM)
|
||||
FILE(GLOB LLVM_GEN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/llvm/vm_*.cpp)
|
||||
@ -67,10 +53,17 @@ if(WITH_TCC)
|
||||
list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES})
|
||||
endif()
|
||||
|
||||
if(TARGET RapidJSON OR TARGET RapidJSON::RapidJSON)
|
||||
list(APPEND LIB_SOURCES src/iss/plugin/cycle_estimate.cpp src/iss/plugin/pctrace.cpp)
|
||||
if(TARGET RapidJSON)
|
||||
list(APPEND LIB_SOURCES
|
||||
src/iss/plugin/cycle_estimate.cpp
|
||||
src/iss/plugin/pctrace.cpp
|
||||
)
|
||||
endif()
|
||||
if(TARGET jsoncpp::jsoncpp)
|
||||
list(APPEND LIB_SOURCES
|
||||
src/iss/plugin/instruction_count.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Define the library
|
||||
add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES})
|
||||
|
||||
@ -81,37 +74,25 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
endif()
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src-gen)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util Boost::coroutine)
|
||||
|
||||
target_force_link_libraries(${PROJECT_NAME} PRIVATE dbt-rise-core)
|
||||
# only re-export the include paths
|
||||
get_target_property(DBT_CORE_INCL dbt-rise-core INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE ${DBT_CORE_INCL})
|
||||
get_target_property(DBT_CORE_DEFS dbt-rise-core INTERFACE_COMPILE_DEFINITIONS)
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE ${DBT_CORE_DEFS})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC elfio::elfio softfloat scc-util Boost::coroutine)
|
||||
if(TARGET jsoncpp::jsoncpp)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp::jsoncpp)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-core)
|
||||
|
||||
if(TARGET elfio::elfio)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC elfio::elfio)
|
||||
else()
|
||||
message(FATAL_ERROR "No elfio library found, maybe a find_package() call is missing")
|
||||
endif()
|
||||
if(TARGET lz4::lz4)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_LZ4)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC lz4::lz4)
|
||||
endif()
|
||||
if(TARGET RapidJSON::RapidJSON)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC RapidJSON::RapidJSON)
|
||||
elseif(TARGET RapidJSON)
|
||||
if(TARGET RapidJSON)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC RapidJSON)
|
||||
endif()
|
||||
if(WITH_LLVM)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC ${LLVM_DEFINITIONS})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${LLVM_INCLUDE_DIRS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries( ${PROJECT_NAME} PUBLIC ${LLVM_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
@ -156,15 +137,16 @@ foreach(F IN LISTS TGC_SOURCES)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(WITH_LLVM)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_LLVM)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
|
||||
endif()
|
||||
if(WITH_TCC)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_TCC)
|
||||
endif()
|
||||
# Links the target exe against the libraries
|
||||
target_force_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-tgc)
|
||||
#if(WITH_LLVM)
|
||||
# target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_LLVM)
|
||||
# #target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
|
||||
#endif()
|
||||
#if(WITH_TCC)
|
||||
# target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_TCC)
|
||||
#endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-tgc fmt::fmt)
|
||||
|
||||
if(TARGET Boost::program_options)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::program_options)
|
||||
else()
|
||||
@ -184,6 +166,20 @@ install(TARGETS tgc-sim
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} # headers for mac (note the different component -> different package)
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers
|
||||
)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
# ... CMake code to create tests ...
|
||||
add_test(NAME tgc-sim-interp
|
||||
COMMAND tgc-sim -f ${CMAKE_BINARY_DIR}/../../Firmwares/hello-world/hello --backend interp)
|
||||
if(WITH_TCC)
|
||||
add_test(NAME tgc-sim-tcc
|
||||
COMMAND tgc-sim -f ${CMAKE_BINARY_DIR}/../../Firmwares/hello-world/hello --backend tcc)
|
||||
endif()
|
||||
if(WITH_LLVM)
|
||||
add_test(NAME tgc-sim-llvm
|
||||
COMMAND tgc-sim -f ${CMAKE_BINARY_DIR}/../../Firmwares/hello-world/hello --backend llvm)
|
||||
endif()
|
||||
endif()
|
||||
###############################################################################
|
||||
#
|
||||
###############################################################################
|
||||
@ -206,9 +202,9 @@ if(TARGET scc-sysc)
|
||||
endif()
|
||||
endforeach()
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-tgc scc-sysc)
|
||||
if(WITH_LLVM)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
|
||||
endif()
|
||||
# if(WITH_LLVM)
|
||||
# target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
|
||||
# endif()
|
||||
|
||||
set(LIB_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/sysc/core_complex.h)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include <iss/vm_plugin.h>
|
||||
#include "iss/instrumentation_if.h"
|
||||
#include <json/json.h>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user