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) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif() 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) if(APPLE)
set(CMAKE_MACOSX_RPATH OFF) set(CMAKE_MACOSX_RPATH OFF)
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia") 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_RESOURCES nostalgia-studio.app/Contents/Resources)
set(NOSTALGIA_DIST_MAC_APP_CONTENTS nostalgia-studio.app/Contents) set(NOSTALGIA_DIST_MAC_APP_CONTENTS nostalgia-studio.app/Contents)
else() 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(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(NOSTALGIA_DIST_BIN bin) set(NOSTALGIA_DIST_BIN bin)
set(NOSTALGIA_DIST_LIB lib) set(NOSTALGIA_DIST_LIB lib)
set(NOSTALGIA_DIST_MODULE lib/nostalgia/modules) set(NOSTALGIA_DIST_MODULE lib)
set(NOSTALGIA_DIST_RESOURCES share) set(NOSTALGIA_DIST_RESOURCES share)
endif() endif()

View File

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

View File

@ -8,4 +8,4 @@ target_link_libraries(
Keel 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 # Keel
add_library( add_library(
NostalgiaKeelModules OBJECT NostalgiaKeelModules STATIC
keelmodules.cpp keelmodules.cpp
) )
target_link_libraries( target_link_libraries(
@ -27,7 +27,7 @@ install(
# Studio # Studio
if(TURBINE_BUILD_TYPE STREQUAL "Native") if(TURBINE_BUILD_TYPE STREQUAL "Native")
add_library( add_library(
NostalgiaStudioModules NostalgiaStudioModules STATIC
studiomodules.cpp studiomodules.cpp
) )
target_link_libraries( target_link_libraries(

View File

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

View File

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

View File

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