?login_element?

Subversion Repositories NedoOS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

  1. ##############################################################
  2. #
  3. # CMakeLists.txt - created by Cizo2000 <cizo2000@gmail.com>
  4. #
  5. ##############################################################
  6.  
  7. cmake_minimum_required(VERSION 3.9.6)
  8. set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
  9.  
  10. project(sjasmplus)
  11. set(MY_LUA_INCLUDE_DIR "lua5.1")
  12. set(MY_LUA_LIBRARY "lua5.1")
  13. set(MY_TOLUA++_INCLUDE_DIR "tolua++")
  14. set(MY_TOLUA++_LIBRARY "tolua++")
  15.  
  16. set(SOURCES
  17.         sjasm/devices.cpp
  18.         sjasm/directives.cpp
  19.         sjasm/io_nex.cpp
  20.         sjasm/io_snapshots.cpp
  21.         sjasm/io_tape.cpp
  22.         sjasm/io_trd.cpp
  23.         sjasm/parser.cpp
  24.         sjasm/reader.cpp
  25.         sjasm/sjasm.cpp
  26.         sjasm/sjio.cpp
  27.         sjasm/support.cpp
  28.         sjasm/tables.cpp
  29.         sjasm/z80.cpp
  30.         crc32c/crc32c.cpp
  31. )
  32.  
  33. add_definitions(-DMAX_PATH=PATH_MAX)
  34. add_definitions(-DCMAKE)
  35.  
  36. set(CMAKE_CXX_STANDARD 14)
  37. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  38. set(CMAKE_CXX_EXTENSIONS ON)
  39.  
  40. set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -pedantic")
  41. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic")
  42.  
  43. set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
  44. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
  45.  
  46. option(ENABLE_LUA "Enable LUA scripting support" ON)
  47. option(SYSTEM_LUA "Use system LUA and Tolua++ package" OFF)
  48.  
  49. if(ENABLE_LUA)
  50.         message(STATUS "Looking for Lua and Tolua++")
  51.         message(STATUS "Looking for Tolua++")
  52.  
  53.         if(SYSTEM_LUA)
  54.                 find_package(Tolua++)
  55.         endif(SYSTEM_LUA)
  56.  
  57.         if(TOLUA++_FOUND)
  58.                 message(STATUS "Looking for Tolua++ - found")
  59.                 include_directories(${TOLUA++_INCLUDE_DIR})
  60.         else(TOLUA++_FOUND)
  61.                 message(STATUS "Looking for Tolua++ - using local")
  62.                 set(TOLUA++_LIBRARY ${MY_TOLUA++_LIBRARY})
  63.                 set(TOLUA++_INCLUDE_DIR ${MY_TOLUA++_INCLUDE_DIR})
  64.                 add_subdirectory(${TOLUA++_INCLUDE_DIR})
  65.                 target_include_directories(${MY_TOLUA++_LIBRARY} PUBLIC
  66.             ${TOLUA++_INCLUDE_DIR}
  67.         )
  68.         endif(TOLUA++_FOUND)
  69.  
  70.         message(STATUS "Looking for Lua 5.1")
  71.  
  72.         if(SYSTEM_LUA)
  73.                 find_package(Lua51)
  74.         endif(SYSTEM_LUA)
  75.  
  76.         if(LUA51_FOUND)
  77.                 message(STATUS "Looking for Lua 5.1 - found: ${LUA_LIBRARIES}")
  78.                 include_directories(${LUA_INCLUDE_DIR})
  79.         else(LUA51_FOUND)
  80.                 message(STATUS "Looking for Lua 5.1 - using local")
  81.                 set(LUA_LIBRARY ${MY_LUA_LIBRARY})
  82.                 set(LUA_INCLUDE_DIR ${MY_LUA_INCLUDE_DIR})
  83.                 add_subdirectory(${LUA_INCLUDE_DIR})
  84.  
  85.                 target_include_directories(${MY_LUA_LIBRARY} PUBLIC
  86.             ${LUA_INCLUDE_DIR}
  87.                 )
  88.         endif(LUA51_FOUND)
  89.  
  90.         list(APPEND SOURCES
  91.                 sjasm/lua_lpack.c
  92.                 sjasm/lua_sjasm.cpp
  93.         )
  94.  
  95.         add_definitions(-DUSE_LUA)
  96.  
  97.         if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  98.                 add_definitions(-DLUA_USE_LINUX)
  99.         elseif(CYGWIN)
  100.                 add_definitions(-DLUA_USE_LINUX)
  101.         elseif(WIN32)
  102.                 add_definitions(-DLUA_USE_WINDOWS)
  103.         endif()
  104. endif(ENABLE_LUA)
  105.  
  106. include_directories(sjasm)
  107. include_directories(crc32c)
  108.  
  109. add_executable(${PROJECT_NAME} ${SOURCES})
  110.  
  111. target_link_libraries(
  112.         ${PROJECT_NAME}
  113.         ${LUA_LIBRARY}
  114.         ${TOLUA++_LIBRARY}
  115. )
  116.  
  117. if(NOT WIN32)
  118.         find_package(LibDL)
  119.         if(LIBDL_FOUND)
  120.         target_link_libraries(
  121.                 ${PROJECT_NAME}
  122.                 ${LIBDL_LIBRARIES}
  123.         )
  124.         endif(LIBDL_FOUND)
  125. endif()
  126.  
  127.  
  128. install(TARGETS ${PROJECT_NAME}
  129.         RUNTIME DESTINATION bin)
  130.  
  131. find_program(BASH_PROGRAM bash)
  132.  
  133. if(BASH_PROGRAM)
  134.         add_custom_target(tests COMMAND "EXE=${CMAKE_BINARY_DIR}/${PROJECT_NAME}" ${BASH_PROGRAM} "${CMAKE_SOURCE_DIR}/ContinuousIntegration/test_folder_tests.sh"
  135.                 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  136.                 DEPENDS ${PROJECT_NAME})
  137.  
  138.         add_custom_target(examples COMMAND "EXE=${CMAKE_BINARY_DIR}/${PROJECT_NAME}" ${BASH_PROGRAM} "${CMAKE_SOURCE_DIR}/ContinuousIntegration/test_folder_examples.sh"
  139.                 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  140.                 DEPENDS ${PROJECT_NAME})
  141. endif()
  142.