diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b460da..8449c41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.12) -project(tgfs VERSION 1.0.0) +project(tgc VERSION 1.0.0) include(GNUInstallDirs) @@ -49,7 +49,7 @@ set(LIB_SOURCES ${LIB_SOURCES} endif() # Define the library -add_library(tgfs SHARED ${LIB_SOURCES}) +add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES}) # list code gen dependencies if(TARGET TGF_B_src) add_dependencies(tgfs TGF_B_src) @@ -58,54 +58,54 @@ if(TARGET TGF_C_src) add_dependencies(tgfs TGF_C_src) endif() -target_compile_options(tgfs PRIVATE -Wno-shift-count-overflow) -target_include_directories(tgfs PUBLIC incl) -target_link_libraries(tgfs PUBLIC softfloat scc-util) -target_link_libraries(tgfs PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive) -target_link_libraries(tgfs PUBLIC ${Boost_LIBRARIES} ) -set_target_properties(tgfs PROPERTIES +target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow) +target_include_directories(${PROJECT_NAME} PUBLIC incl) +target_link_libraries(${PROJECT_NAME} PUBLIC softfloat scc-util) +target_link_libraries(${PROJECT_NAME} PUBLIC -Wl,--whole-archive dbt-core -Wl,--no-whole-archive) +target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES} ) +set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} FRAMEWORK FALSE PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers ) if(SystemC_FOUND) - add_library(tgfs_sc src/sysc/core_complex.cpp) - target_compile_definitions(tgfs_sc PUBLIC WITH_SYSTEMC) - target_include_directories(tgfs_sc PUBLIC ../incl ${SystemC_INCLUDE_DIRS} ${CCI_INCLUDE_DIRS}) + add_library(${PROJECT_NAME}_sc src/sysc/core_complex.cpp) + target_compile_definitions(${PROJECT_NAME}_sc PUBLIC WITH_SYSTEMC) + target_include_directories(${PROJECT_NAME}_sc PUBLIC ../incl ${SystemC_INCLUDE_DIRS} ${CCI_INCLUDE_DIRS}) if(SCV_FOUND) - target_compile_definitions(tgfs_sc PUBLIC WITH_SCV) - target_include_directories(tgfs_sc PUBLIC ${SCV_INCLUDE_DIRS}) + target_compile_definitions(${PROJECT_NAME}_sc PUBLIC WITH_SCV) + target_include_directories(${PROJECT_NAME}_sc PUBLIC ${SCV_INCLUDE_DIRS}) endif() - target_link_libraries(tgfs_sc PUBLIC tgfs scc ) + target_link_libraries(${PROJECT_NAME}_sc PUBLIC ${PROJECT_NAME} scc ) if(WITH_LLVM) - target_link_libraries(tgfs_sc PUBLIC ${llvm_libs}) + target_link_libraries(${PROJECT_NAME}_sc PUBLIC ${llvm_libs}) endif() - set_target_properties(tgfs_sc PROPERTIES + set_target_properties(${PROJECT_NAME}_sc PROPERTIES VERSION ${PROJECT_VERSION} FRAMEWORK FALSE PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers ) endif() -project("tgfs-sim") -add_executable(tgfs-sim src/main.cpp) +project("tgc-sim") +add_executable(${PROJECT_NAME} src/main.cpp) # This sets the include directory for the reference project. This is the -I flag in gcc. if(WITH_LLVM) - target_compile_definitions(tgfs-sim PRIVATE WITH_LLVM) - target_link_libraries(tgfs-sim PUBLIC ${llvm_libs}) + target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_LLVM) + target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs}) endif() # Links the target exe against the libraries -target_link_libraries(tgfs-sim tgfs) -target_link_libraries(tgfs-sim jsoncpp) -target_link_libraries(tgfs-sim ${Boost_LIBRARIES} ) +target_link_libraries(${PROJECT_NAME} tgc) +target_link_libraries(${PROJECT_NAME} jsoncpp) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ) if (Tcmalloc_FOUND) - target_link_libraries(tgfs-sim ${Tcmalloc_LIBRARIES}) + target_link_libraries(${PROJECT_NAME} ${Tcmalloc_LIBRARIES}) endif(Tcmalloc_FOUND) -install(TARGETS tgfs tgfs-sim +install(TARGETS tgc tgc-sim EXPORT ${PROJECT_NAME}Targets # for downstream dependencies ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries