🚀 switch build script to new nasal

This commit is contained in:
ValKmjolnir
2023-07-02 00:32:13 +08:00
parent 597c0388cb
commit a7a2f47d1e
12 changed files with 348 additions and 340 deletions
+29 -8
View File
@@ -4,7 +4,7 @@ project(nasal VERSION 10.1)
message("CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
# -std=c++14 -Wshadow -Wall
# -std=c++17 -Wshadow -Wall
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-Wshadow -Wall")
@@ -14,24 +14,45 @@ set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/module)
add_library(fib SHARED ${CMAKE_SOURCE_DIR}/module/fib.cpp)
target_include_directories(fib PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(fib PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_library(key SHARED ${CMAKE_SOURCE_DIR}/module/keyboard.cpp)
target_include_directories(key PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(key PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_library(mat SHARED ${CMAKE_SOURCE_DIR}/module/matrix.cpp)
target_include_directories(mat PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(mat PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_library(nasock SHARED ${CMAKE_SOURCE_DIR}/module/nasocket.cpp)
target_include_directories(nasock PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(nasock PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_executable(nasal main.cpp)
set(NASAL_OBJECT_SOURCE_FILE
${CMAKE_SOURCE_DIR}/src/ast_dumper.cpp
${CMAKE_SOURCE_DIR}/src/ast_visitor.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_ast.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_builtin.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_codegen.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_dbg.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_err.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_gc.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_import.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_lexer.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_misc.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_opcode.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_parse.cpp
${CMAKE_SOURCE_DIR}/src/nasal_new_vm.cpp
${CMAKE_SOURCE_DIR}/src/optimizer.cpp
${CMAKE_SOURCE_DIR}/src/symbol_finder.cpp)
add_executable(nasal ${CMAKE_SOURCE_DIR}/src/nasal_new_main.cpp)
add_library(nasal-object STATIC ${NASAL_OBJECT_SOURCE_FILE})
target_include_directories(nasal-object PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(nasal nasal-object)
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(nasal dl)
endif()
target_include_directories(nasal PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(nasal PRIVATE ${CMAKE_SOURCE_DIR}/src)
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
add_custom_command(