Skip to content

Commit

Permalink
Updates for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
solskogen committed Dec 10, 2023
1 parent 878f645 commit c5f33dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
16 changes: 6 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.18)
project(amiberry)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_FLAGS_RELEASE "-O3 -pipe")
Expand All @@ -21,7 +20,6 @@ endif()

# Needed so that cmake uses our find modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

include_directories(
src
src/osdep
Expand All @@ -30,7 +28,6 @@ include_directories(
src/archivers
)

add_subdirectory(external/libguisan)
set(libmt32emu_SHARED FALSE)
add_subdirectory(external/mt32emu)
add_definitions(-fno-pie -DAMIBERRY -D_FILE_OFFSET_BITS=64)
Expand Down Expand Up @@ -349,9 +346,9 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR ARCHITECTURE MATCHES "arm64")
add_definitions(-DCPU_AARCH64)
endif()

find_package(SDL2 REQUIRED )
find_package(SDL2_IMAGE REQUIRED sdl2_image)
find_package(SDL2_TTF REQUIRED sdl2_ttf)
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)

if(USE_DBUS)
add_definitions(-DUSE_DBUS)
Expand All @@ -365,12 +362,11 @@ find_package(mpg123 REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
find_library(LIBSERIALPORT_LIBRARIES serialport REQUIRED)
find_path(LIBSERIALPORT_INCLUDE_DIR libserialport.h)

INCLUDE_DIRECTORIES(${SDL2IMAGE_INCLUDE_DIRS} ${LIBSERIALPORT_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ./external/libguisan/include ./external/mt32emu/src)
add_subdirectory(external/libguisan)
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS} ./external/libguisan/include ./external/mt32emu/src )
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE SDL2 SDL2_image SDL2_ttf guisan mt32emu ${DBUS_LIBRARIES} FLAC png mpg123 mpeg2convert mpeg2 serialport z )

TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE guisan mt32emu SDL2 SDL2_image SDL2_ttf ${DBUS_LIBRARIES} FLAC png mpg123 mpeg2convert mpeg2 serialport z)
if(USE_OPENGL)
add_definitions(-DUSE_OPENGL)
find_package(OpenGL REQUIRED)
Expand Down
8 changes: 2 additions & 6 deletions external/libguisan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ add_library(guisan STATIC
src/widgets/textfield.cpp
src/widgets/togglebutton.cpp
src/widgets/window.cpp)
target_include_directories(guisan PRIVATE ./include)
target_include_directories(guisan PRIVATE ${SDL2_INCLUDE_DIRS} ./include)

find_package(SDL2 REQUIRED )
find_package(SDL2_IMAGE REQUIRED sdl2_image)

INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2IMAGE_LIBRARIES})

install(TARGETS guisan DESTINATION ./lib)

0 comments on commit c5f33dc

Please sign in to comment.