Make libraries build as shared libraries on non-Apple/MS systems

This commit is contained in:
Gary Talent 2023-07-01 16:04:24 -05:00
parent da27447a4a
commit e89751dd72
7 changed files with 26 additions and 11 deletions

View File

@ -24,6 +24,10 @@ else()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia")
@ -33,11 +37,14 @@ if(APPLE)
set(NOSTALGIA_DIST_RESOURCES nostalgia-studio.app/Contents/Resources)
set(NOSTALGIA_DIST_MAC_APP_CONTENTS nostalgia-studio.app/Contents)
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../lib/ox" "$ORIGIN/../lib/nostalgia" "$ORIGIN/../")
if(UNIX)
set(BUILD_SHARED_LIBS ON)
endif()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(NOSTALGIA_DIST_BIN bin)
set(NOSTALGIA_DIST_LIB lib)
set(NOSTALGIA_DIST_MODULE lib/nostalgia/modules)
set(NOSTALGIA_DIST_MODULE lib)
set(NOSTALGIA_DIST_RESOURCES share)
endif()

View File

@ -3,10 +3,10 @@ BUILDCORE_PATH=deps/buildcore
include ${BUILDCORE_PATH}/base.mk
ifeq ($(OS),darwin)
NOSTALGIA_STUDIO=./build/${HOST}/${CURRENT_BUILD}/src/nostalgia/studio/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
NOSTALGIA_STUDIO=./build/${CURRENT_BUILD}/src/nostalgia/studio/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
MGBA=/Applications/mGBA.app/Contents/MacOS/mGBA
else
NOSTALGIA_STUDIO=./build/${HOST}/${CURRENT_BUILD}/src/nostalgia/studio/nostalgia-studio
NOSTALGIA_STUDIO=./build/${CURRENT_BUILD}/bin/nostalgia-studio
MGBA=mgba-qt
endif
@ -16,7 +16,7 @@ pkg-gba: install
.PHONY: run
run: build
./build/${HOST}/${CURRENT_BUILD}/src/nostalgia/player/nostalgia sample_project
./build/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: run-studio
run-studio: build
${NOSTALGIA_STUDIO}
@ -25,7 +25,7 @@ gba-run: pkg-gba
${MGBA} nostalgia.gba
.PHONY: debug
debug: build
${DEBUGGER} ./build/${HOST}/${CURRENT_BUILD}/src/nostalgia/player/nostalgia sample_project
${DEBUGGER} ./build/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: debug-studio
debug-studio: build
${DEBUGGER} ${NOSTALGIA_STUDIO}

View File

@ -8,4 +8,4 @@ target_link_libraries(
Keel
)
add_test("[keel] KeelTest writeUuidHeader" KeelTest writeUuidHeader)
add_test("[keel] writeUuidHeader" ${CMAKE_BINARY_DIR}/bin/KeelTest writeUuidHeader)

View File

@ -8,7 +8,7 @@ add_subdirectory(scene)
# Keel
add_library(
NostalgiaKeelModules OBJECT
NostalgiaKeelModules STATIC
keelmodules.cpp
)
target_link_libraries(
@ -27,7 +27,7 @@ install(
# Studio
if(TURBINE_BUILD_TYPE STREQUAL "Native")
add_library(
NostalgiaStudioModules
NostalgiaStudioModules STATIC
studiomodules.cpp
)
target_link_libraries(

View File

@ -8,7 +8,7 @@ add_library(
)
add_library(
NostalgiaCore-Studio-ImGui OBJECT
NostalgiaCore-Studio-ImGui
studiomodule.cpp
paletteeditor-imgui.cpp
tilesheeteditor-imgui.cpp

View File

@ -19,3 +19,11 @@ add_subdirectory(keel)
if(NOSTALGIA_BUILD_STUDIO)
add_subdirectory(studio)
endif()
install(
TARGETS
NostalgiaScene
DESTINATION
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

View File

@ -1,5 +1,5 @@
add_library(
NostalgiaScene-Studio OBJECT
NostalgiaScene-Studio
studiomodule.cpp
sceneeditor-imgui.cpp
sceneeditor.cpp