1- # Minimum CMake version requirement
21cmake_minimum_required (VERSION 3.16 FATAL_ERROR)
32
4- #set(CMAKE_GENERATOR_TOOLSET "ClangCl") # test compilation on clang-c
3+ project (quaesar LANGUAGES CXX)
54
5+ #set(CMAKE_GENERATOR_TOOLSET "ClangCl") # test compilation on clang-c
66option (ENABLE_CODE_GENERATION "Enable code generation" OFF )
77
8- # Project name and languages used
9- project (quaesar LANGUAGES CXX)
8+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
9+ message (WARNING "You are doing an in-source build. Recommended:
10+ ${CMAKE_COMMAND} -S ${CMAKE_SOURCE_DIR} -B build
11+ ${CMAKE_COMMAND} --build build" )
12+ endif ()
13+
1014
1115# Specify the C++ standard
1216set (CMAKE_CXX_STANDARD 20)
@@ -25,6 +29,24 @@ include(scripts/cmake/format_sources.cmake)
2529include (external/sdl2/sdl2.cmake)
2630
2731
32+ # ---------------------------------------------------------------------------
33+ # Global list of libraries to link with 'quaesar' collected from child cmake files
34+ # Children can call: quaesar_add_libs(<lib1> <lib2> ...)
35+ # ---------------------------------------------------------------------------
36+ set (QUAESAR_EXTRA_LIBS "" CACHE INTERNAL "Accumulated extra libraries for quaesar final link" )
37+ function (quaesar_add_libs)
38+ foreach (lib IN LISTS ARGN)
39+ if (lib)
40+ list (APPEND QUAESAR_EXTRA_LIBS "${lib} " )
41+ endif ()
42+ endforeach ()
43+ list (REMOVE_DUPLICATES QUAESAR_EXTRA_LIBS)
44+ # Write back to cache so subdirectories (different scopes) see updated value
45+ set (QUAESAR_EXTRA_LIBS "${QUAESAR_EXTRA_LIBS} " CACHE INTERNAL "Accumulated extra libraries for quaesar final link" FORCE)
46+ endfunction ()
47+
48+
49+
2850# Include CMakelists.txt libraries
2951set (UAE_CUSTOM_IMPL_DIR "${CMAKE_CURRENT_SOURCE_DIR} /src/uae_lib_imp" CACHE INTERNAL "Path to UAE custom implementation directory" )
3052add_subdirectory (libs/uae_lib)
@@ -37,8 +59,12 @@ add_subdirectory(external/nativefiledialog-extended) #nfd
3759add_subdirectory (libs/qd)
3860add_subdirectory (libs/amDebugger)
3961add_subdirectory (libs/exprParser)
40- add_subdirectory (libs/vAmiga)
41- add_subdirectory (libs/vamiga_imp_lib)
62+
63+ option (VAMIGA "Enable VAmiga support" ON )
64+ if (VAMIGA)
65+ include (VAmigaLib.cmake)
66+ endif ()
67+ #-------------------------------------------------------------------------------------------
4268
4369# Quasar *.h/cpp files
4470file (GLOB_RECURSE QUAESAR_SOURCES "src/*.cpp" )
@@ -130,6 +156,9 @@ if (LINUX OR UNIX)
130156 target_link_libraries (quaesar PRIVATE dl)
131157endif ()
132158
159+
160+ include (user_custoom_plugins.cmake OPTIONAL )
161+
133162#-------------------------------------------------------------------------------------------
134163# Include dirs
135164#-------------------------------------------------------------------------------------------
@@ -153,12 +182,12 @@ target_link_libraries(quaesar PRIVATE
153182 qd
154183 uae_lib
155184 amDebugger
156- VamigaImpLib
185+ ${QUAESAR_EXTRA_LIBS}
157186)
158187
159188
160189#if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/imgui.ini")
161- # file(COPY_FILE "${CMAKE_CURRENT_LIST_DIR}/bin/install/default_layout.ini" "${CMAKE_CURRENT_BINARY_DIR}/imgui.ini")
190+ # file(COPY_FILE "${CMAKE_CURRENT_LIST_DIR}/bin/install/default_layout.ini" "${CMAKE_CURRENT_BINARY_DIR}/imgui.ini")
162191#endif()
163192
164193
0 commit comments