CMakeLists.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. cmake_minimum_required(VERSION 3.5)
  2. ################### Variables. ####################
  3. # Change if you want modify path or other values. #
  4. ###################################################
  5. set(PROJECT_NAME BeefBoot)
  6. # Output Variables
  7. set(OUTPUT_DEBUG Debug/bin)
  8. set(OUTPUT_RELEASE Release/bin)
  9. ############## CMake Project ################
  10. # The main options of project #
  11. #############################################
  12. project(${PROJECT_NAME} CXX C)
  13. set (CMAKE_CXX_STANDARD 17)
  14. add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
  15. #set(CMAKE_POSITION_INDEPENDENT_CODE ON)
  16. # Define Release by default.
  17. if(NOT CMAKE_BUILD_TYPE)
  18. set(CMAKE_BUILD_TYPE "Debug")
  19. message(STATUS "Build type not specified: Use Debug by default.")
  20. endif(NOT CMAKE_BUILD_TYPE)
  21. # Definition of Macros
  22. add_definitions(
  23. -DIDEHELPER_EXPORTS
  24. -DBFSYSLIB_DYNAMIC
  25. -DUNICODE
  26. -D_UNICODE
  27. -DBF_NO_FBX
  28. -DFT2_BUILD_LIBRARY
  29. -DBFSYSLIB_DYNAMIC
  30. )
  31. if (${APPLE})
  32. include_directories(
  33. .
  34. ../
  35. ../BeefySysLib/
  36. ../BeefySysLib/third_party
  37. ../BeefySysLib/third_party/freetype/include
  38. ../IDEHelper
  39. ../BeefySysLib/platform/osx
  40. )
  41. else()
  42. include_directories(
  43. .
  44. ../
  45. ../BeefySysLib/
  46. ../BeefySysLib/third_party
  47. ../BeefySysLib/third_party/freetype/include
  48. ../IDEHelper
  49. ../BeefySysLib/platform/linux
  50. )
  51. endif()
  52. ############## Artefacts Output #################
  53. # Defines outputs , depending Debug or Release. #
  54. #################################################
  55. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  56. add_definitions(
  57. -D_DEBUG
  58. )
  59. set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${OUTPUT_DEBUG}")
  60. else()
  61. set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${OUTPUT_RELEASE}")
  62. endif()
  63. ################### Dependencies ##################
  64. # Add Dependencies to project. #
  65. ###################################################
  66. option(BUILD_DEPENDS
  67. "Build other CMake project."
  68. ON
  69. )
  70. # Dependencies : disable BUILD_DEPENDS to link with lib already build.
  71. if(BUILD_DEPENDS)
  72. else()
  73. endif()
  74. ################# Flags ################
  75. # Defines Flags for Windows and Linux. #
  76. ########################################
  77. if(MSVC)
  78. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W3 /MD /MDd /Od /EHsc")
  79. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W3 /GL /Od /Oi /Gy /EHsc")
  80. endif(MSVC)
  81. if(NOT MSVC)
  82. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wno-multichar -Wno-invalid-offsetof")
  83. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  84. #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
  85. endif()
  86. endif(NOT MSVC)
  87. ################ Files ################
  88. # -- Add files to project. -- #
  89. #######################################
  90. file(GLOB SRC_FILES
  91. BeefBoot.cpp
  92. BootApp.cpp
  93. )
  94. # Add executable to build.
  95. add_executable(${PROJECT_NAME}
  96. ${SRC_FILES}
  97. )
  98. find_package(LLVM 19.1 CONFIG COMPONENTS)
  99. if (LLVM_FOUND)
  100. message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
  101. message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
  102. include_directories(${LLVM_INCLUDE_DIRS})
  103. add_definitions(${LLVM_DEFINITIONS})
  104. set(TARGET_LIBS_OS "-lLLVM-19")
  105. else()
  106. message(FATAL_ERROR "LLVM not found")
  107. endif()
  108. if (${APPLE})
  109. set(TARGET_LIBS_OS "")
  110. else()
  111. #set(TARGET_LIBS_OS "curses")
  112. #set(TARGET_LIBS_OS "-Xlinker --no-demangle -v")
  113. set(TARGET_LIBS_OS "${LLVM_SYSTEM_LIBS}")
  114. endif()
  115. # Link with other dependencies.
  116. if(MSVC)
  117. target_link_libraries(${PROJECT_NAME} BeefySysLib IDEHelper kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib)
  118. else()
  119. target_link_libraries(${PROJECT_NAME} BeefySysLib
  120. IDEHelper
  121. ${TARGET_LIBS_OS}
  122. )
  123. endif()